Note that there are some explanatory texts on larger screens.

plurals
  1. PO(Android) How to set default gps position in mapview
    primarykey
    data
    text
    <p>So i have an app that has to show the location of a number of shops, depending on which one you choose. The XML layout for the page with the mapView is part of a ViewFlipper, and the part that has the map layout is:</p> <pre><code>&lt;RelativeLayout android:id="@+id/RelativeLayout3" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/back2" android:gravity="left" &gt; &lt;ImageButton android:id="@+id/backLocation3" android:layout_width="72dp" android:layout_height="30dp" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginLeft="10dp" android:layout_marginTop="10dp" android:src="@drawable/btn_zuruck2" /&gt; &lt;ImageView android:id="@+id/imageViewMap" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/backLocation3" android:layout_marginTop="14dp" android:src="@drawable/businesslounge" /&gt; &lt;RelativeLayout android:id="@+id/mapPlaceHolderLayout" android:layout_width="300dp" android:layout_height="200dip" android:layout_alignLeft="@+id/backLocation3" android:layout_below="@+id/imageViewMap" android:layout_marginTop="92dp" &gt; &lt;/RelativeLayout&gt; &lt;TextView android:id="@+id/mapLocation" android:layout_width="240dp" android:layout_height="40dp" android:layout_alignLeft="@+id/mapPlaceHolderLayout" android:layout_below="@+id/imageViewMap" android:layout_marginTop="47dp" android:text="@string/maplocation" android:textSize="25dp" android:textColor="@color/purple" /&gt; &lt;ImageButton android:id="@+id/phonereserve" android:layout_width="220dp" android:layout_height="36dp" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:layout_marginBottom="24dp" android:src="@drawable/rezervephone" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p>The part of the code that relates to the mapview is:</p> <pre><code>public class StandorteFragment extends MapHostFragment { public String text2; private RelativeLayout mapPlaceHolderLayout; public AQuery aQuery; private MapView myMapView; private GeoPoint geoPoint; private MapController mc; @Override protected Class&lt;? extends Activity&gt; getActivityClass() { return LocationMapActivity.class; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) { View v = inflater.inflate(R.layout.location, container, false); ViewFlipperStandorte = (ViewFlipper) v.findViewById(R.id.viewFlipperLocation); geoPoint = new GeoPoint( (int) (48.949997* 1E6), (int) (22.140213 * 1E6)); mapPlaceHolderLayout = (RelativeLayout)v.findViewById(R.id.mapPlaceHolderLayout); mapPlaceHolderLayout.addView(onCreateMapView()); // myMapView = (MapView) v.findViewById(R.id.mapPlaceHolderLayout); // mc = myMapView.getController(); // mc.animateTo(geoPoint); // </code></pre> <p>It works but doesn't show nothing in the mapView. If i don't comment those 3 lines with myMapView and animate geoPoint, it force closes. What do I have to do? </p> <p>EDIT: onCreateMapView:</p> <pre><code>public View onCreateMapView() { Intent intent = new Intent(getActivity(), getActivityClass()); final Window w = getLocalActivityManager().startActivity(ACTIVITY_TAG, intent); final View wd = w != null ? w.getDecorView() : null; if (wd != null) { ViewParent parent = wd.getParent(); if (parent != null) { ViewGroup v = (ViewGroup) parent; v.removeView(wd); } wd.setVisibility(View.VISIBLE); wd.setFocusableInTouchMode(true); if (wd instanceof ViewGroup) { ((ViewGroup) wd) .setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS); } } return wd; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload