我正在使用对话框。 我希望如果我点击按钮,其他活动被调用。但它给出了以下错误。 //构造意图(新DialogInterface.OnClickListener(){},类)是未定义如何从一项活动中调用另一项活动(课程)?
下面的代码
builder1.setNegativeButton("secondact", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
Intent i=new Intent(this, FbsampleActivity.class)
}
});
你能解释一下为什么不使用getBaseContext(); – Carnal 2012-07-11 07:18:13
看到这篇文章http://stackoverflow.com/questions/1026973/android-whats-the-difference-between-the-various-methods-to-get-a-context和这个谷歌官方博客http:// android- developers.blogspot.in/2009/01/avoiding-memory-leaks.html – 2012-07-11 07:20:05
它'可能导致内存泄漏,因为它包含上下文的旧参考,如果你不更新它 – 2012-07-11 07:21:21