I am developing application on music player .
I am facing error like.
'*.MusicPlayerTabWidget has leaked ServiceConnection *
Please gave you comments regarding this.
I share my Logcat for this also.
05-01 10:38:03.226: W/KeyCharacterMap(4225): Using default keymap
05-01 10:38:03.429: E/ActivityThread(4225): Activity com.pvMusic.pvm.MusicPlayerTabWidget has leaked ServiceConnection com.pvMusic.pvm.MusicPlayerTabWidget$1#4051c6f0 that was originally bound here
05-01 10:38:03.429: E/ActivityThread(4225): android.app.ServiceConnectionLeaked: Activity com.pvMusic.pvm.MusicPlayerTabWidget has leaked ServiceConnection com.pvMusic.pvm.MusicPlayerTabWidget$1#4051c6f0 that was originally bound here
05-01 10:38:03.429: E/ActivityThread(4225): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:938)
05-01 10:38:03.429: E/ActivityThread(4225): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:833)
05-01 10:38:03.429: E/ActivityThread(4225): at android.app.ContextImpl.bindService(ContextImpl.java:879)
05-01 10:38:03.429: E/ActivityThread(4225): at android.content.ContextWrapper.bindService(ContextWrapper.java:347)
05-01 10:38:03.429: E/ActivityThread(4225): at com.pvMusic.pvm.MusicPlayerTabWidget.onStart(MusicPlayerTabWidget.java:175)
05-01 10:38:03.429: E/ActivityThread(4225): at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1129)
05-01 10:38:03.429: E/ActivityThread(4225): at android.app.Activity.performStart(Activity.java:3791)
05-01 10:38:03.429: E/ActivityThread(4225): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1624)
05-01 10:38:03.429: E/ActivityThread(4225): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
05-01 10:38:03.429: E/ActivityThread(4225): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
05-01 10:38:03.429: E/ActivityThread(4225): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
05-01 10:38:03.429: E/ActivityThread(4225): at android.os.Handler.dispatchMessage(Handler.java:99)
05-01 10:38:03.429: E/ActivityThread(4225): at android.os.Looper.loop(Looper.java:130)
05-01 10:38:03.429: E/ActivityThread(4225): at android.app.ActivityThread.main(ActivityThread.java:3687)
05-01 10:38:03.429: E/ActivityThread(4225): at java.lang.reflect.Method.invokeNative(Native Method)
05-01 10:38:03.429: E/ActivityThread(4225): at java.lang.reflect.Method.invoke(Method.java:507)
05-01 10:38:03.429: E/ActivityThread(4225): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
05-01 10:38:03.429: E/ActivityThread(4225): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
05-01 10:38:03.429: E/ActivityThread(4225): at dalvik.system.NativeStart.main(Native Method)
05-01 10:39:31.859: D/dalvikvm(4225): GC_EXPLICIT freed 166K, 46% free 3022K/5575K, external 557K/1031K, paused 52ms
05-01 10:39:31.906: D/dalvikvm(4225): GC_CONCURRENT freed 0K, 46% free 3022K/5575K, external 557K/1031K, paused 4ms+3ms
More over that if you have any reference tutorials for the music player please share with me..
Add unbindService(mConnection); in your onstop() method. The code will start working properly.
If you are doing a local binding to the service inside you activity , you need to make sure that you are disconnecting from the service whenever your activity is getting closed. Otherwise the app will start leaking the connection as in your error.
You're trying to show something after you're exit activity ( your thread came back ).
as shown here, you should override the onDestroy and dismiss the dialog that is running after the activity closes.
This can also happen when your Service has registered a BroadcastReceiver and didn't unregister.
So please unregister it in onDestroy
unregisterReceiver(mReceiver);
If you bind to getApplicationContext() instead, the binding will run as long as your app is running. If you bind to getContext(), and the Activity's context is destroyed, android notices that you didn't close the connection related to that context.
Related
i just added AdMob to my app. Everything seem to work well when i debug or install release version of app (HTC m7). The problem occurs on CHUWI VX2 device (esky82_tb_cn_kk, Android 4.4). It is very strange because on this device my App works in debug mode but doesn't works in release version. I try turn of pro-gourd but it doesn't help me.
Any one have idea for that?
my manifest
instruction inside my onCreate method:
mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.setAdListener(new AdListener() {
#Override
public void onAdClosed() {
super.onAdClosed();
mAdView.setVisibility(View.GONE);
}
#Override
public void onAdOpened() {
super.onAdOpened();
mAdView.startAnimation(fade_in);
mAdView.setVisibility(View.VISIBLE);
}
#Override
public void onAdFailedToLoad(int errorCode) {
super.onAdFailedToLoad(errorCode);
mAdView.setVisibility(View.GONE);
}
#Override
public void onAdLoaded() {
super.onAdLoaded();
mAdView.startAnimation(fade_in);
mAdView.setVisibility(View.VISIBLE);
}
#Override
public void onAdLeftApplication() {
super.onAdLeftApplication();
mAdView.setVisibility(View.GONE);
}
});
mAdView.loadAd(adRequest);
code inside layout.xml
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<com.google.android.gms.ads.AdView android:id="#+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
ads:adSize="SMART_BANNER"
ads:adUnitId="#string/banner_ad_unit_id"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:visibility="gone">
</com.google.android.gms.ads.AdView>
</RelativeLayout>
Crash log:
05-01 19:39:16.305 124-124/? I/SurfaceFlinger﹕ Skip composition for [Built-in Screen (type:0)] since dirtyRegion is empty
05-01 19:39:16.321 124-124/? I/SurfaceFlinger﹕ Skip composition for [Built-in Screen (type:0)] since dirtyRegion is empty
05-01 19:39:16.330 2162-2162/? D/AndroidRuntime﹕ Shutting down VM
05-01 19:39:16.330 2162-2162/? W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41d79c98)
05-01 19:39:16.330 2162-2162/? W/dalvikvm﹕ threadid=1: uncaught exception occurred
05-01 19:39:16.331 2162-2162/? W/System.err﹕ java.lang.RuntimeException: Unable to start activity ComponentInfo{freshfrog.pytomat/freshfrog.pytomat.Main}: java.lang.NullPointerException
05-01 19:39:16.332 2162-2162/? W/System.err﹕ at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2338)
05-01 19:39:16.332 2162-2162/? W/System.err﹕ at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
05-01 19:39:16.332 2162-2162/? W/System.err﹕ at android.app.ActivityThread.access$800(ActivityThread.java:151)
05-01 19:39:16.332 2162-2162/? W/System.err﹕ at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
05-01 19:39:16.332 2162-2162/? W/System.err﹕ at android.os.Handler.dispatchMessage(Handler.java:110)
05-01 19:39:16.332 2162-2162/? W/System.err﹕ at android.os.Looper.loop(Looper.java:193)
05-01 19:39:16.333 2162-2162/? W/System.err﹕ at android.app.ActivityThread.main(ActivityThread.java:5292)
05-01 19:39:16.333 2162-2162/? W/System.err﹕ at java.lang.reflect.Method.invokeNative(Native Method)
05-01 19:39:16.333 2162-2162/? W/System.err﹕ at java.lang.reflect.Method.invoke(Method.java:515)
05-01 19:39:16.333 2162-2162/? W/System.err﹕ at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
05-01 19:39:16.333 2162-2162/? W/System.err﹕ at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
05-01 19:39:16.333 2162-2162/? W/System.err﹕ at dalvik.system.NativeStart.main(Native Method)
05-01 19:39:16.334 2162-2162/? W/System.err﹕ Caused by: java.lang.NullPointerException
05-01 19:39:16.334 2162-2162/? W/System.err﹕ at freshfrog.pytomat.Main.onCreate(Main.java:450)
05-01 19:39:16.334 2162-2162/? W/System.err﹕ at android.app.Activity.performCreate(Activity.java:5264)
05-01 19:39:16.334 2162-2162/? W/System.err﹕ at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088)
05-01 19:39:16.334 2162-2162/? W/System.err﹕ at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2302)
05-01 19:39:16.335 2162-2162/? W/System.err﹕ ... 11 more
05-01 19:39:16.335 2162-2162/? W/dalvikvm﹕ threadid=1: calling UncaughtExceptionHandler
05-01 19:39:16.336 124-124/? I/SurfaceFlinger﹕ Skip composition for [Built-in Screen (type:0)] since dirtyRegion is empty
05-01 19:39:16.339 2162-2162/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: freshfrog.pytomat, PID: 2162
java.lang.RuntimeException: Unable to start activity ComponentInfo{freshfrog.pytomat/freshfrog.pytomat.Main}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2338)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5292)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at freshfrog.pytomat.Main.onCreate(Main.java:450)
at android.app.Activity.performCreate(Activity.java:5264)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2302)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5292)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
at dalvik.system.NativeStart.main(Native Method)
05-01 19:39:16.341 654-669/? V/Provider/Settings﹕ from settings cache , name = dropbox:data_app_crash , value = null
05-01 19:39:16.342 654-669/? D/dalvikvm﹕ create interp thread : stack size=128KB
05-01 19:39:16.342 654-669/? D/dalvikvm﹕ create new thread
05-01 19:39:16.343 654-669/? D/dalvikvm﹕ new thread created
05-01 19:39:16.343 654-669/? D/dalvikvm﹕ update thread list
05-01 19:39:16.343 916-2188/? D/dalvikvm﹕ create interp thread : stack size=128KB
05-01 19:39:16.343 916-2188/? D/dalvikvm﹕ create new thread
05-01 19:39:16.343 916-2188/? D/dalvikvm﹕ new thread created
05-01 19:39:16.343 916-2188/? D/dalvikvm﹕ update thread list
05-01 19:39:16.343 654-2191/? D/dalvikvm﹕ threadid=82: interp stack at 0x64403000
05-01 19:39:16.343 654-2191/? D/dalvikvm﹕ threadid=82: created from interp
05-01 19:39:16.343 654-669/? D/dalvikvm﹕ start new thread
05-01 19:39:16.343 654-669/? V/Provider/Settings﹕ from settings cache , name = send_action_app_error , value = 1
05-01 19:39:16.343 654-669/? W/ActivityManager﹕ Force finishing activity freshfrog.pytomat/.Main
Logcat indicate this line (Main.java:450)
mAdView.setAdListener(new AdListener() {
what is this ?
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
what were you expecting? to hit both sides?
try this
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
and let the rest go
You are getting a NullPointerException on line 450 of Main.
Look at that line. Something there has not been initialised.
I solve my problem. This issue isn't connect with AdView. It was problem with project. I made small mistakes. I don't have this line
<?xml version="1.0" encoding="utf-8"?>
on the start of xml layout file. I don't know how it can event works.
I reboot device
I added missing line to xml
I clean project (Build > Clean Project)
I rebuild project (Build > Rebuild Project)
Then my apk starts work without progourd but crash when I enable this feature. So i find this solution
I configure progourd configuration file like this.
I am running 4 background tasks in a activity. But I was getting an error in one activity at
pDialog.show(). I am unable understand the. For some activities I got the same problem but I removed the progress dialog because those are medium priority but this one I need High priority. Here is my error. Can any tell me how to solve this error.
09-28 19:44:53.575: I/Choreographer(1120): Skipped 86 frames! The application may be doing too much work on its main thread.
09-28 19:44:54.374: E/WindowManager(1120): Activity com.example.newairways.Gscan has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{40d40860 V.E..... R.....ID 0,0-684,192} that was originally added here
09-28 19:44:54.374: E/WindowManager(1120): android.view.WindowLeaked: Activity com.example.newairways.Gscan has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{40d40860 V.E..... R.....ID 0,0-684,192} that was originally added here
09-28 19:44:54.374: E/WindowManager(1120): at android.view.ViewRootImpl.<init>(ViewRootImpl.java:354)
09-28 19:44:54.374: E/WindowManager(1120): at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:216)
09-28 19:44:54.374: E/WindowManager(1120): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
09-28 19:44:54.374: E/WindowManager(1120): at android.app.Dialog.show(Dialog.java:281)
09-28 19:44:54.374: E/WindowManager(1120): at com.example.newairways.Gscan$insert.onPreExecute(Gscan.java:304)
09-28 19:44:54.374: E/WindowManager(1120): at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:586)
09-28 19:44:54.374: E/WindowManager(1120): at android.os.AsyncTask.execute(AsyncTask.java:534)
09-28 19:44:54.374: E/WindowManager(1120): at com.example.newairways.Gscan$1.onClick(Gscan.java:201)
09-28 19:44:54.374: E/WindowManager(1120): at android.view.View.performClick(View.java:4204)
09-28 19:44:54.374: E/WindowManager(1120): at android.view.View$PerformClick.run(View.java:17355)
09-28 19:44:54.374: E/WindowManager(1120): at android.os.Handler.handleCallback(Handler.java:725)
09-28 19:44:54.374: E/WindowManager(1120): at android.os.Handler.dispatchMessage(Handler.java:92)
09-28 19:44:54.374: E/WindowManager(1120): at android.os.Looper.loop(Looper.java:137)
09-28 19:44:54.374: E/WindowManager(1120): at android.app.ActivityThread.main(ActivityThread.java:5041)
09-28 19:44:54.374: E/WindowManager(1120): at java.lang.reflect.Method.invokeNative(Native Method)
09-28 19:44:54.374: E/WindowManager(1120): at java.lang.reflect.Method.invoke(Method.java:511)
09-28 19:44:54.374: E/WindowManager(1120): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
09-28 19:44:54.374: E/WindowManager(1120): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
09-28 19:44:54.374: E/WindowManager(1120): at dalvik.system.NativeStart.main(Native Method)
09-28 19:44:57.234: E/Trace(1146): error opening trace file: No such file or directory (2)
Use a Handler to show dialog if you are using AsyncTask or Thread in your program. And if the problem still exists, please try posting your code for further help :)
All progress dialogs should be closed before exiting an activity.
You have probably forgotten to close your progressDialog.
Close it in your onPostExecute() method
pDialog.dismiss();
Check out this SO link for more clarifation on windowleaked error.
I have integrated zxing barcode scanner in my app. When the scanner gets a scan it takes the result and searches an external online database via a async task then opens a new activity based on the results. I am getting a force close that is not consistent, it does not happen every scan, only sometimes so I am having trouble figuring out why I am getting a leaked window error, and only sometimes:
09-25 21:02:48.105 24371-24371/com.beerportfolio.beerportfoliopro E/WindowManager﹕ Activity com.example.beerportfoliopro.BeerPage2 has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView#424b7198 that was originally added here
android.view.WindowLeaked: Activity com.example.beerportfoliopro.BeerPage2 has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView#424b7198 that was originally added here
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:468)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:419)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:351)
at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:171)
at android.view.Window$LocalWindowManager.addView(Window.java:558)
at android.app.Dialog.show(Dialog.java:282)
at com.example.beerportfoliopro.GetBeerRateJSON.onPreExecute(GetBeerRateJSON.java:52)
at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:586)
at android.os.AsyncTask.execute(AsyncTask.java:534)
at com.example.beerportfoliopro.GetBeerDataJSON.onPostExecute(GetBeerDataJSON.java:111)
at com.example.beerportfoliopro.GetBeerDataJSON.onPostExecute(GetBeerDataJSON.java:34)
at android.os.AsyncTask.finish(AsyncTask.java:631)
at android.os.AsyncTask.access$600(AsyncTask.java:177)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:155)
at android.app.ActivityThread.main(ActivityThread.java:5536)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1074)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:841)
at dalvik.system.NativeStart.main(Native Method)
09-25 21:02:48.265 24371-24371/com.beerportfolio.beerportfoliopro E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.IllegalArgumentException: View not attached to window manager
at android.view.WindowManagerImpl.findViewLocked(WindowManagerImpl.java:784)
at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:476)
at android.view.WindowManagerImpl$CompatModeWrapper.removeView(WindowManagerImpl.java:182)
at android.app.Dialog.dismissDialog(Dialog.java:328)
at android.app.Dialog.dismiss(Dialog.java:311)
at com.example.beerportfoliopro.GetBeerRateJSON.onPostExecute(GetBeerRateJSON.java:74)
at com.example.beerportfoliopro.GetBeerRateJSON.onPostExecute(GetBeerRateJSON.java:27)
at android.os.AsyncTask.finish(AsyncTask.java:631)
at android.os.AsyncTask.access$600(AsyncTask.java:177)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:155)
at android.app.ActivityThread.main(ActivityThread.java:5536)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1074)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:841)
at dalvik.system.NativeStart.main(Native Method)
From the stack trace, it looks like your Dialog isn't visible when the AsyncTask finishes its work. In that case, the call to dismiss() will crash the app.
You might try using Dialog.isShowing() to avoid the crash:
protected void onPostExecute(...) {
...
if (dialog.isShowing()) {
dialog.dismiss(); // or .cancel()
}
...
}
I am just trying out the "TouchPaint" sample provided by Google Android examples at:
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/graphics/TouchPaint.html
Created my own AndroidManifest.xml, and I figured that "GraphicsActivity.java" and "PictureLayout.java" are two other java files before I could compiled and create the apk successfully.
After I load into my Android phone, it displayed a blank screen. At this point nothing happened yet, but once I touch the screen, the apps died, and generated the following trace in logcat output:
D/dalvikvm( 4939): GC_CONCURRENT freed 44K, 49% free 2779K/5379K, external 3286K/4104K, paused 4ms+2ms
D/dalvikvm( 365): GC_CONCURRENT freed 1102K, 54% free 3271K/7047K, external 2612K/3262K, paused 4ms+4ms
I/ActivityManager( 266): Displayed com.example.android.apis.graphics/.TouchPaint: +382ms
D/AndroidRuntime( 4939): Shutting down VM
W/dalvikvm( 4939): threadid=1: thread exiting with uncaught exception (group=0x2aac8578)
E/AndroidRuntime( 4939): FATAL EXCEPTION: main
E/AndroidRuntime( 4939): java.lang.NoSuchMethodError: android.view.MotionEvent.getButtonState
E/AndroidRuntime( 4939): at com.example.android.apis.graphics.TouchPaint$PaintView.onTouchOrHoverEvent(TouchPaint.java:346)
E/AndroidRuntime( 4939): at com.example.android.apis.graphics.TouchPaint$PaintView.onTouchEvent(TouchPaint.java:337)
E/AndroidRuntime( 4939): at android.view.View.dispatchTouchEvent(View.java:3952)
E/AndroidRuntime( 4939): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:961)
E/AndroidRuntime( 4939): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:961)
E/AndroidRuntime( 4939): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1711)
E/AndroidRuntime( 4939): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1145)
E/AndroidRuntime( 4939): at android.app.Activity.dispatchTouchEvent(Activity.java:2096)
E/AndroidRuntime( 4939): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1695)
E/AndroidRuntime( 4939): at android.view.ViewRoot.deliverPointerEvent(ViewRoot.java:2217)
E/AndroidRuntime( 4939): at android.view.ViewRoot.handleMessage(ViewRoot.java:1901)
E/AndroidRuntime( 4939): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 4939): at android.os.Looper.loop(Looper.java:130)
E/AndroidRuntime( 4939): at android.app.ActivityThread.main(ActivityThread.java:3701)
E/AndroidRuntime( 4939): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 4939): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime( 4939): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
E/AndroidRuntime( 4939): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624)
E/AndroidRuntime( 4939): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 266): Force finishing activity com.example.android.apis.graphics/.TouchPaint
W/ActivityManager( 266): Activity pause timeout for HistoryRecord{2afed900 com.example.android.apis.graphics/.TouchPaint}
I/InputDispatcher( 266): Application is not responding: Window{2b3f4d00 com.example.android.apis.graphics/com.example.android.apis.graphics.TouchPaint paused=false}. 5002.0ms since event, 5001.8ms since wait started
I/InputDispatcher( 266): Dropping event because the pointer is not down.
I/WindowManager( 266): Input event dispatching timed out sending to com.example.android.apis.graphics/com.example.android.apis.graphics.TouchPaint
W/ActivityManager( 266): Activity destroy timeout for HistoryRecord{2afed900 com.example.android.apis.graphics/.TouchPaint}
D/lights ( 266): set_light_backlight: brightness=20
I/ActivityManager( 266): No longer want com.facebook.katana (pid 4319): hidden #16
W/ActivityManager( 266): Scheduling restart of crashed service com.facebook.katana/.service.UploadManager in 5000ms
I am puzzled over what is the possible cause of crashing?
This method is only available since API Level 14, set minSdkVersion to 14 in the Manifest
public final int getButtonState ()
Since: API Level 14
Gets the state of all buttons that are pressed such as a mouse or stylus button.
Returns
The button state.
I found the answer:
http://developer.android.com/resources/dashboard/platform-versions.html
http://developer.android.com/guide/appendix/api-levels.html
From the web page's table, since I know my phone is using Android 2.3.4, so that max target API for SDK should be 10. So instead of using the TouchPaint.java sample from android-14, I copied the TouchPaint.java from android-10,change the minSDK version to 10 inside my AndroidManifest.xml file:
<uses-sdk android:minSdkVersion="10"/>
Everything works!! Thanks to Rajdeep Dua too!!!
While running my app, LogCat suddenly shows this barrage of orange-colored messages (warnings) which seem to be totally unrelated to my app (and certainly not having the same pid):
05-01 12:00:03.732: WARN/System.err(1836): java.io.FileNotFoundException: http://gh-pages.clockworkmod.com/ROMManagerManifest/premium_imei.js
05-01 12:00:03.752: WARN/System.err(1836): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:1162)
05-01 12:00:03.752: WARN/System.err(1836): at java.net.URL.openStream(URL.java:653)
05-01 12:00:03.752: WARN/System.err(1836): at com.koushikdutta.rommanager.StreamUtility.downloadUrl(StreamUtility.java:46)
05-01 12:00:03.752: WARN/System.err(1836): at com.koushikdutta.rommanager.Helper$1.run(Helper.java:164)
05-01 12:00:03.752: WARN/System.err(1836): at com.koushikdutta.rommanager.Helper.isPremium(Helper.java:178)
05-01 12:00:03.752: WARN/System.err(1836): at com.koushikdutta.rommanager.DownloadService.checkForUpdates(DownloadService.java:314)
05-01 12:00:03.762: WARN/System.err(1836): at com.koushikdutta.rommanager.DownloadService.onStart(DownloadService.java:401)
05-01 12:00:03.762: WARN/System.err(1836): at android.app.Service.onStartCommand(Service.java:420)
05-01 12:00:03.762: WARN/System.err(1836): at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3053)
05-01 12:00:03.762: WARN/System.err(1836): at android.app.ActivityThread.access$3600(ActivityThread.java:125)
05-01 12:00:03.762: WARN/System.err(1836): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2096)
05-01 12:00:03.762: WARN/System.err(1836): at android.os.Handler.dispatchMessage(Handler.java:99)
05-01 12:00:03.762: WARN/System.err(1836): at android.os.Looper.loop(Looper.java:123)
05-01 12:00:03.762: WARN/System.err(1836): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-01 12:00:03.762: WARN/System.err(1836): at java.lang.reflect.Method.invokeNative(Native Method)
05-01 12:00:03.762: WARN/System.err(1836): at java.lang.reflect.Method.invoke(Method.java:521)
05-01 12:00:03.762: WARN/System.err(1836): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-01 12:00:03.762: WARN/System.err(1836): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-01 12:00:03.762: WARN/System.err(1836): at dalvik.system.NativeStart.main(Native Method)
05-01 12:00:14.202: WARN/System.err(1836): java.lang.NullPointerException
05-01 12:00:14.202: WARN/System.err(1836): at com.paypal.android.a.h.a(Unknown Source)
05-01 12:00:14.202: WARN/System.err(1836): at com.paypal.android.a.a.j(Unknown Source)
05-01 12:00:14.202: WARN/System.err(1836): at com.paypal.android.a.f.run(Unknown Source)
What does this mean? Is this is a bug in Android? A bug in some other external app or service running in the background?
How do I tell whether this has anything to do with my app-in-development?
(Note: My app doesn't use PayPal or ROM Manager in any way)
There's some kind of error occurring in what the ROM Manager is trying to do - probably a periodic check for new releases.
I wouldn't expect this has anything to do with your application, unless you see it happen during your application multiple times. And even then, I'd leave a logcat open when your app is not running and see if it's happening frequently.
You might want to think if you want to leave that rom manager installed/enabled...
If you aren't using them then it's just those services running in the background. Nothing you have to worry about.
Maybe you should filter to 'Show only selected application'?
That way you'll see only stuff related to your app.