首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何在Android中创建自定义警报对话框?

如何在Android中创建自定义警报对话框?

提问于 2018-01-31 00:16:36
回答 2关注 0查看 199

代码如下:

代码语言:txt
复制
public void selfDestruct(View view) {
         // Kabloey
         Log.d("Naveen", "Test====");
         System.out.println("----------------------ghfgjhf-----------------");
         AlertDialog alertDialog = new AlertDialog.Builder(SecondActivity.this).create();
         alertDialog.setTitle("Reset...");
         alertDialog.setMessage("R u sure?");
         alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int which) {

               //here you can add functions

            } });
         alertDialog.show();
     }
代码语言:txt
复制
   <Button
     android:layout_height="wrap_content"
     android:layout_width="wrap_content"
     android:text="@string/self_destruct"
     android:onClick="selfDestruct" />

回答

和开发者交流更多问题细节吧,去 写回答
相关文章

相似问题

相关问答用户
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档