i want to set a dialog on one of my buttons, the button in question is bd. how do i go about it? i want a dialog to pop up with a no to cancel the button action and a yes to continue the action. how do i set that on the button. my code`
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_mt, container, false);
v.findViewById(R.id.bd).setOnClickListener(this);
v.findViewById(R.id.mcall).setOnClickListener(this);
v.findViewById(R.id.sd).setOnClickListener(this);
v.findViewById(R.id.ltss).setOnClickListener(this);
return v;
}
public void onClick(View v) {
switch (v.getId()) {
case R.id.mcall:
Intent intentcall = new Intent();
intentcall.setAction(Intent.ACTION_CALL);
intentcall.setData(Uri.parse("tel:" + "216"));//set the Uri
startActivity(intentcall);
break;
case R.id.bd:
String encodedHarsh2 = "*"+"461" + "*" +"1" + "*" +"1"+ Uri.encode("#");
intentcall = new Intent();
intentcall.setAction(Intent.ACTION_CALL);
intentcall.setData(Uri.parse("tel:" + encodedHarsh2 ));//set the Uri
startActivity(intentcall);
break;
case R.id.sd:
String encodedHarsh3 = "*"+"461" + "*" +"5" +"*"+ "4"+ Uri.encode("#");
intentcall = new Intent();
intentcall.setAction(Intent.ACTION_CALL);
intentcall.setData(Uri.parse("tel:" + encodedHarsh3 ));//set the Uri
startActivity(intentcall);
break;
case R.id.ltss:
Intent intent = new Intent(getActivity(),lts.class);
startActivity(intent);
break;
default:
break;
}
}
}`