Mvvmcross Android - Error Inflating Class: ClassNotFoundException - android

I am getting an error in my OnViewModelSet() function when trying to inflate an xml file.
When calling
LayoutInflater inflater = LayoutInflater.From(this);
View mainView = inflater.Inflate(Resource.Layout.Main, null);
I am getting a "java.lang.ClassNotFoundException: Mvx.MvxBindableListView"
Here is the whole exception:
Android.Views.InflateException: Binary XML file line #1: Error inflating class Mvx.MvxBindableListView
at Android.Runtime.JNIEnv.CallObjectMethod (intptr,intptr,Android.Runtime.JValue[]) [0x00024] in /Users/builder/data/lanes/monodroid-lion-bigsplash/0e0e51f9/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:145
at Android.Views.LayoutInflater.Inflate (int,Android.Views.ViewGroup) [0x0003e] in /Users/builder/data/lanes/monodroid-lion-bigsplash/0e0e51f9/source/monodroid/src/Mono.Android/platforms/android-12/src/generated/Android.Views.LayoutInflater.cs:543
at AndroidCornerstoneMobile.MainView.OnViewModelSet () [0x00010] in c:\Users\David\Documents\Work\AndroidXamarin\AndroidCornerstoneMobile\Views\MainView.cs:30
at at Cirrious.MvvmCross.Droid.Views.MvxActivityView`1<Core.ViewModels.MainViewModel>.set_ViewModel (Core.ViewModels.MainViewModel) <0x000bb>
at at Cirrious.MvvmCross.ExtensionMethods.MvxViewExtensionMethods.OnViewCreate<Core.ViewModels.MainViewModel> (Cirrious.MvvmCross.Interfaces.Views.IMvxView`1<Core.ViewModels.MainViewModel>,System.Func`1<Core.ViewModels.MainViewModel>) <0x00203>
at at Cirrious.MvvmCross.Droid.ExtensionMethods.MvxAndroidActivityExtensionMethods.OnViewCreate<Core.ViewModels.MainViewModel> (Cirrious.MvvmCross.Droid.Interfaces.IMvxAndroidView`1<Core.ViewModels.MainViewModel>) <0x00297>
at at Cirrious.MvvmCross.Droid.Views.MvxActivityView`1<Core.ViewModels.MainViewModel>.OnCreate (Android.OS.Bundle) <0x000d3>
at at Cirrious.MvvmCross.Binding.Droid.Views.MvxBindingActivityView`1<Core.ViewModels.MainViewModel>.OnCreate (Android.OS.Bundle) <0x000b7>
at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) [0x00010] in /Users/builder/data/lanes/monodroid-lion-bigsplash/0e0e51f9/source/monodroid/src/Mono.Android/platforms/android-12/src/generated/Android.App.Activity.cs:1837
at at (wrapper dynamic-method) object.8c1f4311-41e4-4a0f-98f2-454a6152589a (intptr,intptr,intptr) <IL 0x00017, 0x00043>
at
at --- End of managed exception stack trace ---
at android.view.InflateException: Binary XML file line #1: Error inflating class Mvx.MvxBindableListView
at at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:691)
at at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
at at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at at cirrious.mvvmcross.binding.droid.views.MvxBindingActivityView_1.n_onCreate(Native Method)
at at cirrious.mvvmcross.binding.droid.views.MvxBindingActivityView_1.onCreate(MvxBindingActivityView_1.java:31)
at at android.app.Activity.performCreate(Activity.java:4539)
at at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
at at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2013)
at at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2083)
at at android.app.ActivityThread.access$600(ActivityThread.java:134)
at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1233)
at at android.os.Handler.dispatchMessage(Handler.java:99)
at at android.os.Looper.loop(Looper.java:137)
at at android.app.ActivityThread.main(ActivityThread.java:4697)
at at java.lang.reflect.Method.invokeNative(Native Method)
at at java.lang.reflect.Method.invoke(Method.java:511)
at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
at at dalvik.system.NativeStart.main(Native Method)
at Caused by: java.lang.ClassNotFoundException: Mvx.MvxBindableListView
at at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
at at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at at android.view.LayoutInflater.createView(LayoutInflater.java:552)
at at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
at ... 20 more

