Discussion Forums  >  Maps, Device Location, Tracking

Replies: 4    Views: 112

Mr stuck
Android Fan
Profile
Posts: 974
Reg: Apr 09, 2012
Fife, Scotland
15,740
03/24/13 02:43 PM (11 years ago)

more buttons in map callout?

Is it possible to have more than just "details/OK" or "directions/OK" buttons in android map call out. Can it be changed to show 3 buttons eg. Directions, details and OK buttons?
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
03/24/13 04:20 PM (11 years ago)
You know, you should be able to, although I haven't tried it yet. According to the Android docs, there should be no more than 3 action buttons on an alert. http://developer.android.com/guide/topics/ui/dialogs.html So it would seem like you should be able to massage the alert code so something could work... Try this: myAlert = new AlertDialog.Builder(this).create(); myAlert.setTitle(theTitle); myAlert.setMessage(theSubTitle); myAlert.setIcon(pinGraphic); myAlert.setCancelable(false); myAlert.setButton(getString(R.string.details), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { myAlert.dismiss(); showDetailsScreen(); } }); myAlert.setButton2(getString(R.string.mapDrivingDirections), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { myAlert.dismiss(); showDirections(); } }); myAlert.setButton3(getString(R.string.ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { myAlert.dismiss(); } }); I finished the code before I documented 'which' line numbers, so just hunt for the alert code 'around' line 450 or so and comment out from the beginning of the alert to just before the command 'myAlert.show();' somewhere near line 500 or so... I haven't tried it myself, lol! but it should work ok. Cheers! -- Smug Edit: I suppose it 'would' help to say this is in bt_screen_map.java, lol! sorry about that.
 
Mr stuck
Android Fan
Profile
Posts: 974
Reg: Apr 09, 2012
Fife, Scotland
15,740
like
03/24/13 04:34 PM (11 years ago)
Thanks Smug. Will try it when I get some time. Its bedtime for me now lol. Got work in morning. Will keep you posted ;-)
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
03/24/13 04:35 PM (11 years ago)
No problems! Let me know how it goes. Cheers! -- Smug
 
LA
Aspiring developer
Profile
Posts: 3278
Reg: Aug 16, 2012
Jerseyville, IL
42,880
like
03/25/13 06:21 AM (11 years ago)
Very nice! Going to copy your code @SmugWimp! @Mr stuck: Let me know how it works for you. Both of you: You going to St. Louis? LA
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.