0
Я пытался сделать диалог Alert в студии android. Но здесь он показывает, что код недостижим. Пожалуйста, помогите мне.Alert.Dialog builder code unreachable
public class Mydialog extends DialogFragment
{
@Override
public Dialog onCreateDialog(Bundle savedInstanceState)
{
AlertDialog.Builder theDialog = new AlertDialog.Builder(getActivity());
theDialog.setTitle("Sample Dialog");
theDialog.setMessage("hello world");
return super.onCreateDialog(savedInstanceState);
theDialog.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
toasty("Clicked Ok");
}
});
}
public void toasty(String str)
{
Toast.makeText(getActivity(),str,Toast.LENGTH_SHORT).show();
}
}
Упс !! Спасибо брат. –
@ M.S.P отредактировал: – AndroidEx