To inflate the MvvmCross classes, you must use the BindingInflate methods provided by the MvxActivity classes. The easiest way to do this is to call SetContentView() within OnCreate() or OnViewModelSet().
These methods route the inflation via the MvvmCross Binding code which knows how to interpret the Mvx. abbreviated namespaces and which knows how to unpack the MvxBind binding statements.
The default Android inflater doesn't know about either of these things - so we can't just use it.

Related

Missing drawables at runtime

Problem:
My App is missing resources at runtime.
One activity just get killed at startup. (error: color 0x2 could not get converted)
The other activity shows a screen with standard graphics instead of the included ones.
What I did before:
I'm still using Eclipse ADT and wanted to give Android Studio a try.
I already uninstall it to get rid of the runtime issue without success.
Any suggestions?
EDIT:
I think there is a general compiling error as there where no errors in this parts before.
Code 1:
AnimationUtils.loadAnimation(this.context, android.R.anim.fade_in)
Stacktrace 1:
Converting to int: TypedValue{t=0x3/d=0x21b "res/drawable/btn_default.xml" a=1 r=0x1080004}
java.lang.NumberFormatException: Invalid int: "res/drawable/btn_default.xml"
at java.lang.Integer.invalidInt(Integer.java:137)
Converting to int: TypedValue{t=0x3/d=0x21b "res/drawable/btn_default.xml" a=1 r=0x1080004}
at java.lang.Integer.parse(Integer.java:374)
at java.lang.Integer.parseInt(Integer.java:365)
at com.android.internal.util.XmlUtils.convertValueToInt(XmlUtils.java:122)
at android.content.res.TypedArray.getInt(TypedArray.java:255)
at android.view.animation.Animation.<init>(Animation.java:246)
at android.view.animation.AlphaAnimation.<init>(AlphaAnimation.java:40)
at java.lang.NumberFormatException: Invalid int: "res/drawable/btn_default.xml"
at java.lang.Integer.invalidInt(Integer.java:137)
at java.lang.Integer.parse(Integer.java:374)
at java.lang.Integer.parseInt(Integer.java:365)
at com.android.internal.util.XmlUtils.convertValueToInt(XmlUtils.java:122)
at android.content.res.TypedArray.getInt(TypedArray.java:255)
at android.view.animation.Animation.<init>(Animation.java:246)
at android.view.animation.AlphaAnimation.<init>(AlphaAnimation.java:40)
at android.view.animation.AnimationUtils.createAnimationFromXml(AnimationUtils.java:116)
at android.view.animation.AnimationUtils.createAnimationFromXml(AnimationUtils.java:91)
at android.view.animation.AnimationUtils.createAnimationFromXml(AnimationUtils.java:116)
at android.view.animation.AnimationUtils.loadAnimation(AnimationUtils.java:72)
...
Code 2 (MY_activity.java:47):
setContentView(R.layout.MY_activity);
Stacktrace 2:
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{my.app/my.app.activity}: android.view.InflateException: Binary XML file line #30: Error inflating class com.android.internal.widget.ActionBarView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2092)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2117)
at android.app.ActivityThread.access$700(ActivityThread.java:134)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1218)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4867)
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:1007)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #30: Error inflating class com.android.internal.widget.ActionBarView
at android.view.LayoutInflater.createView(LayoutInflater.java:613)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:3163)
at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3223)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:312)
at android.app.Activity.setContentView(Activity.java:1901)
at my.app.MY_activity.onCreate(MY_activity.java:47)
at android.app.Activity.performCreate(Activity.java:5047)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2056)
... 11 more
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at android.view.LayoutInflater.createView(LayoutInflater.java:587)
... 25 more
Caused by: android.view.InflateException: Binary XML file line #36: Error inflating class android.widget.TextView
at android.view.LayoutInflater.createView(LayoutInflater.java:613)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at com.android.internal.widget.ActionBarView.initTitle(ActionBarView.java:831)
at com.android.internal.widget.ActionBarView.setDisplayOptions(ActionBarView.java:632)
at com.android.internal.widget.ActionBarView.<init>(ActionBarView.java:266)
... 28 more
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at android.view.LayoutInflater.createView(LayoutInflater.java:587)
... 38 more
Caused by: java.lang.UnsupportedOperationException: Can't convert to color: type=0x2
at android.content.res.TypedArray.getColor(TypedArray.java:326)
at android.widget.TextView.<init>(TextView.java:640)
at android.widget.TextView.<init>(TextView.java:579)
... 41 more
I implemented the new material design like this:
Theme.Material.Light.NoActionBar
The correct form (after including appcompat v7):
Theme.AppCompat.Light.NoActionBar

Getting FATAL EXCEPTION in extended calendar

I was initially using the calendar view and that was fine.
i wanted to display my events in the calendar view so i tried extended calendar view library.
When i imported the library project and integrated the code i am getting the following error.
FATAL EXCEPTION: main
android.view.InflateException: Binary XML file line #7: Error inflating class provider
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:698)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at com.ithoughtz.sns.MainActivity$PlaceholderFragment.onCreateView(MainActivity.java:171)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1786)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:947)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1126)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:739)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1489)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:454)
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:4745)
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:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: android.view.provider
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.view.LayoutInflater.createView(LayoutInflater.java:552)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:643)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
... 19 more
Kindly let me know if i need to post code.
XML for calendar view as follows
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
android:orientation="vertical" >
<provider
android:name="com.tyczj.extendedcalendarview.CalendarProvider"
android:authorities="com.tyczj.extendedcalendarview.calendarprovider" />
<com.tyczj.extendedcalendarview.ExtendedCalendarView
android:id="#+id/calendar"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
provider is a tag that has to be declared in the AndroidManifast.xml file of your project for declaring ContentProviders and not in the layout file.
provider is not an xml tag that is why your exception stack states the cause to be provider class not found.
right click on project->Build path->configer Build path-> order and export-> checked all option->press OK...
Now try to run your project

Xamarin Binding Java Library Issue

1、I want binding a java library(https://code.google.com/p/android-wheel/) to xamarin c# for android(IDE:VS2012\Eclipse)
2、Bingding method like this(http://developer.xamarin.com/guides/android/advanced_topics/java_integration_overview/binding_a_java_library_(.jar)/)
3、If i use the java code in C#(.cs),it is normally,
kankan.wheel.widget.WheelView wv = new kankan.wheel.widget.WheelView();
wv.DoSomething();
4、if i use the view in the layout(.axml),it is throw a exception
<kankan.wheel.widget.WheelView
android:id="#+id/MyWheel"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerInParent="true" />
ex
{Android.Views.InflateException: Exception of type 'Android.Views.InflateException' was thrown.
at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (IntPtr jobject, IntPtr jclass, IntPtr jmethod, Android.Runtime.JValue[] parms) [0x00084] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.12-series/163212a9/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:895
at Android.App.Activity.SetContentView (Int32 layoutResID) [0x00070] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.12-series/163212a9/source/monodroid/src/Mono.Android/platforms/android-19/src/generated/Android.App.Activity.cs:4252
at App5.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x0000a] in c:\Users\zhengys.KGHGROUP\Documents\Visual Studio 2012\Projects\App5\App5\MainActivity.cs:23
--- End of managed exception stack trace ---
android.view.InflateException: Binary XML file line #1: Error inflating class kankan.wheel.widget.WheelView
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:698)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
at android.app.Activity.setContentView(Activity.java:1881)
at app5.MainActivity.n_onCreate(Native Method)
at app5.MainActivity.onCreate(MainActivity.java:28)
at android.app.Activity.performCreate(Activity.java:5104)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
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:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "kankan.wheel.widget.WheelView" on path: /data/app/App5.App5-1.apk
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.view.LayoutInflater.createView(LayoutInflater.java:552)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
... 22 more
}
base: {Java.Lang.RuntimeException}
5、Does anyone know what's going on?Is "kankan.wheel.widget.WheelView" wrong path?What's correct?I need you help!
Thank you !!

Monodroid Sliding Menu can't work at android 2.2

