I’m going to write some function in AlertDialog’s item : – Code is : –
final CharSequence[] items = {"Now", "Later", "Cancel"};
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("When you need to Take BackUp?");
builder.setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item)
{
// Toast.makeText(getApplicationContext(),items[item],Toast.LENGTH_SHORT).show();
items[0].notify();
items[1].charAt(2);
}
});
builder.show();
This item will enable some function, how can i declare and define that.
The
itemthat is selected will be passed into theonClickmethod, theint itemin the method’s signature.Then outside of the method where you create the
AlertDialog:etc…