BrowserActivity has leaked window - android

What's this error?
11-25 09:38:33.233: ERROR/WindowManager(248): Activity com.android.browser.BrowserActivity has leaked window android.widget.LinearLayout#44f997e0 that was originally added here
11-25 09:38:33.233: ERROR/WindowManager(248): android.view.WindowLeaked: Activity com.android.browser.BrowserActivity has leaked window android.widget.LinearLayout#44f997e0 that was originally added here
11-25 09:38:33.233: ERROR/WindowManager(248): at android.view.ViewRoot.<init>(ViewRoot.java:227)
11-25 09:38:33.233: ERROR/WindowManager(248): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148)
11-25 09:38:33.233: ERROR/WindowManager(248): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
11-25 09:38:33.233: ERROR/WindowManager(248): at android.view.Window$LocalWindowManager.addView(Window.java:424)
11-25 09:38:33.233: ERROR/WindowManager(248): at com.android.browser.BrowserActivity.showFakeTitleBar(BrowserActivity.java:1037)
11-25 09:38:33.233: ERROR/WindowManager(248): at com.android.browser.BrowserActivity.access$2100(BrowserActivity.java:153)
11-25 09:38:33.233: ERROR/WindowManager(248): at com.android.browser.BrowserActivity$7.onPageStarted(BrowserActivity.java:2597)
11-25 09:38:33.233: ERROR/WindowManager(248): at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:234)
11-25 09:38:33.233: ERROR/WindowManager(248): at android.os.Handler.dispatchMessage(Handler.java:99)
11-25 09:38:33.233: ERROR/WindowManager(248): at android.os.Looper.loop(Looper.java:123)
11-25 09:38:33.233: ERROR/WindowManager(248): at android.app.ActivityThread.main(ActivityThread.java:4363)
11-25 09:38:33.233: ERROR/WindowManager(248): at java.lang.reflect.Method.invokeNative(Native Method)
11-25 09:38:33.233: ERROR/WindowManager(248): at java.lang.reflect.Method.invoke(Method.java:521)
11-25 09:38:33.233: ERROR/WindowManager(248): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
11-25 09:38:33.233: ERROR/WindowManager(248): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
11-25 09:38:33.233: ERROR/WindowManager(248): at dalvik.system.NativeStart.main(Native Method)

It means you have started any window (say: Alert or Dialog) in BrowserActivity, and before dismissing that window, you have started new Activity.
Dismiss that window before starting new Activity.

Related

add window bad token when selecting spinner

I have a custom listview with a spinner as one of the components of the row. I am using fragments so I inflate the layout as follow:
this._inflater = LayoutInflater.from(context);
where
context = getActivity().getApplicationContext().
My layout for the spinner is:
<Spinner
android:id="#+id/spTipoDispProteccion"
android:layout_width="0dp"
android:textColor="#color/NEGRO"
android:layout_weight="3.1"
style="#style/DropDownAltaFacil"
android:spinnerMode="dialog"
android:entries="#array/OPCIONES_TIPO_DISP_SEGURIDAD"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:layout_gravity="center_vertical"
android:layout_marginLeft="5dp"
/>
When I select the spinner ir order to choose a value it crashes and show me the error add window token null.
I try to pass getActivity() but does not work.
Any idea?
This is my log:
11-25 16:47:53.351: E/AndroidRuntime(21116): FATAL EXCEPTION: main
11-25 16:47:53.351: E/AndroidRuntime(21116): android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
11-25 16:47:53.351: E/AndroidRuntime(21116): at android.view.ViewRootImpl.setView(ViewRootImpl.java:801)
11-25 16:47:53.351: E/AndroidRuntime(21116): at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:265)
11-25 16:47:53.351: E/AndroidRuntime(21116): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:73)
11-25 16:47:53.351: E/AndroidRuntime(21116): at android.app.Dialog.show(Dialog.java:282)
11-25 16:47:53.351: E/AndroidRuntime(21116): at android.app.AlertDialog$Builder.show(AlertDialog.java:951)
11-25 16:47:53.351: E/AndroidRuntime(21116): at android.widget.Spinner$DialogPopup.show(Spinner.java:878)
11-25 16:47:53.351: E/AndroidRuntime(21116): at android.widget.Spinner.performClick(Spinner.java:614)
11-25 16:47:53.351: E/AndroidRuntime(21116): at android.view.View$PerformClick.run(View.java:18190)
11-25 16:47:53.351: E/AndroidRuntime(21116): at android.os.Handler.handleCallback(Handler.java:725)
11-25 16:47:53.351: E/AndroidRuntime(21116): at android.os.Handler.dispatchMessage(Handler.java:92)
11-25 16:47:53.351: E/AndroidRuntime(21116): at android.os.Looper.loop(Looper.java:175)
11-25 16:47:53.351: E/AndroidRuntime(21116): at android.app.ActivityThread.main(ActivityThread.java:5279)
11-25 16:47:53.351: E/AndroidRuntime(21116): at java.lang.reflect.Method.invokeNative(Native Method)
11-25 16:47:53.351: E/AndroidRuntime(21116): at java.lang.reflect.Method.invoke(Method.java:511)
11-25 16:47:53.351: E/AndroidRuntime(21116): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
11-25 16:47:53.351: E/AndroidRuntime(21116): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
11-25 16:47:53.351: E/AndroidRuntime(21116): at dalvik.system.NativeStart.main(Native Method)

