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 5987427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:48:48+00:00 2026-05-22T22:48:48+00:00

So, in my program i have a TabActivity which contains two tabs, one tab

  • 0

So, in my program i have a TabActivity which contains two tabs, one tab is a ListView and another is a MapActivity that gets started via an Intent. What i want my app to do is send a query with phones location and the name of a product and reveice a list of nearest shops that have this product, then show those shops in the map tab and show the list of them in another tab. The app starts listening for location when TabActivity is started and the communication with the server (in AsyncTask) starts as soon as location is obtained.

The problem is that when TabActivity starts, it also starts the MapActivity because it is in its first tab, and the MapActivity starts to try to add overlays on the map but there is no data yet for these overlays, because the AsyncTask in TabActivity hasnt finished getting data from the server yet, which crashes the program.

I need my app to show an empty google map when TabActivity is first opened and wait for the data to be obtained from server and then add overlays to the map to mark the shops on it. Can anyone show me how can I achieve this? I guess i should remove the Overlay making part of code from onCreate in MapActivity and put it somewhere else but i dont know where.

  • 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-05-22T22:48:49+00:00Added an answer on May 22, 2026 at 10:48 pm

    A potentially better approach would be to get the current tab activity with ActivityGroup#getCurrentActivity(), check and cast to the expected MapActivity, and then call a method in that activity:

    protected void onPostExecute(final Bitmap result) {
        final Activity activity = MyTabActivity.this.getCurrentActivity();
        if (activity instanceof MyMapActivity) {
            ((MyMapActivity) activity).onBitmapReceived(result); // or some other method, like onMarkersReceived(), etc..
        }
    }
    

    The problem with the BroadcastReceiver solution is that the broadcast goes beyond your application’s sandbox, attempting to notify anyone on the device that is listening for your intent, even though only one receiver actually wants anything to do with it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a TabActivity with several tabs. Each tab corresponds to a specific view,
My program have two tabs, I set init variable in viewDidLoad. ( int A
in a C program I have an long* that I want to serialize (thus
In my program I have one array with 25 double values 0.04 When I
I have a program that spits out both standard error and standard out, and
I have a program that creates a Windows user account using the NetUserAdd() API
I have a program that uses the mt19937 random number generator from boost::random. I
I have a program which needs to behave slightly differently on Tiger than on
I have a program that spits out an Excel workbook in Excel 2003 XML
I have an android activity in which I'm using tabs. public class UnitActivity extends

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.