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

  • Home
  • SEARCH
  • 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 8685677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:38:13+00:00 2026-06-12T22:38:13+00:00

I have two panes(left side list and right side details) in my android tablet

  • 0

I have two panes(left side list and right side details) in my android tablet application(just like Settings native tablet app view). I have extended MapActivity to my MainActivity. and I have a list of location details left side. I wanted to display the MapView for each list item in my right pane which is a fragment.

The problem is when I try to open Map View, for the first item it is opening mapView. From second item onwards it is showing you can only open one MapView for one MapActivity. Please suggest a right answer. I have tried all the related posts but of no success.

My code version : android 4.0

Please check the below code :

    MainActivity extends MapActivity {
    onCreate(){
                    LocationFragment loc_fragment=new LocationFragment();
                    FragmentTransaction xaction=VenueFragment.venueFrgMgr.beginTransaction();
                    Bundle sendData=new Bundle();
                    sendData.putString("LAT", s.getLat());
                    sendData.putString("LON", s.getLong());
                    sendData.putString("NAME", s.getName());
                    sendData.putString("ADD", s.getAddress());
                    loc_fragment.setArguments(sendData);
                    xaction.add(R.id.second_pane, loc_fragment,"location");
                    xaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_CLOSE);

                    xaction.addToBackStack(null);
                    xaction.commit();

   }
 @Override
protected boolean isRouteDisplayed() {

    return false;
}

}

code for LocationFragment which shows MapView is below :

    private ViewGroup mapContainer;
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                Bundle savedInstanceState) {
            super.onCreateView(inflater, container, savedInstanceState);
            //view.refreshDrawableState();

            view = inflater.inflate(R.layout.location, container, false);
            mapContainer=new LinearLayout(getActivity());
            mapContainer.addView(view);
            v = view.findViewById(R.id.loading);
            v.setVisibility(View.VISIBLE);

    /*      lonstr=LocationActivity.lonstr;
            latstr=LocationActivity.latstr;
            name=LocationActivity.name;
            address=LocationActivity.address;
    */      
            ((Button) view.findViewById(R.id.back))
                    .setOnClickListener(new OnClickListener() {

                        @Override
                        public void onClick(View v) {
                            //getActivity().finish();
                            if(mapView != null) {
                                mapView.removeAllViewsInLayout();

                                if(mapContainer!=null)
                                    mapContainer.removeView(mapView);

                                RelativeLayout parentView = (RelativeLayout) mapView.getParent();
                                //mapView.removeAllViews();
                                ((MapView)view.findViewById(R.id.mapview)).removeAllViews();
                                parentView.removeAllViews();
                                if(parentView!=null)
                                    parentView.recomputeViewAttributes(mapView);
                                getFragmentManager().findFragmentByTag("location").getView().destroyDrawingCache();
                            }

                            getFragmentManager().popBackStack();
                        //  getFragmentManager().popBackStackImmediate();
                        }
                    });
            mapView = (MapView) view.findViewById(R.id.mapview);

            mapView.setBuiltInZoomControls(true);
            mc = mapView.getController();


            Bundle b = this.getArguments();
            if (b != null) {
                latstr = b.getString("LAT");
                lonstr = b.getString("LON");
                name = b.getString("NAME");
                address = b.getString("ADD");
            }

            String coordinates[] = { latstr, lonstr };
            try {
                lat = Double.parseDouble(coordinates[0]);
                lng = Double.parseDouble(coordinates[1]);
            } catch (Exception e) {
                // TODO: handle exception
            }
            p = new GeoPoint((int) (lat * 1E6), (int) (lng * 1E6));
            mc.animateTo(p);
            Drawable icon = getResources().getDrawable(R.drawable.red_pin);
            icon.setBounds(0, 0, icon.getIntrinsicWidth(),
                    icon.getIntrinsicHeight());
            MyItemizedOverlay overlay = new MyItemizedOverlay(icon);
            OverlayItem item = new OverlayItem(p, "", null);
            overlay.addItem(item);
            overlay.populateNow();
            mapView.getOverlays().add(overlay);
            mapView.postInvalidate();
            mc.setZoom(12);
            if (name != null)
                ((TextView) view.findViewById(R.id.event_name)).setText(name);
            if (address != null)
                ((TextView) view.findViewById(R.id.event_date)).setText(address);
            getWheather();

            return mapContainer;
        }

Error I am getting is below :

