Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7739789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:36:34+00:00 2026-06-01T08:36:34+00:00

I simply have 2 tabs and used Experience – Multiple Android Activities in a

  • 0

I simply have 2 tabs and used Experience – Multiple Android Activities in a TabActivity as reference.
My class Architecture is like this:
MainActivity extends TabActivity
1.TabGroup1Activity extends TabGroupActivity (TabGroupActivity-class implemented from above reference)
1.i. Tab1Activity extends MapActivity (which has multiple marker)
2.TabGroup2Activity extends TabGroupActivity
2.i. Tab2Activity

In second tab (Tab2Activity) i show the google map which has multiple markers. On Taping the marker I showed the alertdialog with More Info option.
Onclicking the More Info Option i have to start new activity without loosing tabs at bottom.

where is the error i dont know ??

MapItemizedOverlay.java

public class InformationItemizedOverlay extends ItemizedOverlay<OverlayItem> {
private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>();
private Context mContext;
Activity parentContext;

public InformationItemizedOverlay(Drawable defaultMarker, Context context,
        Activity parent) {
    super(boundCenterBottom(defaultMarker));

    mContext = context;
    parentContext = parent;
}

public void addOverlay(OverlayItem overlay) {
    mOverlays.add(overlay);
    populate();
}

@Override
protected OverlayItem createItem(int i) {
    return mOverlays.get(i);
}

@Override
public int size() {
    return mOverlays.size();
}

@Override
protected boolean onTap(int index) {

    OverlayItem item = mOverlays.get(index);
    AlertDialog.Builder dialog = new AlertDialog.Builder(parentContext);
    dialog.setTitle(item.getTitle());
    dialog.setMessage(item.getSnippet());
    dialog.setPositiveButton("More Info..",
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    // TODO Auto-generated method stub
                    Intent test = new Intent(parentContext,
                            AboutActivity.class);
                    TabGroupActivity parentActivity = (TabGroupActivity) parentContext;
                    parentActivity
                            .startChildActivity("AboutActivity", test);
                }
            });
    dialog.show();
    return true;

}
}

When i try with above code, error gives when i click the More Info button at alertdialog.
When i remove the alertdialog and write the following code, it works fine, opens new activity in the same tab:

@Override
protected boolean onTap(int index) {

    OverlayItem item = mOverlays.get(index);

                    Intent test = new Intent(parentContext,
                            AboutActivity.class);
                    TabGroupActivity parentActivity = (TabGroupActivity) parentContext;
                    parentActivity
                            .startChildActivity("AboutActivity", test);
                }
            });

    return true;

}

How can i make it work to open new activity when i click the More Info button at alertdialog ??
Help !!

04-05 17:42:02.171: W/dalvikvm(2631): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
04-05 17:42:02.171: E/AndroidRuntime(2631): FATAL EXCEPTION: main
04-05 17:42:02.171: E/AndroidRuntime(2631): java.lang.ClassCastException: com.bbs.MainActivity
04-05 17:42:02.171: E/AndroidRuntime(2631): at com.bbs1.InformationItemizedOverlay$1.onClick(InformationItemizedOverlay.java:63)
04-05 17:42:02.171: E/AndroidRuntime(2631): at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:158)
04-05 17:42:02.171: E/AndroidRuntime(2631): at android.os.Handler.dispatchMessage(Handler.java:99)
04-05 17:42:02.171: E/AndroidRuntime(2631): at android.os.Looper.loop(Looper.java:123)
04-05 17:42:02.171: E/AndroidRuntime(2631): at android.app.ActivityThread.main(ActivityThread.java:4627)
04-05 17:42:02.171: E/AndroidRuntime(2631): at java.lang.reflect.Method.invokeNative(Native Method)
04-05 17:42:02.171: E/AndroidRuntime(2631): at java.lang.reflect.Method.invoke(Method.java:521)
04-05 17:42:02.171: E/AndroidRuntime(2631): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-05 17:42:02.171: E/AndroidRuntime(2631): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-05 17:42:02.171: E/AndroidRuntime(2631): at dalvik.system.NativeStart.main(Native Method)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T08:36:35+00:00Added an answer on June 1, 2026 at 8:36 am

    You have to run the AlertDialogue on current UI Thread. Use runOnUiThread() to start the UI Thread.Here is the example:

    runOnUiThread(new Runnable() {
     @Override
     public void run() {
      AlertDialog.Builder dialog = new AlertDialog.Builder(parentContext);
      dialog.setTitle(item.getTitle());
      dialog.setMessage(item.getSnippet());
      dialog.setPositiveButton("More Info..",new DialogInterface.OnClickListener() {
      @Override
      public void onClick(DialogInterface dialog, int which) {
      // TODO Auto-generated method stub
      Intent test = new Intent(parentContext,AboutActivity.class);
      TabGroupActivity parentActivity = (TabGroupActivity) parentContext;
      parentActivity.startChildActivity("AboutActivity", test);
      }
      });
      dialog.show();
     }//run
    });//runOnUIThred
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I simply have 2 tabs and used Experience - Multiple Android Activities in a
I have this simple js tabs. Here is the html : <div class=product-collateral> <div
I have a very simply query like this: SELECT users.id, COUNT(others.id) as c FROM
I have used 4 tabs.I want show tabbar in all activity so i used
In reference to this question: Which is prefered CTabCtrl vs CPropertySheet I have a
I simply want some tabbing functionality on a facebook application (business) tabs I have
I have this app which consists of three tabs. The first tab has a
I have an existing toolbar and would like to add tabs to it that
I have made a very simple AppleScript to close tabs in Safari. The problem
First of all, excuse my poor topic title. I simply have no idea how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.