I have an application which is working properly in emulator with platform 1.6.But when I run the same on another avd with platform 3.0. It is showing following exception.
12-19 10:24:26.372: E/AndroidRuntime(522): FATAL EXCEPTION: main
12-19 10:24:26.372: E/AndroidRuntime(522): java.lang.NullPointerException
12-19 10:24:26.372: E/AndroidRuntime(522): at com.example.app.DirectionsRouteFinder.doProcess(DirectionsRouteFinder.java:189)
12-19 10:24:26.372: E/AndroidRuntime(522): at com.example.util.UrlRun.onPostExecute(UrlRun.java:49)
12-19 10:24:26.372: E/AndroidRuntime(522): at com.example.util.UrlRun.onPostExecute(UrlRun.java:1)
12-19 10:24:26.372: E/AndroidRuntime(522): at android.os.AsyncTask.finish(AsyncTask.java:590)
12-19 10:24:26.372: E/AndroidRuntime(522): at android.os.AsyncTask.access$600(AsyncTask.java:149)
12-19 10:24:26.372: E/AndroidRuntime(522): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:603)
12-19 10:24:26.372: E/AndroidRuntime(522): at android.os.Handler.dispatchMessage(Handler.java:99)
12-19 10:24:26.372: E/AndroidRuntime(522): at android.os.Looper.loop(Looper.java:126)
12-19 10:24:26.372: E/AndroidRuntime(522): at android.app.ActivityThread.main(ActivityThread.java:3997)
12-19 10:24:26.372: E/AndroidRuntime(522): at java.lang.reflect.Method.invokeNative(Native Method)
12-19 10:24:26.372: E/AndroidRuntime(522): at java.lang.reflect.Method.invoke(Method.java:491)
12-19 10:24:26.372: E/AndroidRuntime(522): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
12-19 10:24:26.372: E/AndroidRuntime(522): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
12-19 10:24:26.372: E/AndroidRuntime(522): at dalvik.system.NativeStart.main(Native Method)
This the line of code(Bold) that showing nullPointer Exception .I know that UI should not be changed in doInBackground process of AsyncTask.I am doing those changes in onPostExecute of AsyncTask.And my 3.0 Emulator is very slow.Is this can be a problem??
for (RouteVehicle item : Constants.getRouteFinder()) {
String alert=item.getAlert();
if(!alert.equals("null")){
if(alert.equals("max_speed")){
maxspeed++;
overspeedText.setTextColor(Color.RED);
overlayitem.setMarker(orange);
}
else if(alert.equals("stoppage")){
stopage++;
**stoppageText.setTextColor(Color.RED)**;
overlayitem.setMarker(red);
}
else if(alert.equals("geofence")){
geofence++;
geoText.setTextColor(Color.RED);
overlayitem.setMarker(red);
}
else if(alert.equals("tank_empty")){
tankEmpty++;
tankText.setTextColor(Color.RED);
overlayitem.setMarker(red);
}
else{
sos++;
sosText.setTextColor(Color.RED);
overlayitem.setMarker(red);
}}
}
Please help me!!
check your layout files. you probably referenced an element (see tankText, overlayItem, etc.) that was not in your xhdpi layout.