Wis*_*rdi 1 android android-intent
当我单击地图中的某个项目时,会出现一个显示"路由到"的正按钮.问题,如何从正面按钮开始活动?
我也这样用,
dialog.setPositiveButton("Tampilkan Rute", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int Button) {
Intent i = new Intent(this, Rute.class);
startActivity(i);
}
});
Run Code Online (Sandbox Code Playgroud)
开始进入Rute类但它总是说"删除参数匹配intent()"然后我不知道该怎么做.
这是我的代码
@Override
protected boolean onTap(int index) {
OverlayItem item = items.get(0);
AlertDialog.Builder dialog = new AlertDialog.Builder(mContext);
dialog.setTitle(item.getTitle());
dialog.setMessage(item.getSnippet());
dialog.setPositiveButton("Tampilkan Rute", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int Button) {
Intent i = new Intent(this, Rute.class);
startActivity(i);
}
});
dialog.setNegativeButton("Kembali", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int Button) {
dialog.cancel();
}
});
dialog.show();
return true;
}
Run Code Online (Sandbox Code Playgroud)
任何建议将不胜感激.谢谢
对不起,如果我的英语不好:(
只需更改this引用类的范围而不是OnClickListener:
Intent i = new Intent(MyActivity.this, Rute.class);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1392 次 |
| 最近记录: |