leaked window in facebook activity

when i am using facebook login button in my activity, logcat shows up this. I don't get it why this showing up I checked entire class never found a reference.
06-27 14:17:45.819 12019-12019/com.ets.medecord E/WindowManager﹕ Activity com.facebook.FacebookActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView#4054a518 that was originally added here
android.view.WindowLeaked: Activity com.facebook.FacebookActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView#4054a518 that was originally added here
at android.view.ViewRoot.<init>(ViewRoot.java:259)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
at android.view.Window$LocalWindowManager.addView(Window.java:465)
at android.app.Dialog.show(Dialog.java:241)
at com.facebook.internal.WebDialog$DialogWebViewClient.onPageStarted(WebDialog.java:500)
at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:264)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3835)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)
at dalvik.system.NativeStart.main(Native Method)
to check out activity code http://pastebin.com/qQqbvX6g
Window leak exception often occurs if Dialog not used properly(such as not finished before jumping to another activity). And Google has reminded developers that DialogFragment is a better choice than Dialog.

android leaked window force close

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()
}
...
}

My application stops working when I enter a specific activity

I'm trying to make an android app. When I choose an item from a list you go to another activity, but when I press the item I get this error(below) and the application dies. I can't figure it out, It worked a few hours ago, I just changed some margins on the textboxes in the .xml for the activity that start when I click the list item.
11-25 21:06:21.427: D/dalvikvm(725): GC_FOR_ALLOC freed 33K, 3% free 6779K/6919K, paused 45ms, total 65ms
11-25 21:06:21.427: I/dalvikvm-heap(725): Forcing collection of SoftReferences for 11715856-byte allocation
11-25 21:06:21.547: D/dalvikvm(725): GC_BEFORE_OOM freed 603K, 11% free 6175K/6919K, paused 114ms, total 119ms
11-25 21:06:21.547: E/dalvikvm-heap(725): Out of memory on a 11715856-byte allocation.
11-25 21:06:21.547: I/dalvikvm(725): "main" prio=5 tid=1 RUNNABLE
11-25 21:06:21.547: I/dalvikvm(725): | group="main" sCount=0 dsCount=0 obj=0x40a14568 self=0x2a00b9e0
11-25 21:06:21.547: I/dalvikvm(725): | sysTid=725 nice=0 sched=0/0 cgrp=apps handle=1073870640
11-25 21:06:21.557: I/dalvikvm(725): | schedstat=( 1339266348 1125088991 664 ) utm=96 stm=37 core=0
11-25 21:06:21.557: I/dalvikvm(725): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
11-25 21:06:21.566: I/dalvikvm(725): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:500)
11-25 21:06:21.566: I/dalvikvm(725): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:353)
11-25 21:06:21.566: I/dalvikvm(725): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:781)
11-25 21:06:21.566: I/dalvikvm(725): at android.content.res.Resources.loadDrawable(Resources.java:1930)
11-25 21:06:21.566: I/dalvikvm(725): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
11-25 21:06:21.566: I/dalvikvm(725): at android.view.View.<init>(View.java:3336)
11-25 21:06:21.566: I/dalvikvm(725): at android.view.ViewGroup.<init>(ViewGroup.java:427)
11-25 21:06:21.566: I/dalvikvm(725): at android.widget.LinearLayout.<init>(LinearLayout.java:176)
11-25 21:06:21.566: I/dalvikvm(725): at android.widget.LinearLayout.<init>(LinearLayout.java:172)
11-25 21:06:21.576: I/dalvikvm(725): at java.lang.reflect.Constructor.constructNative(Native Method)
11-25 21:06:21.576: I/dalvikvm(725): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
11-25 21:06:21.587: I/dalvikvm(725): at android.view.LayoutInflater.createView(LayoutInflater.java:587)
11-25 21:06:21.587: I/dalvikvm(725): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
11-25 21:06:21.587: I/dalvikvm(725): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
11-25 21:06:21.587: I/dalvikvm(725): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
11-25 21:06:21.587: I/dalvikvm(725): at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
11-25 21:06:21.587: I/dalvikvm(725): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
11-25 21:06:21.587: I/dalvikvm(725): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
11-25 21:06:21.587: I/dalvikvm(725): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
11-25 21:06:21.587: I/dalvikvm(725): at android.app.Activity.setContentView(Activity.java:1867)
11-25 21:06:21.587: I/dalvikvm(725): at com.example.lapp.legi.onCreate(legi.java:19)
11-25 21:06:21.587: I/dalvikvm(725): at android.app.Activity.performCreate(Activity.java:5008)
11-25 21:06:21.587: I/dalvikvm(725): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
11-25 21:06:21.596: I/dalvikvm(725): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
11-25 21:06:21.596: I/dalvikvm(725): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
11-25 21:06:21.596: I/dalvikvm(725): at android.app.ActivityThread.access$600(ActivityThread.java:130)
11-25 21:06:21.596: I/dalvikvm(725): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
11-25 21:06:21.596: I/dalvikvm(725): at android.os.Handler.dispatchMessage(Handler.java:99)
11-25 21:06:21.596: I/dalvikvm(725): at android.os.Looper.loop(Looper.java:137)
11-25 21:06:21.596: I/dalvikvm(725): at android.app.ActivityThread.main(ActivityThread.java:4745)
11-25 21:06:21.596: I/dalvikvm(725): at java.lang.reflect.Method.invokeNative(Native Method)
11-25 21:06:21.596: I/dalvikvm(725): at java.lang.reflect.Method.invoke(Method.java:511)
11-25 21:06:21.616: I/dalvikvm(725): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
11-25 21:06:21.616: I/dalvikvm(725): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
11-25 21:06:21.616: I/dalvikvm(725): at dalvik.system.NativeStart.main(Native Method)
11-25 21:06:21.626: D/skia(725): --- decoder->decode returned false
11-25 21:06:21.626: D/AndroidRuntime(725): Shutting down VM
11-25 21:06:21.626: W/dalvikvm(725): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
11-25 21:06:21.686: E/AndroidRuntime(725): FATAL EXCEPTION: main
11-25 21:06:21.686: E/AndroidRuntime(725): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.lapp/com.example.lapp.legi}: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
11-25 21:06:21.686: E/AndroidRuntime(725): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
11-25 21:06:21.686: E/AndroidRuntime(725): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
11-25 21:06:21.686: E/AndroidRuntime(725): at android.app.ActivityThread.access$600(ActivityThread.java:130)
11-25 21:06:21.686: E/AndroidRuntime(725): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
11-25 21:06:21.686: E/AndroidRuntime(725): at android.os.Handler.dispatchMessage(Handler.java:99)
11-25 21:06:21.686: E/AndroidRuntime(725): at android.os.Looper.loop(Looper.java:137)
11-25 21:06:21.686: E/AndroidRuntime(725): at android.app.ActivityThread.main(ActivityThread.java:4745)
11-25 21:06:21.686: E/AndroidRuntime(725): at java.lang.reflect.Method.invokeNative(Native Method)
11-25 21:06:21.686: E/AndroidRuntime(725): at java.lang.reflect.Method.invoke(Method.java:511)
11-25 21:06:21.686: E/AndroidRuntime(725): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
11-25 21:06:21.686: E/AndroidRuntime(725): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
11-25 21:06:21.686: E/AndroidRuntime(725): at dalvik.system.NativeStart.main(Native Method)
11-25 21:06:21.686: E/AndroidRuntime(725): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
11-25 21:06:21.686: E/AndroidRuntime(725): at android.view.LayoutInflater.createView(LayoutInflater.java:613)
11-25 21:06:21.686: E/AndroidRuntime(725): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
11-25 21:06:21.686: E/AndroidRuntime(725): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
11-25 21:06:21.686: E/AndroidRuntime(725): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
11-25 21:06:21.686: E/AndroidRuntime(725): at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
11-25 21:06:21.686: E/AndroidRuntime(725): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
11-25 21:06:21.686: E/AndroidRuntime(725): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
11-25 21:06:21.686: E/AndroidRuntime(725): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
11-25 21:06:21.686: E/AndroidRuntime(725): at android.app.Activity.setContentView(Activity.java:1867)
11-25 21:06:21.686: E/AndroidRuntime(725): at com.example.lapp.legi.onCreate(legi.java:19)
11-25 21:06:21.686: E/AndroidRuntime(725): at android.app.Activity.performCreate(Activity.java:5008)
11-25 21:06:21.686: E/AndroidRuntime(725): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
11-25 21:06:21.686: E/AndroidRuntime(725): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
11-25 21:06:21.686: E/AndroidRuntime(725): ... 11 more
11-25 21:06:21.686: E/AndroidRuntime(725): Caused by: java.lang.reflect.InvocationTargetException
11-25 21:06:21.686: E/AndroidRuntime(725): at java.lang.reflect.Constructor.constructNative(Native Method)
11-25 21:06:21.686: E/AndroidRuntime(725): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
11-25 21:06:21.686: E/AndroidRuntime(725): at android.view.LayoutInflater.createView(LayoutInflater.java:587)
11-25 21:06:21.686: E/AndroidRuntime(725): ... 23 more
11-25 21:06:21.686: E/AndroidRuntime(725): Caused by: java.lang.OutOfMemoryError
11-25 21:06:21.686: E/AndroidRuntime(725): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
11-25 21:06:21.686: E/AndroidRuntime(725): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:500)
11-25 21:06:21.686: E/AndroidRuntime(725): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:353)
11-25 21:06:21.686: E/AndroidRuntime(725): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:781)
11-25 21:06:21.686: E/AndroidRuntime(725): at android.content.res.Resources.loadDrawable(Resources.java:1930)
11-25 21:06:21.686: E/AndroidRuntime(725): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
11-25 21:06:21.686: E/AndroidRuntime(725): at android.view.View.<init>(View.java:3336)
11-25 21:06:21.686: E/AndroidRuntime(725): at android.view.ViewGroup.<init>(ViewGroup.java:427)
11-25 21:06:21.686: E/AndroidRuntime(725): at android.widget.LinearLayout.<init>(LinearLayout.java:176)
11-25 21:06:21.686: E/AndroidRuntime(725): at android.widget.LinearLayout.<init>(LinearLayout.java:172)
11-25 21:06:21.686: E/AndroidRuntime(725): ... 26 more
11-25 21:06:24.386: E/Trace(742): error opening trace file: No such file or directory (2)
11-25 21:06:24.746: D/libEGL(742): loaded /system/lib/egl/libEGL_emulation.so
11-25 21:06:24.826: D/(742): HostConnection::get() New Host Connection established 0x2a0db078, tid 742
11-25 21:06:25.101: D/libEGL(742): loaded /system/lib/egl/libGLESv1_CM_emulation.so
11-25 21:06:25.116: D/libEGL(742): loaded /system/lib/egl/libGLESv2_emulation.so
11-25 21:06:25.895: W/EGL_emulation(742): eglSurfaceAttrib not implemented
11-25 21:06:26.436: D/OpenGLRenderer(742): Enabling debug mode 0
Like it says in the stack trace, it's an out of memory error. Because of the bitmap, which you are declaring in the XML element which starts at line 2.

