MapActivity launching from OnClickListener

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

MapActivity launching from OnClickListener

Postby jdruid » Wed May 05, 2010 8:37 pm

First timer..

Just started working with android and ran into a small problem. I am have a TabActivity that is loading 3 other Activity classes. This works great. I then have a button on the other Activity classes that I would like to launch a MapActivity. When I do that I keep getting a Force Close.

I googled but I cannot figure out if it is the manifest file or something else. The idea is the tabs are showing location information and you click a button to plot it on the map and get directions.

My activity class
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.  public void onCreate(Bundle savedInstanceState) {
  3.  
  4.         super.onCreate(savedInstanceState);
  5.  
  6.         setContentView(R.layout.location_tab);
  7.  
  8. ...
  9.  
  10.         Button btnMap = (Button) findViewById(R.id.btnLaunchMap);
  11.  
  12.         btnMap.setOnClickListener(mMapListener);
  13.  
  14. }
  15.  
  16.  
  17.  
  18.  private OnClickListener mMapListener = new OnClickListener() {
  19.  
  20.         public void onClick(View v) {
  21.  
  22.                 Intent mapIntent = new Intent(getApplicationContext(),LocationMap.class);
  23.  
  24.                 startActivity(mapIntent);        
  25.  
  26.         }
  27.  
  28.     };
  29.  
  30.  
  31.  
  32.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


If I launch any other activity it works but not launching the mapactivity. If I take the mapactivity class and put it in a new project it works.

My manifest
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.  
  2. <uses-permission android:name="android.permission.INTERNET" />
  3.  
  4.    
  5.  
  6.     <application android:icon="@drawable/icon"  android:label="@string/app_name">
  7.  
  8.         <activity android:name=".Splash"
  9.  
  10.                  android:label="@string/app_name"
  11.  
  12.                  android:theme="@android:style/Theme.NoTitleBar">
  13.  
  14.                         <intent-filter>
  15.  
  16.                 <action android:name="android.intent.action.MAIN" />
  17.  
  18.                 <category android:name="android.intent.category.LAUNCHER" />                
  19.  
  20.             </intent-filter>
  21.  
  22.         </activity>
  23.  
  24.        
  25.  
  26.         <activity android:name=".Locations"
  27.  
  28.                  android:label="@string/app_name"
  29.  
  30.                  android:theme="@android:style/Theme.NoTitleBar"></activity>
  31.  
  32.        
  33.  
  34.         <activity android:name=".LocationNewYork"
  35.  
  36.                  android:label="@string/app_name"
  37.  
  38.                  android:theme="@android:style/Theme.NoTitleBar">
  39.  
  40.                   </activity>
  41.  
  42.                
  43.  
  44.                  <activity android:name=".LocationChicago"
  45.  
  46.                  android:label="@string/app_name"
  47.  
  48.                  android:theme="@android:style/Theme.NoTitleBar"></activity>
  49.  
  50.        
  51.  
  52.         <activity android:name=".LocationSeattle"
  53.  
  54.                  android:label="@string/app_name"
  55.  
  56.                  android:theme="@android:style/Theme.NoTitleBar"></activity>
  57.  
  58.  
  59.  
  60.         <activity android:name=".LocationMap"
  61.  
  62.                  android:label="@string/app_name"
  63.  
  64.                  android:theme="@android:style/Theme.NoTitleBar">
  65.  
  66.                  
  67.  
  68.                  
  69.  
  70.                 </activity>
  71.  
  72.                  
  73.  
  74.         <uses-library android:name="com.google.android.maps"/>
  75.  
  76.     </application>
  77.  
  78.  
  79.  
  80.  
Parsed in 0.005 seconds, using GeSHi 1.0.8.4


thanks in advance
jdruid
Once Poster
Once Poster
 
Posts: 1
Joined: Wed May 05, 2010 8:28 pm

Top

Postby JKumar » Thu May 13, 2010 10:47 am

HI,

Can you post the ForceClose error from the DDMS to make the reason clear ?
Hope the suggestion helps you
Keep posting .It makes us better to understand Android
User avatar
JKumar
Experienced Developer
Experienced Developer
 
Posts: 52
Joined: Thu May 13, 2010 8:17 am
Location: INDIA

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 6 guests