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.
Related
I have used ZBAR library to scan bar code in my Application.
And I got this error log while opening camera on Samsung Galaxy S3 :
java.lang.RuntimeException: startPreview failed
at android.hardware.Camera.startPreview(Native Method)
at com.SGID.MainApp.ScanningFragment.engageCamera(ScanningFragment.java:184)
at com.SGID.MainApp.ScanningFragment.access$10(ScanningFragment.java:154)
at com.SGID.MainApp.ScanningFragment$4.run(ScanningFragment.java:111)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4898)
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:1006)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
at dalvik.system.NativeStart.main(Native Method)
java.lang.RuntimeException: Unable to start activity ComponentInfo
{com.SGID.MainApp/com.SGID.MainApp.AllTabsActivity}
: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2100)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
at android.app.ActivityThread.access$600(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4898)
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:1006)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.SGID.MainApp.ParametersFragment.onCreateView(ParametersFragment.java:78)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1478)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:927)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1086)
at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1877)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:552)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1167)
at android.app.Activity.performStart(Activity.java:5216)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2073)
... 11 more
EDIT :
Getting error at this line :
CameraPreview mPreview = new CameraPreview(getActivity(), mCamera, previewCb,
autoFocusCB);
Can Anyone help me to resolve this error??
Thanks in advance..
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.
On Android 4.4 when showing a fragment that contains a MvxSpinner that is bound to a collection (either a List or ObservableCollection) with elements in it, a NullPointer is thrown.
If the collection is empty, the exception is not thrown.
The same code works on Android 4.3 without a problem.
The stack trace is the same as found in Android app crashes with NullPointerException in ChoreoGrapher and Weird NullPointerException in Spinner but the suggested fixes have no effect.
The fragment is managed inside a FragmentPagerAdapter taken from Cheesebaron.
Is this a Xamarin, MvvmCross, Android or pebcak issue?
Fragment:
public class XFragment : MvxFragment
{
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
OnCreateViewCalled += async (sender, args) =>
{
await ((IXViewModel)ViewModel).InitializeViewModelAsync();
};
var ignore = base.OnCreateView(inflater, container, savedInstanceState);
return this.BindingInflate(Resource.Layout.CreateCustomerProduct, null);
}
}
View:
<MvxSpinner
style="#style/formSpinner"
android:id="#+id/MyComponent.spinnerX"
android:prompt="#string/XPrompt"
local:MvxBind="ItemsSource Xes; SelectedItem MyModel.X.Bouquet" />
Stack trace:
11-25 11:11:23.425 D/AndroidRuntime(20978): Shutting down VM
11-25 11:11:23.425 W/dalvikvm(20978): threadid=1: thread exiting with uncaught exception (group=0x41851b90)
11-25 11:11:23.455 E/AndroidRuntime(20978): FATAL EXCEPTION: main
11-25 11:11:23.455 E/AndroidRuntime(20978): Process: FSIA.Android, PID: 20978
11-25 11:11:23.455 E/AndroidRuntime(20978): java.lang.NullPointerException
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.widget.TextView.makeNewLayout(TextView.java:6124)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.widget.TextView.onMeasure(TextView.java:6400)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.view.View.measure(View.java:16458)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.widget.Spinner.setUpChild(Spinner.java:632)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.widget.Spinner.makeView(Spinner.java:595)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.widget.Spinner.getBaseline(Spinner.java:431)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:1262)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.widget.LinearLayout.onMeasure(LinearLayout.java:590)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.view.View.measure(View.java:16458)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.view.View.measure(View.java:16458)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:1226)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.widget.ScrollView.onMeasure(ScrollView.java:326)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.view.View.measure(View.java:16458)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.view.View.measure(View.java:16458)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1447)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.view.View.measure(View.java:16458)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.widget.LinearLayout.measureVertical(LinearLayout.java:847)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.view.View.measure(View.java:16458)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.view.View.measure(View.java:16458)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
11-25 11:11:23.455 E/AndroidRuntime(20978): at com.android.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:327)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.view.View.measure(View.java:16458)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
11-25 11:11:23.455 E/AndroidRuntime(20978): at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2289)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.view.View.measure(View.java:16458)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1914)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1111)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1293)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:998)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5582)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.view.Choreographer.doCallbacks(Choreographer.java:562)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.view.Choreographer.doFrame(Choreographer.java:532)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.os.Handler.handleCallback(Handler.java:733)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.os.Handler.dispatchMessage(Handler.java:95)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.os.Looper.loop(Looper.java:137)
11-25 11:11:23.455 E/AndroidRuntime(20978): at android.app.ActivityThread.main(ActivityThread.java:4998)
11-25 11:11:23.455 E/AndroidRuntime(20978): at java.lang.reflect.Method.invokeNative(Native Method)
11-25 11:11:23.455 E/AndroidRuntime(20978): at java.lang.reflect.Method.invoke(Method.java:515)
11-25 11:11:23.455 E/AndroidRuntime(20978): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
11-25 11:11:23.455 E/AndroidRuntime(20978): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
11-25 11:11:23.455 E/AndroidRuntime(20978): at dalvik.system.NativeStart.main(Native Method)
As per https://github.com/MvvmCross/MvvmCross/issues/507 this issue is fixed in 3.1.1
I am getting error message on my AVD for my first android app named "My creativity".
Its showing:
Unfortunately My creativity has stopped
It has a simple text box and a button with background.
I am taking help of google.developers but getting above problem.
How to solve this?
Here's my LogCat:
02-24 10:18:48.624: I/Process(1068): Sending signal. PID: 1068 SIG: 9
02-24 10:18:51.654: W/Trace(1088): Unexpected value from nativeGetEnabledTags: 0
02-24 10:18:51.654: W/Trace(1088): Unexpected value from nativeGetEnabledTags: 0
02-24 10:18:52.194: D/dalvikvm(1088): GC_FOR_ALLOC freed 77K, 8% free 2513K/2708K, paused 52ms, total 56ms
02-24 10:18:52.534: I/dalvikvm-heap(1088): Grow heap (frag case) to 21.787MB for 20155408-byte allocation
02-24 10:18:52.674: D/dalvikvm(1088): GC_FOR_ALLOC freed 1K, 1% free 22194K/22392K, paused 137ms, total 137ms
02-24 10:18:52.784: D/dalvikvm(1088): GC_CONCURRENT freed <1K, 1% free 22194K/22392K, paused 9ms+21ms, total 109ms
02-24 10:18:55.204: D/dalvikvm(1088): GC_FOR_ALLOC freed <1K, 1% free 22194K/22392K, paused 41ms, total 41ms
02-24 10:18:55.204: I/dalvikvm-heap(1088): Forcing collection of SoftReferences for 45349648-byte allocation
02-24 10:18:55.284: D/dalvikvm(1088): GC_BEFORE_OOM freed 9K, 1% free 22184K/22392K, paused 72ms, total 73ms
02-24 10:18:55.284: E/dalvikvm-heap(1088): Out of memory on a 45349648-byte allocation.
02-24 10:18:55.284: I/dalvikvm(1088): "main" prio=5 tid=1 RUNNABLE
02-24 10:18:55.284: I/dalvikvm(1088): | group="main" sCount=0 dsCount=0 obj=0x40a719a0 self=0x2a00bba8
02-24 10:18:55.284: I/dalvikvm(1088): | sysTid=1088 nice=0 sched=0/0 cgrp=apps handle=1073849308
02-24 10:18:55.284: I/dalvikvm(1088): | state=R schedstat=( 3224239902 1154906764 146 ) utm=280 stm=42 core=0
02-24 10:18:55.284: I/dalvikvm(1088): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
02-24 10:18:55.294: I/dalvikvm(1088): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:502)
02-24 10:18:55.294: I/dalvikvm(1088): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:355)
02-24 10:18:55.294: I/dalvikvm(1088): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:785)
02-24 10:18:55.294: I/dalvikvm(1088): at android.content.res.Resources.loadDrawable(Resources.java:1965)
02-24 10:18:55.304: I/dalvikvm(1088): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
02-24 10:18:55.304: I/dalvikvm(1088): at android.view.View.<init>(View.java:3328)
02-24 10:18:55.304: I/dalvikvm(1088): at android.view.ViewGroup.<init>(ViewGroup.java:431)
02-24 10:18:55.304: I/dalvikvm(1088): at android.widget.LinearLayout.<init>(LinearLayout.java:176)
02-24 10:18:55.304: I/dalvikvm(1088): at android.widget.LinearLayout.<init>(LinearLayout.java:172)
02-24 10:18:55.316: I/dalvikvm(1088): at java.lang.reflect.Constructor.constructNative(Native Method)
02-24 10:18:55.316: I/dalvikvm(1088): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
02-24 10:18:55.316: I/dalvikvm(1088): at android.view.LayoutInflater.createView(LayoutInflater.java:587)
02-24 10:18:55.316: I/dalvikvm(1088): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
02-24 10:18:55.316: I/dalvikvm(1088): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
02-24 10:18:55.316: I/dalvikvm(1088): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
02-24 10:18:55.316: I/dalvikvm(1088): at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
02-24 10:18:55.324: I/dalvikvm(1088): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
02-24 10:18:55.324: I/dalvikvm(1088): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
02-24 10:18:55.324: I/dalvikvm(1088): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
02-24 10:18:55.324: I/dalvikvm(1088): at android.app.Activity.setContentView(Activity.java:1881)
02-24 10:18:55.334: I/dalvikvm(1088): at com.example.iamgreat.GreatPiyu.onCreate(GreatPiyu.java:12)
02-24 10:18:55.334: I/dalvikvm(1088): at android.app.Activity.performCreate(Activity.java:5104)
02-24 10:18:55.334: I/dalvikvm(1088): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
02-24 10:18:55.344: I/dalvikvm(1088): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
02-24 10:18:55.344: I/dalvikvm(1088): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
02-24 10:18:55.344: I/dalvikvm(1088): at android.app.ActivityThread.access$600(ActivityThread.java:141)
02-24 10:18:55.344: I/dalvikvm(1088): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
02-24 10:18:55.354: I/dalvikvm(1088): at android.os.Handler.dispatchMessage(Handler.java:99)
02-24 10:18:55.354: I/dalvikvm(1088): at android.os.Looper.loop(Looper.java:137)
02-24 10:18:55.354: I/dalvikvm(1088): at android.app.ActivityThread.main(ActivityThread.java:5039)
02-24 10:18:55.354: I/dalvikvm(1088): at java.lang.reflect.Method.invokeNative(Native Method)
02-24 10:18:55.354: I/dalvikvm(1088): at java.lang.reflect.Method.invoke(Method.java:511)
02-24 10:18:55.354: I/dalvikvm(1088): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
02-24 10:18:55.354: I/dalvikvm(1088): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
02-24 10:18:55.354: I/dalvikvm(1088): at dalvik.system.NativeStart.main(Native Method)
02-24 10:18:55.364: D/skia(1088): --- allocation failed for scaled bitmap
02-24 10:18:55.404: D/AndroidRuntime(1088): Shutting down VM
02-24 10:18:55.404: W/dalvikvm(1088): threadid=1: thread exiting with uncaught exception (group=0x40a70930)
02-24 10:18:55.515: E/AndroidRuntime(1088): FATAL EXCEPTION: main
02-24 10:18:55.515: E/AndroidRuntime(1088): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.iamgreat/com.example.iamgreat.GreatPiyu}: android.view.InflateException: Binary XML file line #1: Error inflating class <unknown>
02-24 10:18:55.515: E/AndroidRuntime(1088): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
02-24 10:18:55.515: E/AndroidRuntime(1088): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
02-24 10:18:55.515: E/AndroidRuntime(1088): at android.app.ActivityThread.access$600(ActivityThread.java:141)
02-24 10:18:55.515: E/AndroidRuntime(1088): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
02-24 10:18:55.515: E/AndroidRuntime(1088): at android.os.Handler.dispatchMessage(Handler.java:99)
02-24 10:18:55.515: E/AndroidRuntime(1088): at android.os.Looper.loop(Looper.java:137)
02-24 10:18:55.515: E/AndroidRuntime(1088): at android.app.ActivityThread.main(ActivityThread.java:5039)
02-24 10:18:55.515: E/AndroidRuntime(1088): at java.lang.reflect.Method.invokeNative(Native Method)
02-24 10:18:55.515: E/AndroidRuntime(1088): at java.lang.reflect.Method.invoke(Method.java:511)
02-24 10:18:55.515: E/AndroidRuntime(1088): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
02-24 10:18:55.515: E/AndroidRuntime(1088): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
02-24 10:18:55.515: E/AndroidRuntime(1088): at dalvik.system.NativeStart.main(Native Method)
02-24 10:18:55.515: E/AndroidRuntime(1088): Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class <unknown>
02-24 10:18:55.515: E/AndroidRuntime(1088): at android.view.LayoutInflater.createView(LayoutInflater.java:613)
02-24 10:18:55.515: E/AndroidRuntime(1088): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
02-24 10:18:55.515: E/AndroidRuntime(1088): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
02-24 10:18:55.515: E/AndroidRuntime(1088): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
02-24 10:18:55.515: E/AndroidRuntime(1088): at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
02-24 10:18:55.515: E/AndroidRuntime(1088): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
02-24 10:18:55.515: E/AndroidRuntime(1088): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
02-24 10:18:55.515: E/AndroidRuntime(1088): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
02-24 10:18:55.515: E/AndroidRuntime(1088): at android.app.Activity.setContentView(Activity.java:1881)
02-24 10:18:55.515: E/AndroidRuntime(1088): at com.example.iamgreat.GreatPiyu.onCreate(GreatPiyu.java:12)
02-24 10:18:55.515: E/AndroidRuntime(1088): at android.app.Activity.performCreate(Activity.java:5104)
02-24 10:18:55.515: E/AndroidRuntime(1088): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
02-24 10:18:55.515: E/AndroidRuntime(1088): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
02-24 10:18:55.515: E/AndroidRuntime(1088): ... 11 more
02-24 10:18:55.515: E/AndroidRuntime(1088): Caused by: java.lang.reflect.InvocationTargetException
02-24 10:18:55.515: E/AndroidRuntime(1088): at java.lang.reflect.Constructor.constructNative(Native Method)
02-24 10:18:55.515: E/AndroidRuntime(1088): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
02-24 10:18:55.515: E/AndroidRuntime(1088): at android.view.LayoutInflater.createView(LayoutInflater.java:587)
02-24 10:18:55.515: E/AndroidRuntime(1088): ... 23 more
02-24 10:18:55.515: E/AndroidRuntime(1088): Caused by: java.lang.OutOfMemoryError
02-24 10:18:55.515: E/AndroidRuntime(1088): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
02-24 10:18:55.515: E/AndroidRuntime(1088): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:502)
02-24 10:18:55.515: E/AndroidRuntime(1088): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:355)
02-24 10:18:55.515: E/AndroidRuntime(1088): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:785)
02-24 10:18:55.515: E/AndroidRuntime(1088): at android.content.res.Resources.loadDrawable(Resources.java:1965)
02-24 10:18:55.515: E/AndroidRuntime(1088): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
02-24 10:18:55.515: E/AndroidRuntime(1088): at android.view.View.<init>(View.java:3328)
02-24 10:18:55.515: E/AndroidRuntime(1088): at android.view.ViewGroup.<init>(ViewGroup.java:431)
02-24 10:18:55.515: E/AndroidRuntime(1088): at android.widget.LinearLayout.<init>(LinearLayout.java:176)
02-24 10:18:55.515: E/AndroidRuntime(1088): at android.widget.LinearLayout.<init>(LinearLayout.java:172)
02-24 10:18:55.515: E/AndroidRuntime(1088): ... 26 more
Out of memory on a 45349648-byte allocation
I think you are using lots of images and its not able to inflate it all at once.
Have a look at:
http://developer.android.com/training/displaying-bitmaps/load-bitmap.html
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?