I am trying to call intent only when the result field have value "yes", otherwise it should disable the button. Can anyone please help. It works only one time. I have dynamic records that have result value set to "no" and only few records have result value set to "yes". Problem is my code works if i directly check "yes" value result but if I check "no" value result before it doesn't work.
Below is my code-
holder.results.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
/*Intent intent = (new Intent(context, Result.class));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra("id", id);
Log.d("id",holder.did.getText()
.toString());
v.getContext().startActivity(intent);*/
if (getItem(0).getId().length() > 0) {
Log.d("result",holder.result.getText()
.toString());
/*if(holder.result.equals(holder.did.getText()
.toString())){*/
if(holder.result.getText()
.toString().contains("yes")){
Intent intent = (new Intent(context, Result.class));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra("id", holder.did.getText()
.toString());
Log.d("id",holder.did.getText()
.toString());
v.getContext().startActivity(intent);
}
else if(holder.result.getText()
.toString().contains("no")){
holder.results.setEnabled(false);
}
} else {
holder.results.setEnabled(false);
// C.ToastShort(context, "no data available");
}
}
});
0 comments:
Post a Comment