Monday, June 6, 2011

[android-developers] Re: ontap and tabhost

Here is the error message....No enclosing instance of the type MainMap
is accessible in scope. I read that one solution is to make
"MyItemizedOverlay" an inner class of mymap class.

On Jun 6, 6:54 am, ArcDroid <jacobrjohn...@gmail.com> wrote:
> hello, I am trying to click on a geo point and then open another tab.
> here is my code....
>
> public class MapItemizedOverlay extends ItemizedOverlay {
>
> public MapItemizedOverlay(Drawable drawable, Context context) {
>                 super(boundCenterBottom(drawable));
>                   mContext = context;
>                 }
> @Override
>         protected boolean onTap(int index) {
>           OverlayItem item = mOverlays.get(index);
>           AlertDialog.Builder dialog = new AlertDialog.Builder(mContext);
>           strRoom = item.getTitle();
>           dialog.setTitle("title: "+strRoom);
>           dialog.setIcon(R.drawable.butblue48x48);
>           dialog.setMessage("message: "+item.getSnippet());
>           dialog.setCancelable(true);
>           dialog.setPositiveButton("Open Room", new
> DialogInterface.OnClickListener() {
>           public void onClick(DialogInterface dialog, int id) {
>
>        //these two lines don't
> work----------------------------------------------------
>                TabActivity ta = (TabActivity)
> mContext.getApplicationContext();
>             ta.getTabHost().setCurrentTab(3);
>       }
>       });
>       dialog.setNegativeButton("Cancel", new
> DialogInterface.OnClickListener() {
>           public void onClick(DialogInterface dialog, int id) {
>               dialog.dismiss();
>           }
>       });
>
>           dialog.show();
>
>                 return true;
>         }

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment