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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:17:11+00:00 2026-06-15T13:17:11+00:00

I am building an app which looks something like this. It has a action

  • 0

I am building an app which looks something like this.enter image description here

It has a action bar and Tabs as shown below.

Tab 1: Should display images with ViewPage and indicator.

Tab 2: Should display maps.

I am new to android, but still somehow managed to build an app using internet resources and with the help of samples source. But i got stuck near mapview (when click on Tab2). I used TabHost, but this dint work, later on came to know that google has released new API supporting Map fragments. I even used Google API for MapFragment(the new one) but what i ended up with was some junk code. I messed up everything. I wanted to start again from scratch. Can any one brief about how implementing it.?

MapFragment.java

public class MapsFragment extends Fragment {  

    MapView map;
    LayoutInflater inflater_;
    ViewGroup container_;
    View layout;

    @Override 
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) 
    {  
        inflater_=inflater;
        container_=container;

        super.onCreate(savedInstanceState);

        layout = inflater.inflate(R.layout.fragment_maps, container, false);


        map = (MapView) layout.findViewById(R.id.mapView);



        return (LinearLayout) layout;  
    }  

PlaceACtivity.java

public class PlaceActivity extends SherlockFragmentActivity implements
        OnShareTargetSelectedListener {

    FragmentManager fm = getSupportFragmentManager();
    DetailsFragment fragment_det = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        ActionBar actionBar = getSupportActionBar();
        actionBar.setHomeButtonEnabled(true);
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

        ActionBar.Tab tabMaps = actionBar.newTab();
        ActionBar.Tab tabDetails = actionBar.newTab();

        tabDetails.setText("Details");
        tabMaps.setText("Maps");

        tabDetails.setTabListener(new MyTabListener());
        tabMaps.setTabListener(new MyTabListener());

        actionBar.addTab(tabDetails);
        actionBar.addTab(tabMaps);
    }

    private class MyTabListener implements ActionBar.TabListener {
        @Override
        public void onTabSelected(Tab tab,
                android.support.v4.app.FragmentTransaction ft) {

            if (tab.getPosition() == 0) {

                if (fragment_det == null) {
                    System.out.println("again");
                    fragment_det = new DetailsFragment();

                }

                ft.replace(android.R.id.content, fragment_det);

            } else {

                MapAsyc m = new MapAsyc();

                ft.replace(android.R.id.content, m);

            }
        }

        @Override
        public void onTabUnselected(Tab tab,
                android.support.v4.app.FragmentTransaction ft) {

        }

        @Override
        public void onTabReselected(Tab tab,
                android.support.v4.app.FragmentTransaction ft) {

        }

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        super.onCreateOptionsMenu(menu);
        MenuInflater inflater = getSupportMenuInflater();
        inflater.inflate(R.menu.activity_place, menu);

        MenuItem actionItem = menu.findItem(R.id.action_share);
        ShareActionProvider actionProvider = (ShareActionProvider) actionItem
                .getActionProvider();
        actionProvider.setShareHistoryFileName(null);
        actionProvider.setOnShareTargetSelectedListener(this);
        actionProvider.setShareIntent(createShareIntent());
        return true;
    }

    public boolean onShareTargetSelected(ShareActionProvider source,
            Intent intent) {
        // TODO Auto-generated method stub
        this.startActivity(createShareIntent());

        return true;
    }

    private Intent createShareIntent() {
        String shareText = "Here is the share content body";
        Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
        sharingIntent.setType("text/plain");

        sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareText);

        return sharingIntent;
    }

    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
        case android.R.id.home:
            finish();
        case R.id.action_share:
            Toast.makeText(this, "Share Via", Toast.LENGTH_LONG).show();
            break;
        default:
            break;
        }
        return true;
    }
}



DetailsFragment.java



 public class DetailsFragment extends SherlockFragment 
    {

        ImageFragmentAdapter mAdapter;
        ViewPager mPager;
        PageIndicator mIndicator;

        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                Bundle savedInstanceState) 
        {
            //container.removeAllViews();
            // TODO Auto-generated method stub
            View view = inflater.inflate(R.layout.fragment_details, container,
                    false);

            mAdapter = new ImageFragmentAdapter(getActivity().getSupportFragmentManager());

            mPager = (ViewPager) view.findViewById(R.id.pager);
            mPager.setAdapter(mAdapter);

            mIndicator = (CirclePageIndicator) view.findViewById(R.id.indicator);
            mIndicator.setViewPager(mPager);

            return view;
        }

    }

My Tab 1 is working fine. When i click on Tab 2, map will load. But wen i click on tab1 again , i get the following error:::.

12-06 02:30:13.891: E/AndroidRuntime(16904): java.lang.IllegalStateException: Recursive entry to executePendingTransactions.

