Note that there are some explanatory texts on larger screens.

plurals
  1. POMap View in a Tab Android
    primarykey
    data
    text
    <p>I have been working on this Tab View and I finally got it working and all my icons in just right. I went to place a Map View in one of the Tabs just like I would with any other class. For some reason it is not work when I launch the app, it force closes right away. This is the error from LogCat: </p> <pre><code>11-24 02:06:36.345: E/dalvikvm(1978): Could not find class 'com.nyneaxis.api.gascloud.StationsMap', referenced from method com.nyneaxis.api.gascloud.GasCloudMain.onCreate 11-24 02:06:36.493: E/AndroidRuntime(1978): Uncaught handler: thread main exiting due to uncaught exception 11-24 02:06:36.514: E/AndroidRuntime(1978): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.nyneaxis.api.gascloud/com.nyneaxis.api.gascloud.GasCloudMain}: android.view.InflateException: Binary XML file line #24: Error inflating class com.google.android.maps.MapView 11-24 02:06:36.514: E/AndroidRuntime(1978): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496) 11-24 02:06:36.514: E/AndroidRuntime(1978): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512) 11-24 02:06:36.514: E/AndroidRuntime(1978): at android.app.ActivityThread.access$2200(ActivityThread.java:119) 11-24 02:06:36.514: E/AndroidRuntime(1978): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863) 11-24 02:06:36.514: E/AndroidRuntime(1978): at android.os.Handler.dispatchMessage(Handler.java:99) 11-24 02:06:36.514: E/AndroidRuntime(1978): at android.os.Looper.loop(Looper.java:123) 11-24 02:06:36.514: E/AndroidRuntime(1978): at android.app.ActivityThread.main(ActivityThread.java:4363) 11-24 02:06:36.514: E/AndroidRuntime(1978): at java.lang.reflect.Method.invokeNative(Native Method) 11-24 02:06:36.514: E/AndroidRuntime(1978): at java.lang.reflect.Method.invoke(Method.java:521) 11-24 02:06:36.514: E/AndroidRuntime(1978): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) 11-24 02:06:36.514: E/AndroidRuntime(1978): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 11-24 02:06:36.514: E/AndroidRuntime(1978): at dalvik.system.NativeStart.main(Native Method) 11-24 02:06:36.514: E/AndroidRuntime(1978): Caused by: android.view.InflateException: Binary XML file line #24: Error inflating class com.google.android.maps.MapView 11-24 02:06:36.514: E/AndroidRuntime(1978): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:576) 11-24 02:06:36.514: E/AndroidRuntime(1978): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618) 11-24 02:06:36.514: E/AndroidRuntime(1978): at android.view.LayoutInflater.rInflate(LayoutInflater.java:621) 11-24 02:06:36.514: E/AndroidRuntime(1978): at android.view.LayoutInflater.inflate(LayoutInflater.java:407) 11-24 02:06:36.514: E/AndroidRuntime(1978): at android.view.LayoutInflater.inflate(LayoutInflater.java:320) 11-24 02:06:36.514: E/AndroidRuntime(1978): at android.view.LayoutInflater.inflate(LayoutInflater.java:276) 11-24 02:06:36.514: E/AndroidRuntime(1978): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198) 11-24 02:06:36.514: E/AndroidRuntime(1978): at android.app.Activity.setContentView(Activity.java:1622) 11-24 02:06:36.514: E/AndroidRuntime(1978): at com.nyneaxis.api.gascloud.GasCloudMain.onCreate(GasCloudMain.java:13) 11-24 02:06:36.514: E/AndroidRuntime(1978): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 11-24 02:06:36.514: E/AndroidRuntime(1978): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459) 11-24 02:06:36.514: E/AndroidRuntime(1978): ... 11 more 11-24 02:06:36.514: E/AndroidRuntime(1978): Caused by: java.lang.ClassNotFoundException: com.google.android.maps.MapView in loader dalvik.system.PathClassLoader@44e83990 11-24 02:06:36.514: E/AndroidRuntime(1978): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243) 11-24 02:06:36.514: E/AndroidRuntime(1978): at java.lang.ClassLoader.loadClass(ClassLoader.java:573) 11-24 02:06:36.514: E/AndroidRuntime(1978): at java.lang.ClassLoader.loadClass(ClassLoader.java:532) 11-24 02:06:36.514: E/AndroidRuntime(1978): at android.view.LayoutInflater.createView(LayoutInflater.java:466) 11-24 02:06:36.514: E/AndroidRuntime(1978): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565) </code></pre> <p>This is my Main class:</p> <pre><code> package com.nyneaxis.api.gascloud; import android.app.TabActivity; import android.content.Intent; import android.content.res.Resources; import android.os.Bundle; import android.widget.TabHost; public class GasCloudMain extends TabActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Resources res = getResources(); TabHost tabHost = getTabHost(); TabHost.TabSpec spec; Intent intent; intent = new Intent().setClass(this, Profile.class); spec = tabHost .newTabSpec("profile") .setIndicator("Profile", res.getDrawable(R.drawable.ic_tab_profile)) .setContent(intent); tabHost.addTab(spec); intent = new Intent().setClass(this, StationsList.class); spec = tabHost .newTabSpec("stations") .setIndicator("Stations", res.getDrawable(R.drawable.ic_tab_station)) .setContent(intent); tabHost.addTab(spec); intent = new Intent().setClass(this, SearchStations.class); spec = tabHost .newTabSpec("search") .setIndicator("Search", res.getDrawable(R.drawable.ic_tab_search)) .setContent(intent); tabHost.addTab(spec); intent = new Intent().setClass(this, StationsMap.class); spec = tabHost .newTabSpec("map") .setIndicator("Map", res.getDrawable(R.drawable.ic_tab_maps)) .setContent(new Intent(this, StationsMap.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)); tabHost.addTab(spec); tabHost.setCurrentTab(0); } } </code></pre> <p>main.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;TabHost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:padding="5dp" &gt; &lt;TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="wrap_content" /&gt; &lt;FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="1dp" /&gt; &lt;/LinearLayout&gt; &lt;/TabHost&gt; </code></pre> <p>maps class</p> <pre><code>package com.nyneaxis.api.gascloud; import com.google.android.maps.MapActivity; import com.google.android.maps.MapView; import android.os.Bundle; import android.widget.LinearLayout; public class StationsMap extends MapActivity { LinearLayout linearLayout; MapView mapView; public void onCreate(Bundle savedInstanceState){ mapView = (MapView) findViewById(R.id.mapview); mapView.setBuiltInZoomControls(true); } @Override protected boolean isRouteDisplayed() { // TODO Auto-generated method stub return false; } } </code></pre> <p>maps.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mainlayout" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;com.google.android.maps.MapView android:id="@+id/mapview" android:layout_width="fill_parent" android:layout_height="fill_parent" android:clickable="true" android:apiKey="ABQIAAAAYc7mzgA4G-2FaBLUHTM_1xTjBItGPNb7O-Zq4IGUb6RxSdEi4RQ7Y-p4UARzkmuBTxknyrJRWOA31w" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p>Please help, I am lost to what I need to do. I can run the maps class withtout the tabs and it works. Thank you in advance. PS I have triends a few things by Googling but nothing close to what I want to accomplish.</p>
    singulars
    1. This table or related slice is empty.
    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