<legend id='rKmwP'><style id='rKmwP'><dir id='rKmwP'><q id='rKmwP'></q></dir></style></legend>
    <tfoot id='rKmwP'></tfoot>
    <i id='rKmwP'><tr id='rKmwP'><dt id='rKmwP'><q id='rKmwP'><span id='rKmwP'><b id='rKmwP'><form id='rKmwP'><ins id='rKmwP'></ins><ul id='rKmwP'></ul><sub id='rKmwP'></sub></form><legend id='rKmwP'></legend><bdo id='rKmwP'><pre id='rKmwP'><center id='rKmwP'></center></pre></bdo></b><th id='rKmwP'></th></span></q></dt></tr></i><div id='rKmwP'><tfoot id='rKmwP'></tfoot><dl id='rKmwP'><fieldset id='rKmwP'></fieldset></dl></div>

      <bdo id='rKmwP'></bdo><ul id='rKmwP'></ul>

      <small id='rKmwP'></small><noframes id='rKmwP'>

    1. Android:如何从警报对话框启动 Activity

      时间:2023-08-30
          <i id='EbFOS'><tr id='EbFOS'><dt id='EbFOS'><q id='EbFOS'><span id='EbFOS'><b id='EbFOS'><form id='EbFOS'><ins id='EbFOS'></ins><ul id='EbFOS'></ul><sub id='EbFOS'></sub></form><legend id='EbFOS'></legend><bdo id='EbFOS'><pre id='EbFOS'><center id='EbFOS'></center></pre></bdo></b><th id='EbFOS'></th></span></q></dt></tr></i><div id='EbFOS'><tfoot id='EbFOS'></tfoot><dl id='EbFOS'><fieldset id='EbFOS'></fieldset></dl></div>
            <tbody id='EbFOS'></tbody>
          <legend id='EbFOS'><style id='EbFOS'><dir id='EbFOS'><q id='EbFOS'></q></dir></style></legend>
            • <tfoot id='EbFOS'></tfoot>

              <small id='EbFOS'></small><noframes id='EbFOS'>

              • <bdo id='EbFOS'></bdo><ul id='EbFOS'></ul>
                本文介绍了Android:如何从警报对话框启动 Activity的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                I need to start an activity when the user chooses an item in an alert dialog. How do I get the context to pass to the intent constructor in the following code...

                builder.setItems(items, new DialogInterface.OnClickListener() {
                
                        public void onClick(DialogInterface dialog, int item) {
                
                                Intent i = new Intent(<WHAT DO I PUT HERE?>, <new activity>.class);    
                                startActivity(i);
                
                      }
                
                });
                

                Is it the use of the inner class?? Any thoughts?

                解决方案

                You can retrieve the context you have passed to AlertDialog.Builder with getBaseContext(). See the doc here.

                So this should work:

                Intent i = new Intent(getBaseContext(), <new activity>.class);    
                startActivity(i);
                

                这篇关于Android:如何从警报对话框启动 Activity的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:在 Android 上,如何检测显示系统对话框(电源选项 下一篇:自定义对话框上的 Admob 广告

                相关文章

                最新文章

                <small id='pYQNl'></small><noframes id='pYQNl'>

                • <bdo id='pYQNl'></bdo><ul id='pYQNl'></ul>

                1. <i id='pYQNl'><tr id='pYQNl'><dt id='pYQNl'><q id='pYQNl'><span id='pYQNl'><b id='pYQNl'><form id='pYQNl'><ins id='pYQNl'></ins><ul id='pYQNl'></ul><sub id='pYQNl'></sub></form><legend id='pYQNl'></legend><bdo id='pYQNl'><pre id='pYQNl'><center id='pYQNl'></center></pre></bdo></b><th id='pYQNl'></th></span></q></dt></tr></i><div id='pYQNl'><tfoot id='pYQNl'></tfoot><dl id='pYQNl'><fieldset id='pYQNl'></fieldset></dl></div>
                2. <legend id='pYQNl'><style id='pYQNl'><dir id='pYQNl'><q id='pYQNl'></q></dir></style></legend>

                  1. <tfoot id='pYQNl'></tfoot>