10-15 10:43:03.881: E/AndroidRuntime(3778): android.view.InflateException: Binary XML file line #184: Error inflating class <unknown>
10-15 10:43:03.881: E/AndroidRuntime(3778):     at android.view.LayoutInflater.createView(LayoutInflater.java:606)
10-15 10:43:03.881: E/AndroidRuntime(3778):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
10-15 10:43:03.881: E/AndroidRuntime(3778):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
10-15 10:43:03.881: E/AndroidRuntime(3778):     at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
10-15 10:43:03.881: E/AndroidRuntime(3778):     at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
10-15 10:43:03.881: E/AndroidRuntime(3778):     at webspiders.event2mobile.asme.LocationFragment.onCreateView(LocationFragment.java:128)
10-15 10:43:03.881: E/AndroidRuntime(3778):     at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:828)
10-15 10:43:03.881: E/AndroidRuntime(3778):     at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1032)
10-15 10:43:03.881: E/AndroidRuntime(3778):     at android.app.BackStackRecord.run(BackStackRecord.java:622)
10-15 10:43:03.881: E/AndroidRuntime(3778):     at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1382)
10-15 10:43:03.881: E/AndroidRuntime(3778):     at android.app.FragmentManagerImpl$1.run(FragmentManager.java:426)
10-15 10:43:03.881: E/AndroidRuntime(3778):     at android.os.Handler.handleCallback(Handler.java:605)
10-15 10:43:03.881: E/AndroidRuntime(3778):     at android.os.Handler.dispatchMessage(Handler.java:92)
10-15 10:43:03.881: E/AndroidRuntime(3778):     at android.os.Looper.loop(Looper.java:137)
10-15 10:43:03.881: E/AndroidRuntime(3778):     at android.app.ActivityThread.main(ActivityThread.java:4507)
10-15 10:43:03.881: E/AndroidRuntime(3778):     at java.lang.reflect.Method.invokeNative(Native Method)
10-15 10:43:03.881: E/AndroidRuntime(3778):     at java.lang.reflect.Method.invoke(Method.java:511)
10-15 10:43:03.881: E/AndroidRuntime(3778):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:978)
10-15 10:43:03.881: E/AndroidRuntime(3778):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745)
10-15 10:43:03.881: E/AndroidRuntime(3778):     at dalvik.system.NativeStart.main(Native Method)
10-15 10:43:03.881: E/AndroidRuntime(3778): Caused by: java.lang.reflect.InvocationTargetException
10-15 10:43:03.881: E/AndroidRuntime(3778):     at java.lang.reflect.Constructor.constructNative(Native Method)
10-15 10:43:03.881: E/AndroidRuntime(3778):     at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
10-15 10:43:03.881: E/AndroidRuntime(3778):     at android.view.LayoutInflater.createView(LayoutInflater.java:586)
10-15 10:43:03.881: E/AndroidRuntime(3778):     ... 19 more
10-15 10:43:03.881: E/AndroidRuntime(3778): Caused by: java.lang.IllegalStateException: You are only allowed to have a single MapView in a MapActivity
10-15 10:43:03.881: E/AndroidRuntime(3778):     at com.google.android.maps.MapActivity.setupMapView(MapActivity.java:397)
10-15 10:43:03.881: E/AndroidRuntime(3778):     at com.google.android.maps.MapView.<init>(MapView.java:289)
10-15 10:43:03.881: E/AndroidRuntime(3778):     at com.google.android.maps.MapView.<init>(MapView.java:264)
10-15 10:43:03.881: E/AndroidRuntime(3778):     at com.google.android.maps.MapView.<init>(MapView.java:247)
  • 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-12T22:38:14+00:00Added an answer on June 12, 2026 at 10:38 pm

    I guess you have in your MainActivity one listview, and one container which holds your mapview.

    And when item is selected in listivew, you would like to do something on your map.

    If so, then you need only one fragment which holds your map, and then each time when a new item is selected from your list, you need to inform your fragment that a new data is available, and it should refresh itself.

    You can do it via custom interface, if you know how to create one.

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

Sidebar

Related Questions

i have a master page with three sections, left pane + 2 right panes
My main form has two panels, left docked and right docked. The right side
I have a setup with two side panels, one as float:left and one as
I have a page which has two distinct parts : a left side of
I'm trying to get two divs side by side. The left one will have
i have two panel. when i'm click on the left panel items its calling
I currently have two panels within another large panel. The left panel is for
Is it possible to have two controls on one page side-by-side in Silverlight? It
I am developing a web based application in which i have two hyperlinks in
I'm using Microsoft's SplitContainer control in my WinForms desktop application. I'd like to have

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.