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?
Related
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)
I've got problem with camera app installed on emulator. Every time I want to launch camera I got such nasty thing. USing Intellij Idea (newest version) I'm creating new hardware with both cameras included, byt non of these works. I'm aware of errors printed below, but I don't have idea how to fix it (it hurts me especially while developing apps using capturing photos).
What I should do to make use for fake-camera and capture fake image produced in emulator for camera functionality?
11-25 13:31:12.527: E/CameraService(927): CameraService::connect X (pid 2426) rejected (invalid cameraId 0).
11-25 13:31:12.527: W/CameraBase(2426): An error occurred while connecting to camera: 0
11-25 13:31:12.527: E/CameraHolder(2426): fail to connect Camera
11-25 13:31:12.527: E/CameraHolder(2426): java.lang.RuntimeException: Fail to connect to camera service
11-25 13:31:12.527: E/CameraHolder(2426): at android.hardware.Camera.native_setup(Native Method)
11-25 13:31:12.527: E/CameraHolder(2426): at android.hardware.Camera.<init>(Camera.java:350)
11-25 13:31:12.527: E/CameraHolder(2426): at android.hardware.Camera.open(Camera.java:309)
11-25 13:31:12.527: E/CameraHolder(2426): at com.android.camera.CameraHolder.open(CameraHolder.java:131)
11-25 13:31:12.527: E/CameraHolder(2426): at com.android.camera.Util.openCamera(Util.java:267)
11-25 13:31:12.527: E/CameraHolder(2426): at com.android.camera.Camera$4.run(Camera.java:1100)
11-25 13:31:12.527: E/CameraHolder(2426): at java.lang.Thread.run(Thread.java:841)
11-25 13:31:12.527: W/dalvikvm(2426): threadid=11: thread exiting with uncaught exception (group=0xb1d37b20)
11-25 13:31:12.527: E/AndroidRuntime(2426): FATAL EXCEPTION: Thread-93
11-25 13:31:12.527: E/AndroidRuntime(2426): Process: com.android.camera, PID: 2426
11-25 13:31:12.527: E/AndroidRuntime(2426): java.lang.RuntimeException: openCamera failed
11-25 13:31:12.527: E/AndroidRuntime(2426): at com.android.camera.Util.openCamera(Util.java:272)
11-25 13:31:12.527: E/AndroidRuntime(2426): at com.android.camera.Camera$4.run(Camera.java:1100)
11-25 13:31:12.527: E/AndroidRuntime(2426): at java.lang.Thread.run(Thread.java:841)
11-25 13:31:12.527: E/AndroidRuntime(2426): Caused by: com.android.camera.CameraHardwareException: java.lang.RuntimeException: Fail to connect to camera service
11-25 13:31:12.527: E/AndroidRuntime(2426): at com.android.camera.CameraHolder.open(CameraHolder.java:135)
11-25 13:31:12.527: E/AndroidRuntime(2426): at com.android.camera.Util.openCamera(Util.java:267)
11-25 13:31:12.527: E/AndroidRuntime(2426): ... 2 more
11-25 13:31:12.527: E/AndroidRuntime(2426): Caused by: java.lang.RuntimeException: Fail to connect to camera service
11-25 13:31:12.527: E/AndroidRuntime(2426): at android.hardware.Camera.native_setup(Native Method)
11-25 13:31:12.527: E/AndroidRuntime(2426): at android.hardware.Camera.<init>(Camera.java:350)
11-25 13:31:12.527: E/AndroidRuntime(2426): at android.hardware.Camera.open(Camera.java:309)
11-25 13:31:12.527: E/AndroidRuntime(2426): at com.android.camera.CameraHolder.open(CameraHolder.java:131)
11-25 13:31:12.527: E/AndroidRuntime(2426): ... 3 more
11-25 13:31:12.557: W/ActivityManager(1261): Force finishing activity com.android.camera/.Camera
11-25 13:31:12.567: D/dalvikvm(2426): GC_FOR_ALLOC freed 212K, 8% free 3387K/3680K, paused 6ms, total 7ms
11-25 13:31:12.567: E/gralloc_goldfish(924): gralloc_alloc: Mismatched usage flags: 492 x 874, usage 333
11-25 13:31:12.567: W/GraphicBufferAllocator(924): alloc(492, 874, 1, 00000333, ...) failed -22 (Invalid argument)
11-25 13:31:12.567: E/(924): GraphicBufferAlloc::createGraphicBuffer(w=492, h=874) failed (Invalid argument), handle=0x0
11-25 13:31:12.567: E/BufferQueue(1261): [ScreenshotClient] dequeueBuffer: SurfaceComposer::createGraphicBuffer failed
11-25 13:31:12.567: W/WindowManager(1261): Screenshot failure taking screenshot for (492x874) to layer 21010
11-25 13:31:12.607: D/dalvikvm(2426): GC_FOR_ALLOC freed 18K, 7% free 3570K/3836K, paused 2ms, total 2ms
11-25 13:31:12.607: I/dalvikvm-heap(2426): Grow heap (frag case) to 4.978MB for 1490412-byte allocation
11-25 13:31:12.637: D/dalvikvm(2426): GC_FOR_ALLOC freed 2K, 6% free 5023K/5292K, paused 17ms, total 17ms
11-25 13:31:12.667: D/dalvikvm(2426): GC_FOR_ALLOC freed 14K, 5% free 5444K/5692K, paused 3ms, total 3ms
11-25 13:31:12.677: D/dalvikvm(2426): GC_FOR_ALLOC freed 9K, 5% free 5768K/6012K, paused 4ms, total 5ms
11-25 13:31:12.687: D/dalvikvm(2426): GC_FOR_ALLOC freed 3K, 4% free 6446K/6688K, paused 4ms, total 4ms
11-25 13:31:13.087: W/ActivityManager(1261): Activity pause timeout for ActivityRecord{b27fac48 u0 com.android.camera/.Camera t7 f}
11-25 13:31:13.127: W/EGL_emulation(1415): eglSurfaceAttrib not implemented
11-25 13:31:22.217: E/WindowManager(1261): Starting window AppWindowToken{b27ff320 token=Token{b27fada8 ActivityRecord{b27fac48 u0 com.android.camera/.Camera t7}}} timed out
11-25 13:31:23.197: W/ActivityManager(1261): Activity destroy timeout for ActivityRecord{b27fac48 u0 com.android.camera/.Camera t7 f}
11-25 13:31:41.508: I/Process(2426): Sending signal. PID: 2426 SIG: 9
11-25 13:31:41.508: I/ActivityManager(1261): Process com.android.camera (pid 2426) has died.
11-25 13:31:41.528: E/SoundPool(1261): error loading /system/media/audio/ui/Effect_Tick.ogg
11-25 13:31:41.528: W/AudioService(1261): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
11-25 13:31:41.528: E/SoundPool(1261): error loading /system/media/audio/ui/Effect_Tick.ogg
11-25 13:31:41.528: W/AudioService(1261): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
11-25 13:31:41.528: E/SoundPool(1261): error loading /system/media/audio/ui/Effect_Tick.ogg
11-25 13:31:41.528: W/AudioService(1261): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
11-25 13:31:41.528: E/SoundPool(1261): error loading /system/media/audio/ui/Effect_Tick.ogg
11-25 13:31:41.528: W/AudioService(1261): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
11-25 13:31:41.528: E/SoundPool(1261): error loading /system/media/audio/ui/Effect_Tick.ogg
11-25 13:31:41.528: W/AudioService(1261): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
11-25 13:31:41.528: E/SoundPool(1261): error loading /system/media/audio/ui/KeypressStandard.ogg
11-25 13:31:41.528: W/AudioService(1261): Soundpool could not load file: /system/media/audio/ui/KeypressStandard.ogg
11-25 13:31:41.528: E/SoundPool(1261): error loading /system/media/audio/ui/KeypressSpacebar.ogg
11-25 13:31:41.528: W/AudioService(1261): Soundpool could not load file: /system/media/audio/ui/KeypressSpacebar.ogg
11-25 13:31:41.528: E/SoundPool(1261): error loading /system/media/audio/ui/KeypressDelete.ogg
11-25 13:31:41.528: W/AudioService(1261): Soundpool could not load file: /system/media/audio/ui/KeypressDelete.ogg
11-25 13:31:41.528: E/SoundPool(1261): error loading /system/media/audio/ui/KeypressReturn.ogg
11-25 13:31:41.528: W/AudioService(1261): Soundpool could not load file: /system/media/audio/ui/KeypressReturn.ogg
11-25 13:31:41.528: E/SoundPool(1261): error loading /system/media/audio/ui/KeypressInvalid.ogg
11-25 13:31:41.528: W/AudioService(1261): Soundpool could not load file: /system/media/audio/ui/KeypressInvalid.ogg
11-25 13:31:41.528: W/AudioService(1261): onLoadSoundEffects(), Error -1 while loading samples
11-25 13:31:41.528: W/InputMethodManagerService(1261): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#b2882de8 attribute=null, token = android.os.BinderProxy#b23d9688
11-25 13:34:01.090: D/dalvikvm(1261): GC_FOR_ALLOC freed 1204K, 11% free 10400K/11684K, paused 15ms, total 16ms
11-25 13:38:44.164: D/dalvikvm(1400): GC_FOR_ALLOC freed 541K, 15% free 3672K/4284K, paused 10ms, total 21ms
Im' trying to implement a drawer menu on my Android + HoloEverywhere app.
I'v used the method described on http://developer.android.com/training/implementing-navigation/nav-drawer.html to get started. The only difference is that I import a org.holoeverywhere.widget.ListView instead oh the classic ListView.
Here is my MainActivity :
import android.support.v4.app.FragmentManager;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.view.Menu;
import com.googlecode.androidannotations.annotations.AfterViews;
import com.googlecode.androidannotations.annotations.EActivity;
import com.googlecode.androidannotations.annotations.ViewById;
import org.holoeverywhere.app.Activity;
import org.holoeverywhere.widget.ArrayAdapter;
import org.holoeverywhere.widget.DrawerLayout;
import org.holoeverywhere.widget.ListView;
#EActivity(R.layout.activity_main)
public class MainActivity
extends Activity {
// Declare Variables
ActionBar mActionBar;
#ViewById(R.id.drawer_layout)
DrawerLayout mDrawer;
#ViewById(R.id.left_drawer)
ListView mDrawerList;
private String[] mPlanetTitles;
#AfterViews
protected void useElements() {
// Activate Navigation Mode Tabs
mActionBar = getSupportActionBar();
// Locate ViewPager in activity_main.xml
mPlanetTitles = getResources().getStringArray(R.array.planets_array);
// Activate Fragment Manager
FragmentManager fm = getSupportFragmentManager();
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.drawer_list_item, mPlanetTitles);
// Set the adapter for the list view
mDrawerList.setAdapter(adapter);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
getSupportMenuInflater().inflate(R.menu.activity_main, menu);
return super.onCreateOptionsMenu(menu);
}
}
And my activity_main.xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<org.holoeverywhere.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<!-- The main content view -->
<FrameLayout
android:id="#+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- The navigation drawer -->
<ListView
android:id="#+id/left_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#111"
android:choiceMode="singleChoice"
android:divider="#android:color/transparent"
android:dividerHeight="0dp" />
</org.holoeverywhere.widget.DrawerLayout>
EDIT
drawer_list_item.xml :
<!--
Copyright 2013 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:gravity="center_vertical"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:textColor="#fff"
android:background="?android:attr/activatedBackgroundIndicator"
android:minHeight="?android:attr/listPreferredItemHeightSmall"/>
This code is supposed to show me the drawer with the list of planets inside. It works well on Android 4.x devices beacause the HoloEverywhere classes are not used. But on 2.x it crashes opening with the following exception :
11-25 14:09:24.771: E/AndroidRuntime(21797): FATAL EXCEPTION: main
11-25 14:09:24.771: E/AndroidRuntime(21797): android.view.InflateException: Binary XML file line #17: Error inflating class <unknown>
11-25 14:09:24.771: E/AndroidRuntime(21797): at org.holoeverywhere.LayoutInflater._createView(LayoutInflater.java:382)
11-25 14:09:24.771: E/AndroidRuntime(21797): at org.holoeverywhere.LayoutInflater.onCreateView(LayoutInflater.java:594)
11-25 14:09:24.771: E/AndroidRuntime(21797): at org.holoeverywhere.LayoutInflater.createViewFromTag(LayoutInflater.java:444)
11-25 14:09:24.771: E/AndroidRuntime(21797): at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:529)
11-25 14:09:24.771: E/AndroidRuntime(21797): at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:488)
11-25 14:09:24.771: E/AndroidRuntime(21797): at org.holoeverywhere.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:184)
11-25 14:09:24.771: E/AndroidRuntime(21797): at org.holoeverywhere.widget.ArrayAdapter.getView(ArrayAdapter.java:256)
11-25 14:09:24.771: E/AndroidRuntime(21797): at org.holoeverywhere.widget.ListAdapterWrapper.getView(ListAdapterWrapper.java:83)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.widget.AbsListView.obtainView(AbsListView.java:1519)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.widget.ListView.makeAndAddView(ListView.java:1749)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.widget.ListView.fillDown(ListView.java:674)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.widget.ListView.fillFromTop(ListView.java:731)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.widget.ListView.layoutChildren(ListView.java:1602)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.widget.AbsListView.onLayout(AbsListView.java:1349)
11-25 14:09:24.771: E/AndroidRuntime(21797): at org.holoeverywhere.widget.ListView.onLayout(ListView.java:552)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.view.View.layout(View.java:7320)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:714)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.view.View.layout(View.java:7320)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.widget.RelativeLayout.onLayout(RelativeLayout.java:912)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.view.View.layout(View.java:7320)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.widget.FrameLayout.onLayout(FrameLayout.java:342)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.view.View.layout(View.java:7320)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.widget.FrameLayout.onLayout(FrameLayout.java:342)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.view.View.layout(View.java:7320)
11-25 14:09:24.771: E/AndroidRuntime(21797): at org.holoeverywhere.widget.LinearLayout.setChildFrame(LinearLayout.java:1126)
11-25 14:09:24.771: E/AndroidRuntime(21797): at org.holoeverywhere.widget.LinearLayout.layoutVertical(LinearLayout.java:583)
11-25 14:09:24.771: E/AndroidRuntime(21797): at org.holoeverywhere.widget.LinearLayout.onLayout(LinearLayout.java:1096)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.view.View.layout(View.java:7320)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.widget.FrameLayout.onLayout(FrameLayout.java:342)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.view.View.layout(View.java:7320)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.widget.FrameLayout.onLayout(FrameLayout.java:342)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.view.View.layout(View.java:7320)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.view.ViewRoot.performTraversals(ViewRoot.java:1162)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.view.ViewRoot.handleMessage(ViewRoot.java:1882)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.os.Handler.dispatchMessage(Handler.java:99)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.os.Looper.loop(Looper.java:130)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.app.ActivityThread.main(ActivityThread.java:3701)
11-25 14:09:24.771: E/AndroidRuntime(21797): at java.lang.reflect.Method.invokeNative(Native Method)
11-25 14:09:24.771: E/AndroidRuntime(21797): at java.lang.reflect.Method.invoke(Method.java:507)
11-25 14:09:24.771: E/AndroidRuntime(21797): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
11-25 14:09:24.771: E/AndroidRuntime(21797): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624)
11-25 14:09:24.771: E/AndroidRuntime(21797): at dalvik.system.NativeStart.main(Native Method)
11-25 14:09:24.771: E/AndroidRuntime(21797): Caused by: java.lang.reflect.InvocationTargetException
11-25 14:09:24.771: E/AndroidRuntime(21797): at java.lang.reflect.Constructor.constructNative(Native Method)
11-25 14:09:24.771: E/AndroidRuntime(21797): at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
11-25 14:09:24.771: E/AndroidRuntime(21797): at org.holoeverywhere.LayoutInflater._createView(LayoutInflater.java:358)
11-25 14:09:24.771: E/AndroidRuntime(21797): ... 41 more
11-25 14:09:24.771: E/AndroidRuntime(21797): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x2/d=0x10102fd a=-1}
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.content.res.Resources.loadDrawable(Resources.java:1692)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.view.View.<init>(View.java:1975)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.widget.TextView.<init>(TextView.java:370)
11-25 14:09:24.771: E/AndroidRuntime(21797): at org.holoeverywhere.widget.TextView.<init>(TextView.java:133)
11-25 14:09:24.771: E/AndroidRuntime(21797): at org.holoeverywhere.widget.TextView.<init>(TextView.java:129)
11-25 14:09:24.771: E/AndroidRuntime(21797): ... 44 more
11-25 14:09:24.831: W/ActivityManager(265): Force finishing activity com.board/.ui.activity.MainActivity_
11-25 14:09:25.341: W/ActivityManager(265): Activity pause timeout for HistoryRecord{2b3d55d8 com.board/.ui.activity.MainActivity_}
11-25 14:09:34.461: D/dalvikvm(21486): GC_EXPLICIT freed 52K, 49% free 2759K/5379K, external 1685K/2133K, paused 94ms
11-25 14:09:35.391: W/ActivityManager(265): Activity destroy timeout for HistoryRecord{2b3d55d8 com.board/.ui.activity.MainActivity_}
11-25 14:09:39.471: D/dalvikvm(21499): GC_EXPLICIT freed 302K, 45% free 3316K/6023K, external 1757K/2133K, paused 106ms
11-25 14:09:44.461: D/dalvikvm(21544): GC_EXPLICIT freed 143K, 48% free 2862K/5447K, external 1685K/2133K, paused 95ms
11-25 14:09:49.471: D/dalvikvm(21578): GC_EXPLICIT freed 806K, 49% free 3462K/6663K, external 1685K/2133K, paused 108ms
11-25 14:09:59.291: D/dalvikvm(7039): GC_EXPLICIT freed 6K, 46% free 3389K/6215K, external 1685K/2133K, paused 138ms
11-25 14:10:00.131: D/dalvikvm(1091): GC_EXPLICIT freed 3K, 49% free 2786K/5379K, external 1845K/2133K, paused 83ms
11-25 14:10:00.181: D/dalvikvm(343): GC_CONCURRENT freed 777K, 54% free 3267K/7047K, external 2542K/3017K, paused 2ms+9ms
11-25 14:10:00.201: D/dalvikvm(1091): GC_EXPLICIT freed 7K, 49% free 2788K/5379K, external 1981K/2133K, paused 28ms
11-25 14:10:04.161: D/SntpClient(265): request time failed: java.net.SocketTimeoutException: Try again
11-25 14:10:05.331: D/dalvikvm(21245): GC_EXPLICIT freed 179K, 50% free 3314K/6535K, external 1685K/2133K, paused 123ms
If I comment the line :
mDrawerList.setAdapter(adapter);
in my MainActivity, it runs on 2.x and I get a blank drawer.
The problem was in drawer_list_item.xml. In Android 2.x the style attributes starting with "?android:attr/" were not available. Removing them fixed the problem.
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.
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.