Hi im new to Android development.. Sorry.
My Android App crashes as i am trying to use kSoap2 to connect the app to a web service:
My Error log is as follows:
2-05 12:48:05.100: E/dalvikvm(749): Could not find class 'org.ksoap2.serialization.SoapObject', referenced from method com.example.mytestws.MainActivity.onCreate
12-05 12:48:05.100: W/dalvikvm(749): VFY: unable to resolve new-instance 548 (Lorg/ksoap2/serialization/SoapObject;) in Lcom/example/mytestws/MainActivity;
12-05 12:48:05.100: D/dalvikvm(749): VFY: replacing opcode 0x22 at 0x0012
12-05 12:48:05.100: D/dalvikvm(749): VFY: dead code 0x0014-0057 in Lcom/example/mytestws/MainActivity;.onCreate (Landroid/os/Bundle;)V
12-05 12:48:05.250: D/AndroidRuntime(749): Shutting down VM
12-05 12:48:05.250: W/dalvikvm(749): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
12-05 12:48:05.261: E/AndroidRuntime(749): FATAL EXCEPTION: main
12-05 12:48:05.261: E/AndroidRuntime(749): java.lang.NoClassDefFoundError: org.ksoap2.serialization.SoapObject
12-05 12:48:05.261: E/AndroidRuntime(749): at com.example.mytestws.MainActivity.onCreate(MainActivity.java:29)
12-05 12:48:05.261: E/AndroidRuntime(749): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
12-05 12:48:05.261: E/AndroidRuntime(749): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
12-05 12:48:05.261: E/AndroidRuntime(749): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
12-05 12:48:05.261: E/AndroidRuntime(749): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
12-05 12:48:05.261: E/AndroidRuntime(749): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
12-05 12:48:05.261: E/AndroidRuntime(749): at android.os.Handler.dispatchMessage(Handler.java:99)
12-05 12:48:05.261: E/AndroidRuntime(749): at android.os.Looper.loop(Looper.java:123)
12-05 12:48:05.261: E/AndroidRuntime(749): at android.app.ActivityThread.main(ActivityThread.java:4627)
12-05 12:48:05.261: E/AndroidRuntime(749): at java.lang.reflect.Method.invokeNative(Native Method)
12-05 12:48:05.261: E/AndroidRuntime(749): at java.lang.reflect.Method.invoke(Method.java:521)
12-05 12:48:05.261: E/AndroidRuntime(749): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
12-05 12:48:05.261: E/AndroidRuntime(749): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
12-05 12:48:05.261: E/AndroidRuntime(749): at dalvik.system.NativeStart.main(Native Method)
You have to add ksoap2 library to your classpath as an external library and also copy the .jar into libs folder of the project.
Related
Here's my code. I am trying to set background of a linear layout. But this xml (rowback) is not my main activity content, so gives errors. how can I set some XML from the class which doesn't have that XML in its content?
setContentView(R.layout.activity_quick_search_products);
...
rowb = (LinearLayout)findViewById(R.id.rowback);
...
final Drawable d = getResources().getDrawable(R.drawable.denemebut3);
d.setAlpha(100);
rowb.setBackgroundDrawable(d);
Logcat:
03-30 02:52:50.822: D/AndroidRuntime(14677): Shutting down VM
03-30 02:52:50.822: W/dalvikvm(14677): threadid=1: thread exiting with uncaught exception (group=0x40c841f8)
03-30 02:52:50.822: E/AndroidRuntime(14677): FATAL EXCEPTION: main
03-30 02:52:50.822: E/AndroidRuntime(14677): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.vitrinn/com.vitrinn.QuickSearchProducts}: java.lang.NullPointerException
03-30 02:52:50.822: E/AndroidRuntime(14677): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1968)
03-30 02:52:50.822: E/AndroidRuntime(14677): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1993)
03-30 02:52:50.822: E/AndroidRuntime(14677): at android.app.ActivityThread.access$600(ActivityThread.java:127)
03-30 02:52:50.822: E/AndroidRuntime(14677): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1159)
03-30 02:52:50.822: E/AndroidRuntime(14677): at android.os.Handler.dispatchMessage(Handler.java:99)
03-30 02:52:50.822: E/AndroidRuntime(14677): at android.os.Looper.loop(Looper.java:137)
03-30 02:52:50.822: E/AndroidRuntime(14677): at android.app.ActivityThread.main(ActivityThread.java:4507)
03-30 02:52:50.822: E/AndroidRuntime(14677): at java.lang.reflect.Method.invokeNative(Native Method)
03-30 02:52:50.822: E/AndroidRuntime(14677): at java.lang.reflect.Method.invoke(Method.java:511)
03-30 02:52:50.822: E/AndroidRuntime(14677): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:978)
03-30 02:52:50.822: E/AndroidRuntime(14677): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745)
03-30 02:52:50.822: E/AndroidRuntime(14677): at dalvik.system.NativeStart.main(Native Method)
03-30 02:52:50.822: E/AndroidRuntime(14677): Caused by: java.lang.NullPointerException
03-30 02:52:50.822: E/AndroidRuntime(14677): at com.vitrinn.QuickSearchProducts.onCreate(QuickSearchProducts.java:69)
03-30 02:52:50.822: E/AndroidRuntime(14677): at android.app.Activity.performCreate(Activity.java:4469)
03-30 02:52:50.822: E/AndroidRuntime(14677): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1052)
03-30 02:52:50.822: E/AndroidRuntime(14677): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1932)
03-30 02:52:50.822: E/AndroidRuntime(14677): ... 11 more
If R.id.rowback doesn't belong to your main activity xml resource, then you should inflate that resource manually using:
LinearLayout rowb = (LinearLayout) getLayoutInflater().inflate(XML file that contains R.id.rowback, null);
then you can safely do
rowb.setBackgroundDrawable(d);
As an extra, if you have nested elements in rowback then you can invoke:
rowb.findViewById(R.id.Something) safely.
Or if your class is not exteding from any Activity, you can always receive a Context object in its constructor, and then use
LayoutInflater.from(context)
to get a LayoutInflater object so you can inflate any XML resource you need that is not actually in your main content.
Hope this clarifies...
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I am developing an app for all android devices. It is working good on all device and I tested it on Samsung Galaxy S1, Galaxy Nexus, Motorola Xoom, HTC One and also on Amazon Kindle Fire.
It runs perfectly on all devices but when i tried using it on Nexus 7, it crashes and in log it says Out of Memory Error. I tried using System.gc(); in Activity#onPause() method but in vain. There are alternative drawables and layouts exist in app.
Please help me to resolve this issue. This issue is only specific to Nexus 7.
Below is stacktrace:
12-05 16:42:45.625: E/AndroidRuntime(8759): FATAL EXCEPTION: main
12-05 16:42:45.625: E/AndroidRuntime(8759): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.app/com.android.app.activity.MyListActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.app.ActivityThread.access$600(ActivityThread.java:141)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.os.Handler.dispatchMessage(Handler.java:99)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.os.Looper.loop(Looper.java:137)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.app.ActivityThread.main(ActivityThread.java:5039)
12-05 16:42:45.625: E/AndroidRuntime(8759): at java.lang.reflect.Method.invokeNative(Native Method)
12-05 16:42:45.625: E/AndroidRuntime(8759): at java.lang.reflect.Method.invoke(Method.java:511)
12-05 16:42:45.625: E/AndroidRuntime(8759): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
12-05 16:42:45.625: E/AndroidRuntime(8759): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
12-05 16:42:45.625: E/AndroidRuntime(8759): at dalvik.system.NativeStart.main(Native Method)
12-05 16:42:45.625: E/AndroidRuntime(8759): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.view.LayoutInflater.createView(LayoutInflater.java:613)
12-05 16:42:45.625: E/AndroidRuntime(8759): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
12-05 16:42:45.625: E/AndroidRuntime(8759): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.app.Activity.setContentView(Activity.java:1881)
12-05 16:42:45.625: E/AndroidRuntime(8759): at com.android.app.activity.MyListActivity.onCreate(MyListActivity.java:39)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.app.Activity.performCreate(Activity.java:5104)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
12-05 16:42:45.625: E/AndroidRuntime(8759): ... 11 more
12-05 16:42:45.625: E/AndroidRuntime(8759): Caused by: java.lang.reflect.InvocationTargetException
12-05 16:42:45.625: E/AndroidRuntime(8759): at java.lang.reflect.Constructor.constructNative(Native Method)
12-05 16:42:45.625: E/AndroidRuntime(8759): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.view.LayoutInflater.createView(LayoutInflater.java:587)
12-05 16:42:45.625: E/AndroidRuntime(8759): ... 23 more
12-05 16:42:45.625: E/AndroidRuntime(8759): Caused by: java.lang.OutOfMemoryError
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:502)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:355)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:785)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.content.res.Resources.loadDrawable(Resources.java:1965)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.view.View.<init>(View.java:3328)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.view.ViewGroup.<init>(ViewGroup.java:431)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.widget.LinearLayout.<init>(LinearLayout.java:176)
12-05 16:42:45.625: E/AndroidRuntime(8759): at android.widget.LinearLayout.<init>(LinearLayout.java:172)
12-05 16:42:45.625: E/AndroidRuntime(8759): ... 26 more
Thanks in advance.
Ya i had faced this issue too but not found a valid solution but you can try using android:largeHeap="true" in manifest at application level
I tried to run my app, but it is crashing before reaching the onCreate() method. I'm new to android and eclipse, so i do not even know where to start searching for the error.
That's the Error Message form LogCat:
11-22 21:06:59.787: WARN/dalvikvm(433): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): FATAL EXCEPTION: main
11-22 21:07:01.468: ERROR/AndroidRuntime(433): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.app/com.example.app.HelloActivity}: java.lang.NullPointerException
11-22 21:07:01.468: ERROR/AndroidRuntime(433): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): at android.os.Handler.dispatchMessage(Handler.java:99)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): at android.os.Looper.loop(Looper.java:123)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): at android.app.ActivityThread.main(ActivityThread.java:4627)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): at java.lang.reflect.Method.invokeNative(Native Method)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): at java.lang.reflect.Method.invoke(Method.java:521)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): at dalvik.system.NativeStart.main(Native Method)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): Caused by: java.lang.NullPointerException
11-22 21:07:01.468: ERROR/AndroidRuntime(433): at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:146)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): at com.example.app.HelloActivity.<init>(HelloActivity.java:51)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): at java.lang.Class.newInstanceImpl(Native Method)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): at java.lang.Class.newInstance(Class.java:1429)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
11-22 21:07:01.468: ERROR/AndroidRuntime(433): ... 11 more
From what i can say from the logcat (the code would help to make this even clearer), you wrote something in the constructor.
This is bad practice unless you exactly know what you are doing(but i think yours is just a first-timer error ;) ).
You should do everything to initialize your app in the overridden onCreate method.
Try not to create any constructor, and move everything in the onCreate method.
And remember, activities doesn't have a main function, and you can't pass arguments to them(there are special classes to pass data between activities)
EDIT:
now that i look better at your logcat, i can tell you even more.
You are using sharedPreferences in the constructor, but when the constructor is called, the activity doesn't exist yet, so it doesn't have any prederenceManager. This is why you get a null pointer. As i said, moving everything in the onCreate method will solve your problem
Help!
I’m having problems with my Sudoku application. I plugged in all the code to have my application remember the current position. Now when I run the application and I try to either start a new game or continue my Sudoku application says:
Sorry the application Sudoku (process org.example.sudoku) has stopped unexpectedly. Please try again.
It hasn’t done this in the past yet and I’m confused on where to go from here. I took a look at the logcat but I’m not sure what I should look for and how to fix it. Here is the logcat below
12-05 14:47:32.376: DEBUG/AndroidRuntime(289): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
12-05 14:47:32.376: DEBUG/AndroidRuntime(289): CheckJNI is ON
12-05 14:47:32.796: DEBUG/AndroidRuntime(289): —registering native functions --
12-05 14:47:34.306: DEBUG/AndroidRuntime(289): Shutting down VM
12-05 14:47:34.325: DEBUG/dalvikvm(289): Debugger has detached; object registry had 1 entries
12-05 14:47:34.345: INFO/AndroidRuntime(289): NOTE: attach of thread ‘Binder Thread #3’ failed
12-05 14:47:35.246: DEBUG/AndroidRuntime(297): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
12-05 14:47:35.246: DEBUG/AndroidRuntime(297): CheckJNI is ON
12-05 14:47:35.625: DEBUG/AndroidRuntime(297): —registering native functions --
12-05 14:47:36.985: INFO/ActivityManager(60): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0×10000000 cmp=org.example.sudoku/.Sudoku }
12-05 14:47:37.126: DEBUG/AndroidRuntime(297): Shutting down VM
12-05 14:47:37.146: DEBUG/dalvikvm(297): Debugger has detached; object registry had 1 entries
12-05 14:47:37.186: INFO/AndroidRuntime(297): NOTE: attach of thread ‘Binder Thread #3’ failed
12-05 14:47:37.359: INFO/ActivityManager(60): Start proc org.example.sudoku for activity org.example.sudoku/.Sudoku: pid=304 uid=10037 gids={}
12-05 14:47:39.327: INFO/ActivityManager(60): Displayed activity org.example.sudoku/.Sudoku: 2047 ms (total 333042 ms)
12-05 14:47:44.516: DEBUG/dalvikvm(128): GC_EXPLICIT freed 205 objects / 9864 bytes in 134ms
12-05 14:48:14.936: DEBUG/Sudoku(304): clicked on 0
12-05 14:48:14.957: INFO/ActivityManager(60): Starting activity: Intent { cmp=org.example.sudoku/.Game (has extras) }
12-05 14:48:15.146: DEBUG/AndroidRuntime(304): Shutting down VM
12-05 14:48:15.146: WARN/dalvikvm(304): threadid=1: thread exiting with uncaught exception (group=0×4001d800)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): FATAL EXCEPTION: main
12-05 14:48:15.295: ERROR/AndroidRuntime(304): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.example.sudoku/org.example.sudoku.Game}: java.lang.NullPointerException
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at android.os.Handler.dispatchMessage(Handler.java:99)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at android.os.Looper.loop(Looper.java:123)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at android.app.ActivityThread.main(ActivityThread.java:4627)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at java.lang.reflect.Method.invokeNative(Native Method)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at java.lang.reflect.Method.invoke(Method.java:521)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at dalvik.system.NativeStart.main(Native Method)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): Caused by: java.lang.NullPointerException
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at android.content.ContextWrapper.getPackageName(ContextWrapper.java:120)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at android.app.Activity.getLocalClassName(Activity.java:3478)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at android.app.Activity.getPreferences(Activity.java:3512)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at org.example.sudoku.Game.<init>(Game.java:104)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at java.lang.Class.newInstanceImpl(Native Method)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at java.lang.Class.newInstance(Class.java:1429)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
12-05 14:48:15.295: ERROR/AndroidRuntime(304): ... 11 more
12-05 14:48:15.376: WARN/ActivityManager(60): Force finishing activity org.example.sudoku/.Game
12-05 14:48:15.455: WARN/ActivityManager(60): Force finishing activity org.example.sudoku/.Sudoku
12-05 14:48:15.927: WARN/ActivityManager(60): Activity pause timeout for HistoryRecord{44049308 org.example.sudoku/.Game}
12-05 14:48:27.095: WARN/ActivityManager(60): Activity destroy timeout for HistoryRecord{43f562c0 org.example.sudoku/.Sudoku}
12-05 14:48:27.202: WARN/ActivityManager(60): Activity destroy timeout for HistoryRecord{44049308 org.example.sudoku/.Game}
12-05 14:49:20.407: DEBUG/SntpClient(60): request time failed: java.net.SocketException: Address family not supported by protocol
Any help would be greatly appreciated. Thank you
-James
You need to look at line 104 of Game.java as it seems it may be the cause of a NullPointerException
Your error of interest is:
12-05 14:48:15.295: ERROR/AndroidRuntime(304): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.example.sudoku/org.example.sudoku.Game}: java.lang.NullPointerException
Usual error - your intent is not in the Manifest.xml
i start a activity,i need to show a alertdialog,so i write a dialog util class(dialoghandler) ,i pass the context to the dialoghandler ,the first start is ok,but when i start the second ,it happend the exception.what should i do,ps help me.
here is the bug report:
12-03 07:23:26.000: ERROR/AndroidRuntime(21525): FATAL EXCEPTION: main
12-03 07:23:26.000: ERROR/AndroidRuntime(21525): android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
12-03 07:23:26.000: ERROR/AndroidRuntime(21525): at android.view.ViewRoot.setView(ViewRoot.java:509)
12-03 07:23:26.000: ERROR/AndroidRuntime(21525): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177)
12-03 07:23:26.000: ERROR/AndroidRuntime(21525): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
12-03 07:23:26.000: ERROR/AndroidRuntime(21525): at android.app.Dialog.show(Dialog.java:241)
12-03 07:23:26.000: ERROR/AndroidRuntime(21525): at com.eoemobile.api.update.EoeSdkUpdate.onCacheFetched(EoeSdkUpdate.java:170)
12-03 07:23:26.000: ERROR/AndroidRuntime(21525): at com.eoemobile.api.net.CacheManager.handleCallBackMag(CacheManager.java:362)
12-03 07:23:26.000: ERROR/AndroidRuntime(21525): at com.eoemobile.api.net.CacheManager.access$1(CacheManager.java:358)
12-03 07:23:26.000: ERROR/AndroidRuntime(21525): at com.eoemobile.api.net.CacheManager$CallbackHandler.handleMessage(CacheManager.java:375)
12-03 07:23:26.000: ERROR/AndroidRuntime(21525): at android.os.Handler.dispatchMessage(Handler.java:99)
12-03 07:23:26.000: ERROR/AndroidRuntime(21525): at android.os.Looper.loop(Looper.java:123)
12-03 07:23:26.000: ERROR/AndroidRuntime(21525): at android.app.ActivityThread.main(ActivityThread.java:4627)
12-03 07:23:26.000: ERROR/AndroidRuntime(21525): at java.lang.reflect.Method.invokeNative(Native Method)
12-03 07:23:26.000: ERROR/AndroidRuntime(21525): at java.lang.reflect.Method.invoke(Method.java:521)
12-03 07:23:26.000: ERROR/AndroidRuntime(21525): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
12-03 07:23:26.000: ERROR/AndroidRuntime(21525): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
12-03 07:23:26.000: ERROR/AndroidRuntime(21525): at dalvik.system.NativeStart.main(Native Method)
You cannot display an application window/dialog through a Context that is not an Activity. Check please that every time you start a dialog it gets correct Context.