Is this a dialog or activity?

后端 未结 2 1961
情话喂你
情话喂你 2021-01-15 15:23

When you long press on an email in Gmail application the dialog box is shown. I\'m wondering is it just a dialog or an activity represented as dialog? Thank you.

相关标签:
2条回答
  • 2021-01-15 15:46

    Your screen shot code should look like this. Here there is no need to dismiss your dialog, when selected option it automatically dismissed.

    AlertDialog dialog ;
    Charsequence str[]={"Test1","Test2"};
    
    
    AlertDialog.Builder builder=new AlertDialog.Builder(this);
    builder.setTitle("Your Title Here");
    builder.setItems(str, new DialogInterface.OnClickListener() {
    
                @Override
                public void onClick(DialogInterface dialog, int position) {
                    //here you can use like this... str[position]
    
                }
    
            });
            dialog = builder.create();
            dialog.show();
    
    0 讨论(0)
  • 2021-01-15 15:52

    Probably it should be a Dialog and when you select/click the item it may be open an Activity based on the type of commands. However an Activty can be displayed as a Dialog but here as the items in the dialog are related to the context of the same activty therfore it can't be a new activty here.

    0 讨论(0)
提交回复
热议问题