2010-06-04 45 views
1

当我接受警报时,我的第一个屏幕上有警报消息,我必须显示下一个屏幕并将某些值传递给该屏幕以显示值。我对android非常陌生。如何在接受警报时打开新的屏幕?

new AlertDialog.Builder(this) 
    .setTitle("File accept!") 
    .setMessage("Do you Want to open "+name+" file !!") 
    .setPositiveButton("Open", new DialogInterface.OnClickListener() 
    { 
     public void onClick(DialogInterface dlg,int acc) 
     { 
      //here i need to open a new screen 
     } 
    }) 
    .setNegativeButton("Close", new DialogInterface.OnClickListener() { 
    public void onClick(DialogInterface dlg, int sumthin) { 

    // do nothing – it will close on its own 
    } 
    })  
    .show(); 
    } 

--Thanks提前

+0

发布一些代码,然后我们可以帮助你 – RoflcoptrException 2010-06-04 12:46:55

回答

0

你想与获取上下文和类对象的构造创建Intent。在这个意图中,你必须指定处理新屏幕的类。这个类必须扩展Activity。

要获取文件名到新屏幕,请使用intent.putExtra将数据包附加到该意图。在新的活动中,您可以使用getIntent.getExtras()来检索附加到Intent的数据。