Am developing an application in which i added licensing. My app works fine for jelly bean 4.1 not for jelly bean 4.2 and above. When i send message from another mobile to activate the licensing the app is not fetching the message in jelly bean 4.2 and above but it works fine in 4.1. Now i run my app in android device using debugger it showing the following errors. please help me to solve this problem. Thanks in advance.
this my logcat error:
04-08 10:12:17.201: I/LOG(15378): JJ/data/data/com.commonsware.android.syssvc.alarm/files
04-08 10:12:17.202: I/s(15378): File decryptted:
04-08 10:12:17.202: I/File(15378): File contents:
04-08 10:12:17.203: I/s(15378): File decryptted:
04-08 10:12:17.203: I/File(15378): File contents:
04-08 10:12:17.203: I/log(15378): mainclassfalse
04-08 10:12:17.210: W/IInputConnectionWrapper(15378): beginBatchEdit on inactive InputConnection
04-08 10:12:17.210: W/IInputConnectionWrapper(15378): endBatchEdit on inactive InputConnection
04-08 10:12:17.220: E/ActivityThread(15378): Activity com.commonsware.android.syssvc.alarm.MainActivity has leaked IntentReceiver com.commonsware.android.syssvc.alarm.MainActivity$1#421e1de8 that was originally registered here. Are you missing a call to unregisterReceiver()?
04-08 10:12:17.220: E/ActivityThread(15378): android.app.IntentReceiverLeaked: Activity com.commonsware.android.syssvc.alarm.MainActivity has leaked IntentReceiver com.commonsware.android.syssvc.alarm.MainActivity$1#421e1de8 that was originally registered here. Are you missing a call to unregisterReceiver()?
04-08 10:12:17.220: E/ActivityThread(15378): at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:805)
04-08 10:12:17.220: E/ActivityThread(15378): at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:606)
04-08 10:12:17.220: E/ActivityThread(15378): at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1551)
04-08 10:12:17.220: E/ActivityThread(15378): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1531)
04-08 10:12:17.220: E/ActivityThread(15378): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1525)
04-08 10:12:17.220: E/ActivityThread(15378): at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:467)
04-08 10:12:17.220: E/ActivityThread(15378): at com.commonsware.android.syssvc.alarm.MainActivity.onCreate(MainActivity.java:99)
04-08 10:12:17.220: E/ActivityThread(15378): at android.app.Activity.performCreate(Activity.java:5248)
04-08 10:12:17.220: E/ActivityThread(15378): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
04-08 10:12:17.220: E/ActivityThread(15378): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2173)
04-08 10:12:17.220: E/ActivityThread(15378): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2269)
04-08 10:12:17.220: E/ActivityThread(15378): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3819)
04-08 10:12:17.220: E/ActivityThread(15378): at android.app.ActivityThread.access$900(ActivityThread.java:139)
04-08 10:12:17.220: E/ActivityThread(15378): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1216)
04-08 10:12:17.220: E/ActivityThread(15378): at android.os.Handler.dispatchMessage(Handler.java:102)
04-08 10:12:17.220: E/ActivityThread(15378): at android.os.Looper.loop(Looper.java:136)
04-08 10:12:17.220: E/ActivityThread(15378): at android.app.ActivityThread.main(ActivityThread.java:5102)
04-08 10:12:17.220: E/ActivityThread(15378): at java.lang.reflect.Method.invokeNative(Native Method)
04-08 10:12:17.220: E/ActivityThread(15378): at java.lang.reflect.Method.invoke(Method.java:515)
04-08 10:12:17.220: E/ActivityThread(15378): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
04-08 10:12:17.220: E/ActivityThread(15378): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
04-08 10:12:17.220: E/ActivityThread(15378): at dalvik.system.NativeStart.main(Native Method)
04-08 10:12:17.235: I/log(15378): 111111111111111111111111111111z111111111111111
04-08 10:12:17.254: I/log(15378): 111111111111111111111111111111111111111111111
As i can see in logs, you've forgotten to unregister broadcast receiver. Try to add code unregisterReceiver(myBroadcastReceiver); in MainActivity's onStop() or onPause() or onDestroy() methods.
If you are already unregistering receiver, try to do it earlier. For example, if you're unregistring it in onDestroy() method, then move it to onStop(). Or if you are unregistring it in onStop() then move it to onPause()
Related
I have complete build for Android Content shell from this link AndroidBuildInstructions.
after that i want to make Eclipse project from it and i follow this link code of Chromium for Android.
But when i add all required java classes and required resource Only issue i am getting now is in Below two aidl file .
1)IRemoteAndroidKeyStoreInterface.aidl It is under Package org.chromium.net,Here is aidl file code:
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
interface org.chomium.net.IRemoteAndroidKeyStore;
interface org.chromium.net.IRemoteAndroidKeyStoreCallbacks;
2)common.aidl It is under Package org.chromium.content.common ,It's code is below
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file is needed to compile IChildProcessCallback.aidl and
// IChildProcessServices.aidl into java source files. See
// content/public/android/java/content.xml for target aidl.
interface org.chromium.content.common.IChildProcessCallback;
interface org.chromium.content.common.IChildProcessService;
Both file give me Error like below one :
Multiple markers at this line
- syntax error don't know what to do with ";"
- syntax error
Do any one have complete code of ContentShell apk to make some modification in it as i am unable to make running code to Eclipse .Does any one have idea how to resolved this aidl issue for android content shell source code?
For just try i have remove that two aidl from both package and run project but it now give below Error:
04-08 15:22:56.362: E/ContentShellActivity(10236): ContentView initialization failed.
04-08 15:22:56.362: E/ContentShellActivity(10236): org.chromium.base.library_loader.ProcessInitException
04-08 15:22:56.362: E/ContentShellActivity(10236): at org.chromium.base.library_loader.LibraryLoader.loadAlreadyLocked(LibraryLoader.java:190)
04-08 15:22:56.362: E/ContentShellActivity(10236): at org.chromium.base.library_loader.LibraryLoader.ensureInitialized(LibraryLoader.java:85)
04-08 15:22:56.362: E/ContentShellActivity(10236): at org.chromium.base.library_loader.LibraryLoader.ensureInitialized(LibraryLoader.java:57)
04-08 15:22:56.362: E/ContentShellActivity(10236): at org.chromium.content_shell_apk.ContentShellActivity.onCreate(ContentShellActivity.java:60)
04-08 15:22:56.362: E/ContentShellActivity(10236): at android.app.Activity.performCreate(Activity.java:5231)
04-08 15:22:56.362: E/ContentShellActivity(10236): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
04-08 15:22:56.362: E/ContentShellActivity(10236): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
04-08 15:22:56.362: E/ContentShellActivity(10236): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
04-08 15:22:56.362: E/ContentShellActivity(10236): at android.app.ActivityThread.access$800(ActivityThread.java:135)
04-08 15:22:56.362: E/ContentShellActivity(10236): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
04-08 15:22:56.362: E/ContentShellActivity(10236): at android.os.Handler.dispatchMessage(Handler.java:102)
04-08 15:22:56.362: E/ContentShellActivity(10236): at android.os.Looper.loop(Looper.java:136)
04-08 15:22:56.362: E/ContentShellActivity(10236): at android.app.ActivityThread.main(ActivityThread.java:5017)
04-08 15:22:56.362: E/ContentShellActivity(10236): at java.lang.reflect.Method.invokeNative(Native Method)
04-08 15:22:56.362: E/ContentShellActivity(10236): at java.lang.reflect.Method.invoke(Method.java:515)
04-08 15:22:56.362: E/ContentShellActivity(10236): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
04-08 15:22:56.362: E/ContentShellActivity(10236): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
04-08 15:22:56.362: E/ContentShellActivity(10236): at dalvik.system.NativeStart.main(Native Method)
04-08 15:22:56.362: E/ContentShellActivity(10236): Caused by: java.lang.UnsatisfiedLinkError: unknown failure
04-08 15:22:56.362: E/ContentShellActivity(10236): at java.lang.Runtime.loadLibrary(Runtime.java:364)
04-08 15:22:56.362: E/ContentShellActivity(10236): at java.lang.System.loadLibrary(System.java:526)
04-08 15:22:56.362: E/ContentShellActivity(10236): at org.chromium.base.library_loader.LibraryLoader.loadAlreadyLocked(LibraryLoader.java:161)
04-08 15:22:56.362: E/ContentShellActivity(10236): ... 17 more
I'm trying to integrate iqengines sdk in my app(https://github.com/iqengines/iqe-android-sdk). i started with their demo app which i could not run properly.Installed Android NDK and Cygwin 1.7. also i have added the ANDROID_NDK_ROOT under eclipse substring and and modified API keys(https://github.com/iqengines/iqe-android-sdk#building-the-demo-app-). still the app crashes.
here is the stack trace.
04-08 14:32:25.181: E/AndroidRuntime(7610): FATAL EXCEPTION: main
04-08 14:32:25.181: E/AndroidRuntime(7610): java.lang.ExceptionInInitializerError
04-08 14:32:25.181: E/AndroidRuntime(7610): at com.iqengines.sdk.IQE.initIqSdk(IQE.java:249)
04-08 14:32:25.181: E/AndroidRuntime(7610): at com.iqengines.sdk.IQE.(IQE.java:224)
04-08 14:32:25.181: E/AndroidRuntime(7610): at com.iqengines.demo.DemoActivity.initIqSdk(DemoActivity.java:161)
04-08 14:32:25.181: E/AndroidRuntime(7610): at com.iqengines.demo.DemoActivity.onCreate(DemoActivity.java:133)
04-08 14:32:25.181: E/AndroidRuntime(7610): at android.app.Activity.performCreate(Activity.java:5206)
04-08 14:32:25.181: E/AndroidRuntime(7610): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
04-08 14:32:25.181: E/AndroidRuntime(7610): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
04-08 14:32:25.181: E/AndroidRuntime(7610): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
04-08 14:32:25.181: E/AndroidRuntime(7610): at android.app.ActivityThread.access$700(ActivityThread.java:140)
04-08 14:32:25.181: E/AndroidRuntime(7610): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
04-08 14:32:25.181: E/AndroidRuntime(7610): at android.os.Handler.dispatchMessage(Handler.java:99)
04-08 14:32:25.181: E/AndroidRuntime(7610): at android.os.Looper.loop(Looper.java:137)
04-08 14:32:25.181: E/AndroidRuntime(7610): at android.app.ActivityThread.main(ActivityThread.java:4935)
04-08 14:32:25.181: E/AndroidRuntime(7610): at java.lang.reflect.Method.invokeNative(Native Method)
04-08 14:32:25.181: E/AndroidRuntime(7610): at java.lang.reflect.Method.invoke(Method.java:511)
04-08 14:32:25.181: E/AndroidRuntime(7610): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
04-08 14:32:25.181: E/AndroidRuntime(7610): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
04-08 14:32:25.181: E/AndroidRuntime(7610): at dalvik.system.NativeStart.main(Native Method)
04-08 14:32:25.181: E/AndroidRuntime(7610): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load iqindex: findLibrary returned null
04-08 14:32:25.181: E/AndroidRuntime(7610): at java.lang.Runtime.loadLibrary(Runtime.java:365)
04-08 14:32:25.181: E/AndroidRuntime(7610): at java.lang.System.loadLibrary(System.java:535)
04-08 14:32:25.181: E/AndroidRuntime(7610): at com.iqengines.sdk.IQLocal.(IQLocal.java:34)
04-08 14:32:25.181: E/AndroidRuntime(7610): ... 18 more
I think this is because of the issues related to NDK and Windows 8. I switched to Ubuntu and it works fine.
i know this question has been treated so much time, but i really don't find the answer to my problem.
This is an application which connect to a server, so, there's a socket, that's why i'm using thread (i can't do anything else since android 4.0), but even if i'm disable the code of my socket, it still crash.
Here's the logCat error :
04-08 08:36:39.366: D/AndroidRuntime(16604): Shutting down VM
04-08 08:36:39.366: W/dalvikvm(16604): threadid=1: thread exiting with uncaught exception (group=0x4122f300)
04-08 08:36:39.366: E/AndroidRuntime(16604): FATAL EXCEPTION: main
04-08 08:36:39.366: E/AndroidRuntime(16604): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.projetlyres2013/com.example.projetlyres2013.PlanDMX}: java.lang.NullPointerException
04-08 08:36:39.366: E/AndroidRuntime(16604): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1983)
04-08 08:36:39.366: E/AndroidRuntime(16604): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
04-08 08:36:39.366: E/AndroidRuntime(16604): at android.app.ActivityThread.access$600(ActivityThread.java:130)
04-08 08:36:39.366: E/AndroidRuntime(16604): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
04-08 08:36:39.366: E/AndroidRuntime(16604): at android.os.Handler.dispatchMessage(Handler.java:99)
04-08 08:36:39.366: E/AndroidRuntime(16604): at android.os.Looper.loop(Looper.java:137)
04-08 08:36:39.366: E/AndroidRuntime(16604): at android.app.ActivityThread.main(ActivityThread.java:4745)
04-08 08:36:39.366: E/AndroidRuntime(16604): at java.lang.reflect.Method.invokeNative(Native Method)
04-08 08:36:39.366: E/AndroidRuntime(16604): at java.lang.reflect.Method.invoke(Method.java:511)
04-08 08:36:39.366: E/AndroidRuntime(16604): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
04-08 08:36:39.366: E/AndroidRuntime(16604): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
04-08 08:36:39.366: E/AndroidRuntime(16604): at dalvik.system.NativeStart.main(Native Method)
04-08 08:36:39.366: E/AndroidRuntime(16604): Caused by: java.lang.NullPointerException
04-08 08:36:39.366: E/AndroidRuntime(16604): at android.app.Activity.findViewById(Activity.java:1825)
04-08 08:36:39.366: E/AndroidRuntime(16604): at com.example.projetlyres2013.PlanDMX.<init>(PlanDMX.java:27)
04-08 08:36:39.366: E/AndroidRuntime(16604): at java.lang.Class.newInstanceImpl(Native Method)
04-08 08:36:39.366: E/AndroidRuntime(16604): at java.lang.Class.newInstance(Class.java:1319)
04-08 08:36:39.366: E/AndroidRuntime(16604): at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
04-08 08:36:39.366: E/AndroidRuntime(16604): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974)
04-08 08:36:39.366: E/AndroidRuntime(16604): ... 11 more
04-08 08:36:41.326: I/Process(16604): Sending signal. PID: 16604 SIG: 9
04-08 08:46:26.556: D/AndroidRuntime(16825): Shutting down VM
///////// Manifest /////////
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.projetlyres2013"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.projetlyres2013.PlanDMX"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I don't know what's happened when i want to launch it on my tablet (android 4.1).
I really need help for that :/
Thanks
NullPointer here means that you did not set your layout XML as contentView to your Activity.
Inside onCreate(...) method of Activity add
setContentView(R.layout.some_layout-file)
I have the following code:
Line Code
193 private Camera mCamera;
<!-- NO CALLS TO mCamera HERE -->
229 mCamera = Camera.open();
230 Camera.Parameters p = mCamera.getParameters();
And when I run the application I get the following stacktrace:
04-08 20:56:45.330: E/AndroidRuntime(570): FATAL EXCEPTION: main
04-08 20:56:45.330: E/AndroidRuntime(570): java.lang.NullPointerException
04-08 20:56:45.330: E/AndroidRuntime(570): at com.soloman.cbc.FullscreenActivity$MySurfaceView.surfaceCreated(FullscreenActivity.java:230)
04-08 20:56:45.330: E/AndroidRuntime(570): at android.view.SurfaceView.updateWindow(SurfaceView.java:569)
04-08 20:56:45.330: E/AndroidRuntime(570): at android.view.SurfaceView.access$000(SurfaceView.java:86)
04-08 20:56:45.330: E/AndroidRuntime(570): at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:174)
04-08 20:56:45.330: E/AndroidRuntime(570): at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:680)
04-08 20:56:45.330: E/AndroidRuntime(570): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1842)
04-08 20:56:45.330: E/AndroidRuntime(570): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:989)
04-08 20:56:45.330: E/AndroidRuntime(570): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4351)
04-08 20:56:45.330: E/AndroidRuntime(570): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
04-08 20:56:45.330: E/AndroidRuntime(570): at android.view.Choreographer.doCallbacks(Choreographer.java:562)
04-08 20:56:45.330: E/AndroidRuntime(570): at android.view.Choreographer.doFrame(Choreographer.java:532)
04-08 20:56:45.330: E/AndroidRuntime(570): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
04-08 20:56:45.330: E/AndroidRuntime(570): at android.os.Handler.handleCallback(Handler.java:725)
04-08 20:56:45.330: E/AndroidRuntime(570): at android.os.Handler.dispatchMessage(Handler.java:92)
04-08 20:56:45.330: E/AndroidRuntime(570): at android.os.Looper.loop(Looper.java:137)
04-08 20:56:45.330: E/AndroidRuntime(570): at android.app.ActivityThread.main(ActivityThread.java:5039)
04-08 20:56:45.330: E/AndroidRuntime(570): at java.lang.reflect.Method.invokeNative(Native Method)
04-08 20:56:45.330: E/AndroidRuntime(570): at java.lang.reflect.Method.invoke(Method.java:511)
04-08 20:56:45.330: E/AndroidRuntime(570): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
04-08 20:56:45.330: E/AndroidRuntime(570): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
04-08 20:56:45.330: E/AndroidRuntime(570): at dalvik.system.NativeStart.main(Native Method)
The code I am using is from How can I manipulate the camera preview?
I have the CAMERA permission in the AndroidManifest.xml, and all imports are accounted for. Does anyone have any suggestions on how to fix this error?
Thank you.
On devices without back-facing camera Camera.open() returns null. Try Camera.open(0) to get front camera.
if the android version is prior to 3.0 use the
getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
I developed an application that allows the user to save his two favourite parking spots. It uses a service to retrieve the relevant parking information from an sqlite database. Within the database I have this method to find the first entry:
public Cursor firstentry(){
String select = "SELECT PREF1, PREF2 FROM parking_table WHERE id =1";
Cursor cursor = db.rawQuery(select, null);
return cursor;
Every time I run my application a force close error appears, when the service tries calling this method using the command:
Cursor c = dh.firstentry();
It is giving the error as when I comment it, the applications works perfectly.
Here is the logcat of the error:
04-08 18:56:38.673: E/AndroidRuntime(13166): FATAL EXCEPTION: Timer-0
04-08 18:56:38.673: E/AndroidRuntime(13166): java.lang.NullPointerException
04-08 18:56:38.673: E/AndroidRuntime(13166): at stefan.testservice.ConnectionService$1.run(ConnectionService.java:64)
04-08 18:56:38.673: E/AndroidRuntime(13166): at java.util.Timer$TimerImpl.run(Timer.java:284)
04-08 18:56:39.654: E/ActivityThread(13166): Activity stefan.testservice.TestserviceActivity has leaked IntentReceiver stefan.testservice.TestserviceActivity$2#40521b78 that was originally registered here. Are you missing a call to unregisterReceiver()?
04-08 18:56:39.654: E/ActivityThread(13166): android.app.IntentReceiverLeaked: Activity stefan.testservice.TestserviceActivity has leaked IntentReceiver stefan.testservice.TestserviceActivity$2#40521b78 that was originally registered here. Are you missing a call to unregisterReceiver()?
04-08 18:56:39.654: E/ActivityThread(13166): at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:756)
04-08 18:56:39.654: E/ActivityThread(13166): at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:551)
04-08 18:56:39.654: E/ActivityThread(13166): at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:795)
04-08 18:56:39.654: E/ActivityThread(13166): at android.app.ContextImpl.registerReceiver(ContextImpl.java:782)
04-08 18:56:39.654: E/ActivityThread(13166): at android.app.ContextImpl.registerReceiver(ContextImpl.java:776)
04-08 18:56:39.654: E/ActivityThread(13166): at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:318)
04-08 18:56:39.654: E/ActivityThread(13166): at stefan.testservice.TestserviceActivity$1.onServiceConnected(TestserviceActivity.java:280)
04-08 18:56:39.654: E/ActivityThread(13166): at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1064)
04-08 18:56:39.654: E/ActivityThread(13166): at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1081)
04-08 18:56:39.654: E/ActivityThread(13166): at android.os.Handler.handleCallback(Handler.java:587)
04-08 18:56:39.654: E/ActivityThread(13166): at android.os.Handler.dispatchMessage(Handler.java:92)
04-08 18:56:39.654: E/ActivityThread(13166): at android.os.Looper.loop(Looper.java:123)
04-08 18:56:39.654: E/ActivityThread(13166): at android.app.ActivityThread.main(ActivityThread.java:3683)
04-08 18:56:39.654: E/ActivityThread(13166): at java.lang.reflect.Method.invokeNative(Native Method)
04-08 18:56:39.654: E/ActivityThread(13166): at java.lang.reflect.Method.invoke(Method.java:507)
04-08 18:56:39.654: E/ActivityThread(13166): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-08 18:56:39.654: E/ActivityThread(13166): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-08 18:56:39.654: E/ActivityThread(13166): at dalvik.system.NativeStart.main(Native Method)
04-08 18:56:40.054: E/ActivityThread(13166): Activity stefan.testservice.TestserviceActivity has leaked ServiceConnection stefan.testservice.TestserviceActivity$1#40521790 that was originally bound here
04-08 18:56:40.054: E/ActivityThread(13166): android.app.ServiceConnectionLeaked: Activity stefan.testservice.TestserviceActivity has leaked ServiceConnection stefan.testservice.TestserviceActivity$1#40521790 that was originally bound here
04-08 18:56:40.054: E/ActivityThread(13166): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:938)
04-08 18:56:40.054: E/ActivityThread(13166): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:833)
04-08 18:56:40.054: E/ActivityThread(13166): at android.app.ContextImpl.bindService(ContextImpl.java:867)
04-08 18:56:40.054: E/ActivityThread(13166): at android.content.ContextWrapper.bindService(ContextWrapper.java:347)
04-08 18:56:40.054: E/ActivityThread(13166): at stefan.testservice.TestserviceActivity.doBindService(TestserviceActivity.java:290)
04-08 18:56:40.054: E/ActivityThread(13166): at stefan.testservice.TestserviceActivity$DownloadTask.onPostExecute(TestserviceActivity.java:193)
04-08 18:56:40.054: E/ActivityThread(13166): at android.os.AsyncTask.finish(AsyncTask.java:417)
04-08 18:56:40.054: E/ActivityThread(13166): at android.os.AsyncTask.access$300(AsyncTask.java:127)
04-08 18:56:40.054: E/ActivityThread(13166): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429)
04-08 18:56:40.054: E/ActivityThread(13166): at android.os.Handler.dispatchMessage(Handler.java:99)
04-08 18:56:40.054: E/ActivityThread(13166): at android.os.Looper.loop(Looper.java:123)
04-08 18:56:40.054: E/ActivityThread(13166): at android.app.ActivityThread.main(ActivityThread.java:3683)
04-08 18:56:40.054: E/ActivityThread(13166): at java.lang.reflect.Method.invokeNative(Native Method)
04-08 18:56:40.054: E/ActivityThread(13166): at java.lang.reflect.Method.invoke(Method.java:507)
04-08 18:56:40.054: E/ActivityThread(13166): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-08 18:56:40.054: E/ActivityThread(13166): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-08 18:56:40.054: E/ActivityThread(13166): at dalvik.system.NativeStart.main(Native Method)
Any help is much appreciated as I tried everything and nothing seems to work. Thanks in advance!
Edited:
Parking table code:
public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE " + TABLE_NAME + "(id INTEGER PRIMARY KEY, PREF1 TEXT, PREF2 TEXT)");
}
its a nullpointerexception meaning there is probably nothing in the database at that time. you need to handle if the cursor is null
stepping through the code is really the only way to see exactly what is null. More code is definitely needed though its hard to tell with what you posted
you are running rawsql so check if the exact query is valid for your db , SELECT PREF1, PREF2 FROM parking_table WHERE id =1
are PREF1 exactly(with case) the name of columns ??
If you don't have a SQLite browser software, get one here:
SQLite Browser
It helps when I'm working with SQLite. I've run into this problem before and I solved it by adding the id parameter into the query. Essentially, you'll want to change your query to:
public Cursor firstentry(){
String select = "SELECT id, PREF1, PREF2 FROM parking_table WHERE id =1";
Cursor cursor = db.rawQuery(select, null);
return cursor;
Don't forget to call c.moveToFirst() if c is the name of the Cursor.
I managed to solve it, everything was ok, I just needed to initiliaze the class object. Here's the line of code needed:
this.yourobject = new class(this);
in my case it is:
this.dh = new SQLHelper(this);
Hope it helps :)