android - unable to start activity? need assistance -


i keep getting error when starting app. code started google api v1, ive been trying convert v2. closes app when run it. based off tutorial online im learning from. suggestions?

package -;  import java.util.list; import android.content.intent; import android.graphics.drawable.drawable; import android.os.bundle; import android.support.v4.app.fragmentactivity; import android.view.window;  import -.additemizedoverlay; import -.place; import -.placeslist; import -.r; import com.google.android.gms.maps.mapfragment; import com.google.android.gms.maps.supportmapfragment; import com.google.android.maps.geopoint; import com.google.android.maps.mapcontroller; import com.google.android.maps.overlay; import com.google.android.maps.overlayitem;  public class placesmapactivity extends fragmentactivity {     // nearest places     placeslist nearplaces;      // map view     mapfragment mapview;      // map overlay items     list<overlay> mapoverlays;      additemizedoverlay itemizedoverlay;      geopoint geopoint;     // map controllers     mapcontroller mc;      double latitude;     double longitude;     overlayitem overlayitem;      @override     public void oncreate(bundle savedinstancestate) {         requestwindowfeature(window.feature_custom_title);          super.oncreate(savedinstancestate);         setcontentview(r.layout.map_places);         getwindow().setfeatureint(window.feature_custom_title, r.layout.window_title);         intent = getintent();          // users current geo location         string user_latitude = i.getstringextra("user_latitude");         string user_longitude = i.getstringextra("user_longitude");          // nearplaces list         nearplaces = (placeslist) i.getserializableextra("near_places");          supportmapfragment fragment = ( supportmapfragment) getsupportfragmentmanager().findfragmentbyid(r.id.map);          // geopoint place on map         geopoint = new geopoint((int) (double.parsedouble(user_latitude) * 1e6),                 (int) (double.parsedouble(user_longitude) * 1e6));          // drawable marker icon         drawable drawable_user = this.getresources()                 .getdrawable(r.drawable.mark_red);          itemizedoverlay = new additemizedoverlay(drawable_user, this);          // map overlay item         overlayitem = new overlayitem(geopoint, "your location",                 "that you!");          itemizedoverlay.addoverlay(overlayitem);          mapoverlays.add(itemizedoverlay);         itemizedoverlay.populatenow();          // drawable marker icon         drawable drawable = this.getresources()                 .getdrawable(r.drawable.mark_blue);          itemizedoverlay = new additemizedoverlay(drawable, this);          // these values used map boundary area         // area can see markers on screen         int minlat = integer.max_value;         int minlong = integer.max_value;         int maxlat = integer.min_value;         int maxlong = integer.min_value;          // check null in case null         if (nearplaces.results != null) {             // loop through places             (place place : nearplaces.results) {                 latitude = place.geometry.location.lat; // latitude                 longitude = place.geometry.location.lng; // longitude                  // geopoint place on map                 geopoint = new geopoint((int) (latitude * 1e6),                         (int) (longitude * 1e6));                  // map overlay item                 overlayitem = new overlayitem(geopoint, place.name,                         place.vicinity);                  itemizedoverlay.addoverlay(overlayitem);                   // calculating map boundary area                 minlat  = (int) math.min( geopoint.getlatitudee6(), minlat );                 minlong = (int) math.min( geopoint.getlongitudee6(), minlong);                 maxlat  = (int) math.max( geopoint.getlatitudee6(), maxlat );                 maxlong = (int) math.max( geopoint.getlongitudee6(), maxlong );             }             mapoverlays.add(itemizedoverlay);              // showing overlay items             itemizedoverlay.populatenow();         }       }  } 

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="fill_parent"     android:layout_height="fill_parent"     android:orientation="vertical"     >  <fragment         android:id="@+id/map"         android:layout_width="fill_parent"         android:layout_height="fill_parent"         android:name="com.google.android.gms.maps.supportmapfragment" /> </linearlayout> 

05-15 01:04:49.513: w/dalvikvm(12551): threadid=1: thread exiting uncaught exception (group=0x40aac228) 05-15 01:04:49.513: e/androidruntime(12551): fatal exception: main 05-15 01:04:49.513: e/androidruntime(12551): java.lang.runtimeexception: unable start activity componentinfo{-/-.placesmapactivity}: java.lang.nullpointerexception 05-15 01:04:49.513: e/androidruntime(12551):    @ android.app.activitythread.performlaunchactivity(activitythread.java:2194) 05-15 01:04:49.513: e/androidruntime(12551):    @ android.app.activitythread.handlelaunchactivity(activitythread.java:2229) 05-15 01:04:49.513: e/androidruntime(12551):    @ android.app.activitythread.access$600(activitythread.java:139) 05-15 01:04:49.513: e/androidruntime(12551):    @ android.app.activitythread$h.handlemessage(activitythread.java:1261) 05-15 01:04:49.513: e/androidruntime(12551):    @ android.os.handler.dispatchmessage(handler.java:99) 05-15 01:04:49.513: e/androidruntime(12551):    @ android.os.looper.loop(looper.java:154) 05-15 01:04:49.513: e/androidruntime(12551):    @ android.app.activitythread.main(activitythread.java:4944) 05-15 01:04:49.513: e/androidruntime(12551):    @ java.lang.reflect.method.invokenative(native method) 05-15 01:04:49.513: e/androidruntime(12551):    @ java.lang.reflect.method.invoke(method.java:511) 05-15 01:04:49.513: e/androidruntime(12551):    @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:784) 05-15 01:04:49.513: e/androidruntime(12551):    @ com.android.internal.os.zygoteinit.main(zygoteinit.java:551) 05-15 01:04:49.513: e/androidruntime(12551):    @ dalvik.system.nativestart.main(native method) 05-15 01:04:49.513: e/androidruntime(12551): caused by: java.lang.nullpointerexception 05-15 01:04:49.513: e/androidruntime(12551):    @ -.placesmapactivity.oncreate(placesmapactivity.java:74) 05-15 01:04:49.513: e/androidruntime(12551):    @ android.app.activity.performcreate(activity.java:4531) 05-15 01:04:49.513: e/androidruntime(12551):    @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1071) 05-15 01:04:49.513: e/androidruntime(12551):    @ android.app.activitythread.performlaunchactivity(activitythread.java:2150) 05-15 01:04:49.513: e/androidruntime(12551):    ... 11 more 05-15 01:04:51.115: d/process(12551): killprocess, pid=12551 

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"     package="-"     android:versioncode="1"     android:versionname="1.0"     android:largescreens="true"      android:normalscreens="true"      android:smallscreens="true"      android:resizeable="true"      android:anydensity="true"     android:theme="@android:style/theme.notitlebar" >      <uses-sdk         android:minsdkversion="15"         android:targetsdkversion="17" />        <permission         android:name="-.permission.maps_receive"         android:protectionlevel="signature" />      <uses-feature         android:glesversion="0x00020000"         android:required="true" />      <uses-permission android:name="-.permission.maps_receive" />     <uses-permission android:name="android.permission.internet" />     <uses-permission android:name="android.permission.write_external_storage" />     <uses-permission android:name="com.google.android.providers.gsf.permission.read_gservices" />     <uses-permission android:name="android.permission.access_coarse_location" />     <uses-permission android:name="android.permission.access_fine_location" />     <uses-permission android:name="android.permission.access_network_state" />     <uses-permission android:name="android.permission.call_phone" ></uses-permission>          <application              android:icon="@drawable/applogo12"              android:label="@string/app_name"              android:theme="@style/customtheme">             <uses-library android:name="com.google.android.maps" />            <activity             android:name="-.splashactivity"             android:screenorientation="portrait">             <intent-filter>                 <action android:name="android.intent.action.main" />                 <category android:name="android.intent.category.launcher" />             </intent-filter>         </activity>         <activity android:name=".homeactivity" android:screenorientation="portrait"></activity>          <activity android:name=".placesmapactivity" android:screenorientation="portrait"></activity>            <meta-data             android:name="com.google.android.maps.v2.api_key"             android:value="-" />     </application> </manifest>  

in java stack trace, hunt references code, determine things going wrong. in case, is:

05-15 01:04:49.513: e/androidruntime(12551): caused by: java.lang.nullpointerexception 05-15 01:04:49.513: e/androidruntime(12551):    @ -.placesmapactivity.oncreate(placesmapactivity.java:74) 

if assume line line 74:

mapoverlays.add(itemizedoverlay); 

then exception makes sense, never initialize mapoverlays.

beyond that, of code not work, attempting maps v1 work on maps v2 map. example, there no overlayitem instances maps v2, nor itemizedoverlay, norgeopoint`. might consider commmenting out code, until write maps v2 replacements it, rather merely crashing.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -