2011-04-11 27 views
0

任何人都可以找出为什么这会导致一个力量关闭?强力关闭试图启动一个市场页面和提示框

void failbox(){ 
    // Create the alert box 
     AlertDialog.Builder alertbox = new AlertDialog.Builder(this); 

     // Set the message to display 
     alertbox.setMessage(R.string.fail); 

     alertbox.setPositiveButton("Get Busybox", new DialogInterface.OnClickListener() { 

      // do something when the button is clicked 
      public void onClick(DialogInterface arg0, int arg1) { 


       Intent i = new Intent(Intent.ACTION_VIEW); 
       i.setData(Uri.parse("market://details?id=stericson.busybox")); 
      } 
      }); 

     // set a negative/no button and create a listener 
     alertbox.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { 

      // do something when the button is clicked 
      public void onClick(DialogInterface arg0, int arg1) { 

      } 
     }); 

     // show the alert box 
     alertbox.show(); 

    } 

在此先感谢!

+0

什么是“本” ......鼠标移到它的上下文。这是一个活动吗? – 2011-04-11 22:55:35

+0

我很遗憾地被你的问题困惑......哈哈。你能详细说明一下吗? – 2011-04-11 22:58:58

回答

0

如果你在模拟器中强制关闭,就是这样,就我所知。您无法通过仿真器的市场应用程序访问市场。

当您的应用在真实 Android设备上运行时是否仍然崩溃?

(当然,一些人已经找到了偷偷摸摸的方式来获得从仿真器市场。见How to install Android Market App on the emulator?