how to start activity of the positive button?
Posted
by
Wisnuardi
on Stack Overflow
See other posts from Stack Overflow
or by Wisnuardi
Published on 2012-11-09T23:48:10Z
Indexed on
2012/11/10
5:00 UTC
Read the original article
Hit count: 120
android
|android-intent
when I click an item in maps, it will appears positive button that reads "Route to". Question, how do I start activity from that positive button?
I also use like this,
dialog.setPositiveButton("Tampilkan Rute", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int Button) {
Intent i = new Intent(this, Rute.class);
startActivity(i);
}
});
to startactivity into Rute class but it always say "remove argument to match intent()" then I don't know what to do.
here is my code
@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;
}
Any suggestions will be greatly appreciated. Thank's
i'm sorry if my english is bad :(
© Stack Overflow or respective owner