I am an Android developer and I am trying to send a Serializable object to another Activity using a Bundle. However, I get the following - Parcelable encountered ClassNotFoundException reading a Serializable object as an error.
What is the cause of this and how can I fix it?
Below is the code snippet:
Bundle previousData = new Bundle();
previousData.putSerializable("GetVehicleInfo_AllTrims", trimsObj);// trimObj is a serialized object
Intent detailsIntent = new Intent(androidScrolbleTabbar.TABBAR_PUSHVIEW);
detailsIntent.putExtras(previousData);
detailsIntent.putExtra("ActivityIdentifier", ManualScreenNav2.viewIdentifier);
detailsIntent.putExtra("className", ManualScreenNav2.class.getName());
sendBroadcast(detailsIntent);
Below is the full stack trace:
03-19 15:39:02.549: E/AndroidRuntime(27084): FATAL EXCEPTION: main
03-19 15:39:02.549: E/AndroidRuntime(27084): java.lang.RuntimeException: Error receiving broadcast Intent { act=com.mobyfactory.pushview (has extras) } in com.adplotmanagement.androidScrolbleTabbar$PUSHViewBroadcastReceiver#461bc340
03-19 15:39:02.549: E/AndroidRuntime(27084): at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:942)
03-19 15:39:02.549: E/AndroidRuntime(27084): at android.os.Handler.handleCallback(Handler.java:587)
03-19 15:39:02.549: E/AndroidRuntime(27084): at android.os.Handler.dispatchMessage(Handler.java:92)
03-19 15:39:02.549: E/AndroidRuntime(27084): at android.os.Looper.loop(Looper.java:143)
03-19 15:39:02.549: E/AndroidRuntime(27084): at android.app.ActivityThread.main(ActivityThread.java:4701)
03-19 15:39:02.549: E/AndroidRuntime(27084): at java.lang.reflect.Method.invokeNative(Native Method)
03-19 15:39:02.549: E/AndroidRuntime(27084): at java.lang.reflect.Method.invoke(Method.java:521)
03-19 15:39:02.549: E/AndroidRuntime(27084): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
03-19 15:39:02.549: E/AndroidRuntime(27084): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
03-19 15:39:02.549: E/AndroidRuntime(27084): at dalvik.system.NativeStart.main(Native Method)
03-19 15:39:02.549: E/AndroidRuntime(27084): Caused by: java.lang.RuntimeException: Parcelable encounteredClassNotFoundException reading a Serializable object (name = com.halcyon.ui.redbumper.entities.RBGetVehicleInfoByVin_AllTrims)
03-19 15:39:02.549: E/AndroidRuntime(27084): at android.os.Parcel.readSerializable(Parcel.java:1951)
03-19 15:39:02.549: E/AndroidRuntime(27084): at android.os.Parcel.readValue(Parcel.java:1822)
03-19 15:39:02.549: E/AndroidRuntime(27084): at android.os.Parcel.readMapInternal(Parcel.java:2008)
03-19 15:39:02.549: E/AndroidRuntime(27084): at android.os.Bundle.unparcel(Bundle.java:208)
03-19 15:39:02.549: E/AndroidRuntime(27084): at android.os.Bundle.getString(Bundle.java:1034)
03-19 15:39:02.549: E/AndroidRuntime(27084): at com.adplotmanagement.androidScrolbleTabbar$PUSHViewBroadcastReceiver.onReceive(androidScrolbleTabbar.java:560)
03-19 15:39:02.549: E/AndroidRuntime(27084): at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:910)
03-19 15:39:02.549: E/AndroidRuntime(27084): ... 9 more
03-19 15:39:02.549: E/AndroidRuntime(27084): Caused by: java.lang.ClassNotFoundException: com.halcyon.ui.redbumper.entities.RBGetVehicleInfoByVin_AllTrims
03-19 15:39:02.549: E/AndroidRuntime(27084): at java.lang.Class.classForName(Native Method)
03-19 15:39:02.549: E/AndroidRuntime(27084): at java.lang.Class.forName(Class.java:235)
03-19 15:39:02.549: E/AndroidRuntime(27084): at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:2590)
03-19 15:39:02.549: E/AndroidRuntime(27084): at java.io.ObjectInputStream.readNewClassDesc(ObjectInputStream.java:1846)
03-19 15:39:02.549: E/AndroidRuntime(27084): at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:826)
03-19 15:39:02.549: E/AndroidRuntime(27084): at java.io.ObjectInputStream.readNewObject(ObjectInputStream.java:2066)
03-19 15:39:02.549: E/AndroidRuntime(27084): at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:929)
03-19 15:39:02.549: E/AndroidRuntime(27084): at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2285)
03-19 15:39:02.549: E/AndroidRuntime(27084): at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2240)
03-19 15:39:02.549: E/AndroidRuntime(27084): at android.os.Parcel.readSerializable(Parcel.java:1945)
03-19 15:39:02.549: E/AndroidRuntime(27084): ... 15 more
03-19 15:39:02.549: E/AndroidRuntime(27084): Caused by: java.lang.NoClassDefFoundError: com.halcyon.ui.redbumper.entities.RBGetVehicleInfoByVin_AllTrims
03-19 15:39:02.549: E/AndroidRuntime(27084): ... 25 more
03-19 15:39:02.549: E/AndroidRuntime(27084): Caused by: java.lang.ClassNotFoundException: com.halcyon.ui.redbumper.entities.RBGetVehicleInfoByVin_AllTrims in loader dalvik.system.PathClassLoader[/system/framework/com.google.android.maps.jar:/data/app/com.adplotmanagement-1.apk]
03-19 15:39:02.549: E/AndroidRuntime(27084): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
03-19 15:39:02.549: E/AndroidRuntime(27084): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
03-19 15:39:02.549: E/AndroidRuntime(27084): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
03-19 15:39:02.549: E/AndroidRuntime(27084): ... 25 more
Missed adding one more point, I have two applications with same functionality and each app having the same class GetVehicleInfo_AllTrims and it is a pojo class. When i run one app in foreground the other app that lives in background is crashing with the above error.
Hi find the root cause of the issue and resolved it .
In two apps we are using same BroadCastReceivers and its intent filters. Due to this issue the runtime not able to find the appropriate receiver for the app.
I modified the intent filters for two apps differently and it is working fine now.
java.lang.ClassNotFoundException: com.halcyon.ui.redbumper.entities.RBGetVehicleInfoByVin_AllTrims
What is the cause of this
The cause of this is exception that the class com.halcyon.ui.redbumper.entities.RBGetVehicleInfoByVin_AllTrims was not found.
how can I fix it?
Make that class available on the application's CLASSPATH.
Related
i have this problem:
when i try start my emulator in eclipse i wait 15 minutes and it is not started.
I try reinstall eclipse but emulator still dont working.
03-19 15:26:38.960: E/Installer(438): connection failed
03-19 15:26:39.530: E/System(438): ******************************************
03-19 15:26:39.530: E/System(438): ************ Failure starting bootstrap service
03-19 15:26:39.530: E/System(438): java.lang.NullPointerException
03-19 15:26:39.530: E/System(438): at com.android.server.firewall.IntentFirewall.readRulesDir(IntentFirewall.java:271)
03-19 15:26:39.530: E/System(438): at com.android.server.firewall.IntentFirewall.<init>(IntentFirewall.java:114)
03-19 15:26:39.530: E/System(438): at com.android.server.am.ActivityManagerService.main(ActivityManagerService.java:1804)
03-19 15:26:39.530: E/System(438): at com.android.server.ServerThread.initAndLoop(SystemServer.java:196)
03-19 15:26:39.530: E/System(438): at com.android.server.SystemServer.main(SystemServer.java:1179)
03-19 15:26:39.530: E/System(438): at java.lang.reflect.Method.invokeNative(Native Method)
03-19 15:26:39.530: E/System(438): at java.lang.reflect.Method.invoke(Method.java:515)
03-19 15:26:39.530: E/System(438): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
03-19 15:26:39.530: E/System(438): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
03-19 15:26:39.530: E/System(438): at dalvik.system.NativeStart.main(Native Method)
03-19 15:26:39.630: E/AndroidRuntime(438): *** FATAL EXCEPTION IN SYSTEM PROCESS: WindowManager
03-19 15:26:39.630: E/AndroidRuntime(438): java.lang.NullPointerException
03-19 15:26:39.630: E/AndroidRuntime(438): at com.android.server.display.LocalDisplayAdapter$LocalDisplayDevice.getDisplayDeviceInfoLocked(LocalDisplayAdapter.java:147)
03-19 15:26:39.630: E/AndroidRuntime(438): at com.android.server.display.DisplayManagerService.handleDisplayDeviceAddedLocked(DisplayManagerService.java:852)
03-19 15:26:39.630: E/AndroidRuntime(438): at com.android.server.display.DisplayManagerService.handleDisplayDeviceAdded(DisplayManagerService.java:841)
03-19 15:26:39.630: E/AndroidRuntime(438): at com.android.server.display.DisplayManagerService.access$1100(DisplayManagerService.java:96)
03-19 15:26:39.630: E/AndroidRuntime(438): at com.android.server.display.DisplayManagerService$DisplayAdapterListener.onDisplayDeviceEvent(DisplayManagerService.java:1281)
03-19 15:26:39.630: E/AndroidRuntime(438): at com.android.server.display.DisplayAdapter$1.run(DisplayAdapter.java:108)
03-19 15:26:39.630: E/AndroidRuntime(438): at android.os.Handler.handleCallback(Handler.java:733)
03-19 15:26:39.630: E/AndroidRuntime(438): at android.os.Handler.dispatchMessage(Handler.java:95)
03-19 15:26:39.630: E/AndroidRuntime(438): at android.os.Looper.loop(Looper.java:136)
03-19 15:26:39.630: E/AndroidRuntime(438): at android.os.HandlerThread.run(HandlerThread.java:61)
03-19 15:26:39.640: E/AndroidRuntime(438): Error reporting crash
03-19 15:26:39.640: E/AndroidRuntime(438): java.lang.NullPointerException
03-19 15:26:39.640: E/AndroidRuntime(438): at com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:84)
03-19 15:26:39.640: E/AndroidRuntime(438): at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
03-19 15:26:39.640: E/AndroidRuntime(438): at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)
03-19 15:27:46.600: E/Installer(796): connection failed
03-19 15:27:47.120: E/System(796): ******************************************
03-19 15:27:47.120: E/System(796): ************ Failure starting bootstrap service
03-19 15:27:47.120: E/System(796): java.lang.NullPointerException
03-19 15:27:47.120: E/System(796): at com.android.server.firewall.IntentFirewall.readRulesDir(IntentFirewall.java:271)
03-19 15:27:47.120: E/System(796): at com.android.server.firewall.IntentFirewall.<init>(IntentFirewall.java:114)
03-19 15:27:47.120: E/System(796): at com.android.server.am.ActivityManagerService.main(ActivityManagerService.java:1804)
03-19 15:27:47.120: E/System(796): at com.android.server.ServerThread.initAndLoop(SystemServer.java:196)
03-19 15:27:47.120: E/System(796): at com.android.server.SystemServer.main(SystemServer.java:1179)
03-19 15:27:47.120: E/System(796): at java.lang.reflect.Method.invokeNative(Native Method)
03-19 15:27:47.120: E/System(796): at java.lang.reflect.Method.invoke(Method.java:515)
03-19 15:27:47.120: E/System(796): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
03-19 15:27:47.120: E/System(796): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
03-19 15:27:47.120: E/System(796): at dalvik.system.NativeStart.main(Native Method)
I install eclipse with adt with sdk for android and i can not start emulator.
Thank you for help.
Try opening emulator with less device screen size like 3.2'and wait for emulator to launch,on first occasion it might take some time.
Emulator with high config and screen size takes ages to open and sometimes does not even launch no matter what.
I had the same problem and i opened emulator using small screen resolution and boom it worked. :) Try it.
I've developed an app using Cordova 3.3 and Eclipse as IDE. If I build and test the application directly in my device, the app runs perfectly, however when I publish the application in Google Play, it crashes, displaying the following error:
03-19 09:14:32.151: E/AndroidRuntime(15250): FATAL EXCEPTION: main
03-19 09:14:32.151: E/AndroidRuntime(15250): Process:
com.mobit.qpedimos, PID: 15250 03-19 09:14:32.151:
E/AndroidRuntime(15250): java.lang.RuntimeException: Unable to
instantiate activity
ComponentInfo{com.mobit.qpedimos/com.mobit.qpedimos.QPedimos}:
java.lang.ClassNotFoundException: Didn't find class
"com.mobit.qpedimos.QPedimos" on path: DexPathList[[zip file
"/data/app/com.mobit.qpedimos-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.mobit.qpedimos-1,
/vendor/lib, /system/lib]] 03-19 09:14:32.151:
E/AndroidRuntime(15250): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2121)
03-19 09:14:32.151: E/AndroidRuntime(15250): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
03-19 09:14:32.151: E/AndroidRuntime(15250): at
android.app.ActivityThread.access$800(ActivityThread.java:135) 03-19
09:14:32.151: E/AndroidRuntime(15250): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
03-19 09:14:32.151: E/AndroidRuntime(15250): at
android.os.Handler.dispatchMessage(Handler.java:102) 03-19
09:14:32.151: E/AndroidRuntime(15250): at
android.os.Looper.loop(Looper.java:136) 03-19 09:14:32.151:
E/AndroidRuntime(15250): at
android.app.ActivityThread.main(ActivityThread.java:5017) 03-19
09:14:32.151: E/AndroidRuntime(15250): at
java.lang.reflect.Method.invokeNative(Native Method) 03-19
09:14:32.151: E/AndroidRuntime(15250): at
java.lang.reflect.Method.invoke(Method.java:515) 03-19 09:14:32.151:
E/AndroidRuntime(15250): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
03-19 09:14:32.151: E/AndroidRuntime(15250): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 03-19
09:14:32.151: E/AndroidRuntime(15250): at
dalvik.system.NativeStart.main(Native Method) 03-19 09:14:32.151:
E/AndroidRuntime(15250): Caused by: java.lang.ClassNotFoundException:
Didn't find class "com.mobit.qpedimos.QPedimos" on path:
DexPathList[[zip file
"/data/app/com.mobit.qpedimos-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.mobit.qpedimos-1,
/vendor/lib, /system/lib]] 03-19 09:14:32.151:
E/AndroidRuntime(15250): at
dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
03-19 09:14:32.151: E/AndroidRuntime(15250): at
java.lang.ClassLoader.loadClass(ClassLoader.java:497) 03-19
09:14:32.151: E/AndroidRuntime(15250): at
java.lang.ClassLoader.loadClass(ClassLoader.java:457) 03-19
09:14:32.151: E/AndroidRuntime(15250): at
android.app.Instrumentation.newActivity(Instrumentation.java:1061)
03-19 09:14:32.151: E/AndroidRuntime(15250): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2112)
03-19 09:14:32.151: E/AndroidRuntime(15250): ... 11 more
I've checked the paths, class names and package name and they all seem to be right. What else could I check in order to detect the cause of this error? Or at least if I could reproduce the same exact conditions that are making the app crashes, that would be great to debug, so I wouldn't need to wait for the app to be published.
Copied from question body:
Finally, the problem was made by Eclipse. It seems that building the APK, Eclipse was missing some packages. After clean the project and restarting the IDE, the problem was solved and running.
I am new to Android technology, and I am creating a practice app. I have created a mail sending class that is used in two Activities. In one Activity it is working fine, but in the other it is not working -- there is an error in the logcat and I am unable to find what is causing it. Here is the error log:
03-19 12:11:23.773: E/WindowManager(891): Activity com.example.mytest.MainActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{40d0de70 V.E..... R.....ID 0,0-97,92} that was originally added here
03-19 12:11:23.773: E/WindowManager(891): android.view.WindowLeaked: Activity com.example.mytest.MainActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{40d0de70 V.E..... R.....ID 0,0-97,92} that was originally added here
03-19 12:11:23.773: E/WindowManager(891): at android.view.ViewRootImpl.<init>(ViewRootImpl.java:354)
03-19 12:11:23.773: E/WindowManager(891): at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:216)
03-19 12:11:23.773: E/WindowManager(891): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
03-19 12:11:23.773: E/WindowManager(891): at android.app.Dialog.show(Dialog.java:281)
03-19 12:11:23.773: E/WindowManager(891): at com.example.mytest.MainActivity$CountDownTask.onPreExecute(MainActivity.java:289)
03-19 12:11:23.773: E/WindowManager(891): at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:586)
03-19 12:11:23.773: E/WindowManager(891): at android.os.AsyncTask.execute(AsyncTask.java:534)
03-19 12:11:23.773: E/WindowManager(891): at com.example.mytest.MainActivity.CallLogsBackup(MainActivity.java:91)
03-19 12:11:23.773: E/WindowManager(891): at java.lang.reflect.Method.invokeNative(Native Method)
03-19 12:11:23.773: E/WindowManager(891): at java.lang.reflect.Method.invoke(Method.java:511)
03-19 12:11:23.773: E/WindowManager(891): at android.view.View$1.onClick(View.java:3592)
03-19 12:11:23.773: E/WindowManager(891): at android.view.View.performClick(View.java:4202)
03-19 12:11:23.773: E/WindowManager(891): at android.view.View$PerformClick.run(View.java:17340)
03-19 12:11:23.773: E/WindowManager(891): at android.os.Handler.handleCallback(Handler.java:725)
03-19 12:11:23.773: E/WindowManager(891): at android.os.Handler.dispatchMessage(Handler.java:92)
03-19 12:11:23.773: E/WindowManager(891): at android.os.Looper.loop(Looper.java:137)
03-19 12:11:23.773: E/WindowManager(891): at android.app.ActivityThread.main(ActivityThread.java:5039)
03-19 12:11:23.773: E/WindowManager(891): at java.lang.reflect.Method.invokeNative(Native Method)
03-19 12:11:23.773: E/WindowManager(891): at java.lang.reflect.Method.invoke(Method.java:511)
03-19 12:11:23.773: E/WindowManager(891): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-19 12:11:23.773: E/WindowManager(891): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-19 12:11:23.773: E/WindowManager(891): at dalvik.system.NativeStart.main(Native Method)
I have downloaded the sample code for location from
https://code.google.com/p/android-protips-location/
I am trying to run it to see but it always crashes after app launch.
I have checked the manifest but I didnt find anything wrong. Has any one faced similar problem with the above sample code.
Here is the crash log.
03-19 12:06:05.456: D/AndroidRuntime(9185): Shutting down VM 03-19
12:06:05.456: W/dalvikvm(9185): threadid=1: thread exiting with
uncaught exception (group=0x414e62a0) 03-19 12:06:05.503:
E/AndroidRuntime(9185): FATAL EXCEPTION: main 03-19 12:06:05.503:
E/AndroidRuntime(9185): java.lang.RuntimeException: Unable to
instantiate activity
ComponentInfo{com.radioactiveyak.location_best_practices/com.radioactiveyak.location_best_practices.UI.PlaceActivity}:
java.lang.ClassNotFoundException:
com.radioactiveyak.location_best_practices.UI.PlaceActivity 03-19
12:06:05.503: E/AndroidRuntime(9185): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2021)
03-19 12:06:05.503: E/AndroidRuntime(9185): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2122)
03-19 12:06:05.503: E/AndroidRuntime(9185): at
android.app.ActivityThread.access$600(ActivityThread.java:140) 03-19
12:06:05.503: E/AndroidRuntime(9185): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1228)
03-19 12:06:05.503: E/AndroidRuntime(9185): at
android.os.Handler.dispatchMessage(Handler.java:99) 03-19
12:06:05.503: E/AndroidRuntime(9185): at
android.os.Looper.loop(Looper.java:137) 03-19 12:06:05.503:
E/AndroidRuntime(9185): at
android.app.ActivityThread.main(ActivityThread.java:4895) 03-19
12:06:05.503: E/AndroidRuntime(9185): at
java.lang.reflect.Method.invokeNative(Native Method) 03-19
12:06:05.503: E/AndroidRuntime(9185): at
java.lang.reflect.Method.invoke(Method.java:511) 03-19 12:06:05.503:
E/AndroidRuntime(9185): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994)
03-19 12:06:05.503: E/AndroidRuntime(9185): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761) 03-19
12:06:05.503: E/AndroidRuntime(9185): at
dalvik.system.NativeStart.main(Native Method) 03-19 12:06:05.503:
E/AndroidRuntime(9185): Caused by: java.lang.ClassNotFoundException:
com.radioactiveyak.location_best_practices.UI.PlaceActivity 03-19
12:06:05.503: E/AndroidRuntime(9185): at
dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
03-19 12:06:05.503: E/AndroidRuntime(9185): at
java.lang.ClassLoader.loadClass(ClassLoader.java:501) 03-19
12:06:05.503: E/AndroidRuntime(9185): at
java.lang.ClassLoader.loadClass(ClassLoader.java:461) 03-19
12:06:05.503: E/AndroidRuntime(9185): at
android.app.Instrumentation.newActivity(Instrumentation.java:1068)
03-19 12:06:05.503: E/AndroidRuntime(9185): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2012)
03-19 12:06:05.503: E/AndroidRuntime(9185): ... 11 more
Did you try project -> Clean? Do you have to add the permision in manifest of location?
I had the same issue.
I solved it by going to: Project Properties -> Java Build Path -> Order and Export Tab
And then ive put the checkmark on the "android-support-v4.jar"
I keep getting an exception when I want to display an alertdialog at the beginning of an activity.
I can't figure out why? I really would appreciate an explanation.
The code:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
if (!isInternetConnectionAvailable()) {
AlertDialog alert = new AlertDialog.Builder(getApplicationContext()).create();
alert.setMessage("TEST DIALOG!!!");
alert.show();
}
...
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): FATAL EXCEPTION: main
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): java.lang.RuntimeException: Unable to start activity ComponentInfo{de.droidgroup.THMInfo/de.droidgroup.THMInfo.Activities.StartActivity}: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at android.os.Handler.dispatchMessage(Handler.java:99)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at android.os.Looper.loop(Looper.java:123)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at android.app.ActivityThread.main(ActivityThread.java:4627)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at java.lang.reflect.Method.invokeNative(Native Method)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at java.lang.reflect.Method.invoke(Method.java:521)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at dalvik.system.NativeStart.main(Native Method)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): Caused by: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at android.view.ViewRoot.setView(ViewRoot.java:509)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at android.app.Dialog.show(Dialog.java:241)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at de.droidgroup.THMInfo.Activities.StartActivity.onCreate(StartActivity.java:82)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
03-19 16:04:33.933: ERROR/AndroidRuntime(15145): ... 11 more
Use this instead of getApplicationContext(). More info here.