开发者

Is this a dialog or activity?

开发者 https://www.devze.com 2023-02-11 21:25 出处:网络
When you long press开发者_JAVA技巧 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.

When you long press开发者_JAVA技巧 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.

Is this a dialog or activity?


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.


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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号