I used the SlidingMenu library in my application, according to https://github.com/xamarin/monodroid-samples/tree/master/SlidingMenu. I build and run application successfully on the android 4.0+, but I failed run application on the android 2.2, but I saw the android sliding menu https://github.com/jfeinstein10/SlidingMenu, it supports from android 2.1.
This is error code:
at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (intptr,intptr,intptr,Android.Runtime.JValue[]) <0x00088>
at Com.Slidingmenu.Lib.App.SlidingActivity.SetBehindContentView (int) <0x00237>
at regrecall.HomeActivity.OnCreate (Android.OS.Bundle) <0x00097>
at Com.Slidingmenu.Lib.App.SlidingActivity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) <0x0005f>
at (wrapper dynamic-method) object.ffcb4990-4b21-40ac-9622-acbf3c40174b (intptr,intptr,intptr) <0x00043>
--- End of managed exception stack trace ---
android.view.InflateException: Binary XML file line #1: Error inflating class android.widget.ListView
at android.view.LayoutInflater.createView(LayoutInflater.java:513)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
at com.slidingmenu.lib.app.SlidingActivity.setBehindContentView(SlidingActivity.java:83)
at regrecall.HomeActivity.n_onCreate(Native Method)
at regrecall.HomeActivity.onCreate(HomeActivity.java:32)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
at android.app.ActivityThread.access$2300(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at android.widget.ListView.<init>(ListView.java:153)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
at android.view.LayoutInflater.createView(LayoutInflater.java:500)
... 22 more
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/common_background.png from drawable resource ID #0x7f020081: .xml extension required
at android.content.res.Resources.loadColorStateList(Resources.java:1824)
at android.content.res.TypedArray.getColor(TypedArray.java:319)
at android.widget.AbsListView.<init>(AbsListView.java:554)
at android.widget.ListView.<init>(ListView.java:157)
... 26 more
Forget me that I can't copy whole log, since the logs on the another machine can't connect to network. I analyse this log, it crashed at SldingMenuActivity onCreate method, it failed to create the listview for the behind view on the activity, but it can work on the android 4.0+, it's too strange.
The problem I found: my listview can't infalte on android 2.2, even my layout is so simple below
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ListView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/Home_MenuList"
/>
</LinearLayout>
If you take a look at the Caused by section in your Stack Trace it tells you:
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/common_background.png from drawable resource ID #0x7f020081: .xml extension required
There is something wrong with that resource, are any of the ListViewItems using this Resource Drawable?

Android WebView OutOfMemory?

Sometimes by starting my activity which only contains a WebView I got this strange log from LogCat:
java.lang.RuntimeException: Unable to start activity ComponentInfo{de.cb.pwapp/de.cb.pwapp.Artikel}:
android.view.InflateException: Binary XML file line #9: Error inflating class android.webkit.WebView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
at android.app.ActivityThread.access$700(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4921)
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:1027)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #9: Error inflating class android.webkit.WebView
at android.view.LayoutInflater.createView(LayoutInflater.java:613)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:313)
at android.app.Activity.setContentView(Activity.java:1924)
at de.cb.pwapp.Artikel.onCreate(Artikel.java:26)
at android.app.Activity.performCreate(Activity.java:5206)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
... 11 more
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at android.view.LayoutInflater.createView(LayoutInflater.java:587)
... 24 more
Caused by: java.lang.OutOfMemoryError
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:625)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:478)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:781)
at android.content.res.Resources.loadDrawable(Resources.java:1963)
at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
at android.view.View.<init>(View.java:3449)
at android.view.ViewGroup.<init>(ViewGroup.java:432)
at android.widget.AbsoluteLayout.<init>(AbsoluteLayout.java:52)
at android.webkit.WebView.<init>(WebView.java:505)
at android.webkit.WebView.<init>(WebView.java:482)
at android.webkit.WebView.<init>(WebView.java:468)
at android.webkit.WebView.<init>(WebView.java:457)
Is it correct that my WebView runs out of memory ?
I load the WebView with a long string, representing an article, from my SQLite DB.
Any ideas how to fix this problem ?
High Res Pics as a Background was the Problem

Categories

Resources