this Question is different because this is using api data to intent and then if you use normal if else condition its not working . check the right answer below and the condition of it ----------
hi,
I'm trying to get android call service to a button click ,button is inside a ListView
when I click one list item it goes to single item view in that single item view each single item has a mobile number attached to call button . Numbers are stored in parse data base and i'm calling using parse api .
Now when I'm clicking a number it goes to call function . what I need is, suppose a single view doesn't have a mobile number , the button should not be clickable.If anyone knows please help me.
edited answer as one of below anwer but this also not working
btn = (Button) findViewById(R.id.button56) ;
btn.setClickable(false);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String phno = object.getString("telephone");
Intent i=new Intent(Intent.ACTION_DIAL,Uri.parse("tel:" +phno));
startActivity(i);
}
});
Below is my code
btn = (Button) findViewById(R.id.button56) ;
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String phno = object.getString("telephone");
Intent i=new Intent(Intent.ACTION_DIAL,Uri.parse("tel:" +phno));
startActivity(i);
}
});