Some posts suggested to use ASYNC task. But i cant use it because i should return the view from the MapFragment to the listener to take action.

Complete error log

12-06 22:54:58.609: E/AndroidRuntime(28745): FATAL EXCEPTION: main
12-06 22:54:58.609: E/AndroidRuntime(28745): java.lang.IllegalStateException: Recursive entry to executePendingTransactions
12-06 22:54:58.609: E/AndroidRuntime(28745):    at android.support.v4.app.FragmentManagerImpl.execPendingActions(Unknown Source)
12-06 22:54:58.609: E/AndroidRuntime(28745):    at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(Unknown Source)
12-06 22:54:58.609: E/AndroidRuntime(28745):    at android.support.v4.app.FragmentPagerAdapter.finishUpdate(Unknown Source)
12-06 22:54:58.609: E/AndroidRuntime(28745):    at android.support.v4.view.ViewPager.populate(Unknown Source)
12-06 22:54:58.609: E/AndroidRuntime(28745):    at android.support.v4.view.ViewPager.setCurrentItemInternal(Unknown Source)
12-06 22:54:58.609: E/AndroidRuntime(28745):    at android.support.v4.view.ViewPager.setCurrentItemInternal(Unknown Source)
12-06 22:54:58.609: E/AndroidRuntime(28745):    at android.support.v4.view.ViewPager.onRestoreInstanceState(Unknown Source)
12-06 22:54:58.609: E/AndroidRuntime(28745):    at android.view.View.dispatchRestoreInstanceState(View.java:12088)
12-06 22:54:58.609: E/AndroidRuntime(28745):    at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2582)
12-06 22:54:58.609: E/AndroidRuntime(28745):    at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2588)
12-06 22:54:58.609: E/AndroidRuntime(28745):    at android.view.View.restoreHierarchyState(View.java:12066)
12-06 22:54:58.609: E/AndroidRuntime(28745):    at android.support.v4.app.Fragment.restoreViewState(Unknown Source)
12-06 22:54:58.609: E/AndroidRuntime(28745):    at android.support.v4.app.FragmentManagerImpl.moveToState(Unknown Source)
12-06 22:54:58.609: E/AndroidRuntime(28745):    at android.support.v4.app.FragmentManagerImpl.moveToState(Unknown Source)
12-06 22:54:58.609: E/AndroidRuntime(28745):    at android.support.v4.app.BackStackRecord.run(Unknown Source)
12-06 22:54:58.609: E/AndroidRuntime(28745):    at android.support.v4.app.FragmentManagerImpl.execPendingActions(Unknown Source)
12-06 22:54:58.609: E/AndroidRuntime(28745):    at android.support.v4.app.FragmentManagerImpl$1.run(Unknown Source)
12-06 22:54:58.609: E/AndroidRuntime(28745):    at android.os.Handler.handleCallback(Handler.java:725)
12-06 22:54:58.609: E/AndroidRuntime(28745):    at android.os.Handler.dispatchMessage(Handler.java:92)
12-06 22:54:58.609: E/AndroidRuntime(28745):    at android.os.Looper.loop(Looper.java:137)
12-06 22:54:58.609: E/AndroidRuntime(28745):    at android.app.ActivityThread.main(ActivityThread.java:5039)
12-06 22:54:58.609: E/AndroidRuntime(28745):    at java.lang.reflect.Method.invokeNative(Native Method)
12-06 22:54:58.609: E/AndroidRuntime(28745):    at java.lang.reflect.Method.invoke(Method.java:511)
12-06 22:54:58.609: E/AndroidRuntime(28745):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
12-06 22:54:58.609: E/AndroidRuntime(28745):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
12-06 22:54:58.609: E/AndroidRuntime(28745):    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-15T13:17:13+00:00Added an answer on June 15, 2026 at 1:17 pm

    use http://viewpagerindicator.com/ for your tabview and set

    mPager.setOffscreenPageLimit(mAdapter.getCount());

    P.S Are you using actionbarsherlok?

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

Sidebar

Related Questions

I am building an app which contains a list of addresses. This app is
I'm building a Swing app in which I'd like to put a fat header
I'm building my node.js app which has the following structure: server.js controllers/user.js server.js require
I'm building a small self-hosted app which requires database usage. I'd like to validate
I've got an ant file which looks like this: <?xml version=1.0 encoding=UTF-8?> <project name=p
Im building an app which uses Sqlite DB. Users can enter their information into
I am building an app which requires saving a form whenever user enter the
I am building an app for which I need to set up cron jobs.
I'm building a Rails app which creates a bookmarklet file for each user upon
I'm building an AJAX app which animates in content dynamically. Since all links are

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.