Привет в приведенном ниже имени неправильно передается другому действию. Может ли кто-нибудь мне помочь.
Я сравниваю свое имя пользователя с user_name, если оба значения равны, тогда я отправляю свое имя в другое действие .
Поддержите мое имя пользователя - admin, а user_name - admin, тогда я смогу передать имя из API. Если это второй элемент списка, он не работает.
private void fetchUserJSON(final String sessionId, final String username){
handler.postDelayed(new Runnable() {
@Override
public void run() {
// Write code for your refresh logic
// progressDialog = new ProgressDialog(getActivity());
// progressDialog.setIndeterminate(true);
// progressDialog.setMessage("Loading...");
// progressDialog.setCanceledOnTouchOutside(false);
// progressDialog.setCancelable(false);
// progressDialog.show();
// sessionId = getIntent().getStringExtra("sessionId");
//username = getIntent().getStringExtra("username");
String operation = "query";
String query = "select * from Users";
final GetNoticeDataService service = RetrofitInstance.getRetrofitInstance().create(GetNoticeDataService.class);
/** Call the method with parameter in the interface to get the notice data*/
Call<UserModule> call = service.UserRecordDetails(operation, sessionId, query);
/**Log the URL called*/
Log.i("URL Called", call.request().url() + "");
call.enqueue(new Callback<UserModule>() {
@Override
public void onResponse(Call<UserModule> call, Response<UserModule> response) {
Log.e("response", new Gson().toJson(response.body()));
if (response.isSuccessful()) {
Log.e("response", new Gson().toJson(response.body()));
UserModule userModule = response.body();
String success = userModule.getSuccess();
if (success.equals("true")) {
Results_Users results = userModule.getResult();
records = results.getRecords();
for (Records records1 : records) {
String user_name = records1.getUser_name();
String id = records1.getId();
Log.d("id",id);
String first_name = records1.getFirst_name();
String last_name = records1.getLast_name();
String email1=records1.getEmail1();
String title=records1.getTitle();
Records records=new Records(user_name,title,first_name,last_name,email1,id);
recordsList.add(records);
}
if(username.equals(recordsList.get(0).getUser_name()))
i = new Intent(LoginActivity.this, MainActivity.class);
i.putExtra("first_name", recordsList.get(2).getFirst_name());
startActivity(i);
finish();
}
}
}
@Override
public void onFailure(Call<UserModule> call, Throwable t) {
}
// progressDialog.dismiss();
});
}
}, 0);
return ;
}