Android custom launcher without declaring all apps in manifest

I'm creating more or less a custom launcher, based on the wonderfully simple code I found online. Basically it lists all applications:
final List<ApplicationInfo> applications = packageManager.getInstalledApplications(PackageManager.GET_META_DATA);
Then when one is clicked, it launches the activity:
final Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(applicationInfo.packageName);
if(launchIntent != null)
{
context.startActivity(launchIntent);
}
This works fine with, for example, Calculator. But for others, such as Contacts, I get an exception:
11-25 13:32:43.436: E/ApplicationLaunchListActivity(438): Unable to find explicit activity class {com.android.contacts/com.android.internal.app.ResolverActivity}; have you declared this activity in your AndroidManifest.xml?
11-25 13:32:43.436: E/ApplicationLaunchListActivity(438): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.android.contacts/com.android.internal.app.ResolverActivity}; have you declared this activity in your AndroidManifest.xml?
11-25 13:32:43.436: E/ApplicationLaunchListActivity(438): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1405)
11-25 13:32:43.436: E/ApplicationLaunchListActivity(438): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)
11-25 13:32:43.436: E/ApplicationLaunchListActivity(438): at android.app.Activity.startActivityForResult(Activity.java:2827)
11-25 13:32:43.436: E/ApplicationLaunchListActivity(438): at android.app.Activity.startActivity(Activity.java:2933)
11-25 13:32:43.436: E/ApplicationLaunchListActivity(438): at com.globalmentor.android.app.Applications.launch(Applications.java:68)
11-25 13:32:43.436: E/ApplicationLaunchListActivity(438): at com.globalmentor.android.app.Applications.launch(Applications.java:52)
11-25 13:32:43.436: E/ApplicationLaunchListActivity(438): at com.globalmentor.android.app.ApplicationLaunchListActivity.onApplicationClick(ApplicationLaunchListActivity.java:41)
11-25 13:32:43.436: E/ApplicationLaunchListActivity(438): at com.globalmentor.android.app.ApplicationListActivity$1.onItemClick(ApplicationListActivity.java:66)
11-25 13:32:43.436: E/ApplicationLaunchListActivity(438): at android.widget.AdapterView.performItemClick(AdapterView.java:284)
11-25 13:32:43.436: E/ApplicationLaunchListActivity(438): at android.widget.ListView.performItemClick(ListView.java:3513)
11-25 13:32:43.436: E/ApplicationLaunchListActivity(438): at android.widget.AbsListView$PerformClick.run(AbsListView.java:1812)
11-25 13:32:43.436: E/ApplicationLaunchListActivity(438): at android.os.Handler.handleCallback(Handler.java:587)
11-25 13:32:43.436: E/ApplicationLaunchListActivity(438): at android.os.Handler.dispatchMessage(Handler.java:92)
11-25 13:32:43.436: E/ApplicationLaunchListActivity(438): at android.os.Looper.loop(Looper.java:130)
11-25 13:32:43.436: E/ApplicationLaunchListActivity(438): at android.app.ActivityThread.main(ActivityThread.java:3683)
11-25 13:32:43.436: E/ApplicationLaunchListActivity(438): at java.lang.reflect.Method.invokeNative(Native Method)
11-25 13:32:43.436: E/ApplicationLaunchListActivity(438): at java.lang.reflect.Method.invoke(Method.java:507)
11-25 13:32:43.436: E/ApplicationLaunchListActivity(438): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
11-25 13:32:43.436: E/ApplicationLaunchListActivity(438): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
11-25 13:32:43.436: E/ApplicationLaunchListActivity(438): at dalvik.system.NativeStart.main(Native Method)
Several obvious questions present themselves: Do I have to declare the Contacts activity in the activity manifest? But why don't I have to declare Calculator in the activity manifest? And how does the default launcher handle applications that my be dynamically installed at any time---long after the manifest was written?

Categories

Resources