I'm trying to complete the following code lab using Xamarin.Android: https://codelabs.developers.google.com/codelabs/Material-Design-Style/#0
However, the collapsing toolbar is very laggy. When scrolling down I have to wait more than a full second for the app to catch up and show the updated (collapsed) toolbar. CPU usage during this time is 100%. Starting the DetailActivity also takes much longer than normal. The image I'm trying to load is a bit over 3 MB in size.
Layout file (activity_detail.axml):
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/detail_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="#+id/appbar"
android:layout_width="match_parent"
android:layout_height="#dimen/app_bar_height"
android:fitsSystemWindows="true"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:theme="#style/ThemeOverlay.AppCompat.Dark"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginEnd="#dimen/article_keylines"
app:expandedTitleMarginStart="#dimen/md_keylines"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:id="#+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/paris"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
app:layout_collapseMode="parallax" />
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="#dimen/article_keylines"
android:paddingRight="#dimen/md_keylines"
android:paddingTop="#dimen/md_keylines">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?attr/colorAccent"
android:text="Description"
android:textSize="#dimen/md_keylines"
android:layout_marginBottom="#dimen/md_keylines" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/detail_desc" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?attr/colorAccent"
android:text="Location"
android:textSize="#dimen/article_titles"
android:layout_marginBottom="#dimen/md_keylines"
android:layout_marginTop="#dimen/md_keylines" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/detail_location" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
DetailActivity.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Support.Design.Widget;
using Android.Views;
using Android.Widget;
using Android.Support.V7.App;
using Android.Support.V7.Widget;
using Toolbar = Android.Support.V7.Widget.Toolbar;
namespace MaterialDesign
{
[Activity(ParentActivity = typeof(MainActivity))]
public class DetailActivity : AppCompatActivity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.activity_detail);
SetSupportActionBar(FindViewById<Toolbar>(Resource.Id.toolbar));
SupportActionBar.SetDisplayHomeAsUpEnabled(true);
CollapsingToolbarLayout collapsingToolbar =
FindViewById<CollapsingToolbarLayout>(Resource.Id.collapsing_toolbar);
collapsingToolbar.Title = GetString(Resource.String.item_title);
}
}
}
I also made this app native in Java using Android Studio and everything runs smooth there.
NOTE: The layout file is exactly the same as the one in the Android Studio project.
Any ideas what the problem could be?
UPDATE: I noticed that the app just crashes on devices with less memory than the ones I tested the app on (out of memory exception). This is the stack trace:
...
04-07 08:01:47.373 1193-1193/MaterialDesign.MaterialDesign D/Mono: Assembly Ref addref MaterialDesign[0xb9648460] -> Xamarin.Android.Support.v7.RecyclerView[0xb9634dc8]: 2
04-07 08:01:47.373 1193-1193/MaterialDesign.MaterialDesign D/Mono: Assembly Ref addref Xamarin.Android.Support.v7.RecyclerView[0xb9634dc8] -> Xamarin.Android.Support.v4[0xb9633e58]: 5
04-07 08:01:47.409 1193-1193/MaterialDesign.MaterialDesign D/libEGL: loaded /system/lib/egl/libEGL_genymotion.so
04-07 08:01:47.417 1193-1193/MaterialDesign.MaterialDesign D/libEGL: loaded /system/lib/egl/libGLESv1_CM_genymotion.so
04-07 08:01:47.421 1193-1193/MaterialDesign.MaterialDesign D/libEGL: loaded /system/lib/egl/libGLESv2_genymotion.so
04-07 08:01:47.457 1193-1193/MaterialDesign.MaterialDesign W/EGL_genymotion: eglSurfaceAttrib not implemented
04-07 08:01:47.473 1193-1193/MaterialDesign.MaterialDesign D/OpenGLRenderer: Enabling debug mode 0
04-07 08:01:47.493 1193-1195/MaterialDesign.MaterialDesign D/dalvikvm: GC_CONCURRENT freed 184K, 3% free 11139K/11463K, paused 11ms+0ms, total 14ms
04-07 08:01:47.493 1193-1193/MaterialDesign.MaterialDesign D/dalvikvm: GC_FOR_ALLOC freed 6K, 3% free 11136K/11463K, paused 3ms, total 3ms
04-07 08:01:47.497 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm-heap: Grow heap (frag case) to 12.511MB for 1638412-byte allocation
04-07 08:01:47.521 1193-1195/MaterialDesign.MaterialDesign D/dalvikvm: GC_CONCURRENT freed <1K, 3% free 12736K/13127K, paused 11ms+12ms, total 25ms
04-07 08:01:47.561 1193-1193/MaterialDesign.MaterialDesign D/dalvikvm: GC_FOR_ALLOC freed 0K, 3% free 12736K/13127K, paused 2ms, total 2ms
04-07 08:01:47.573 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm-heap: Grow heap (frag case) to 18.761MB for 6553612-byte allocation
04-07 08:01:47.609 1193-1195/MaterialDesign.MaterialDesign D/dalvikvm: GC_CONCURRENT freed 0K, 3% free 19136K/19591K, paused 11ms+0ms, total 36ms
04-07 08:01:47.717 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: Could not find method android.support.v7.widget.LinearLayoutCompat.drawableHotspotChanged, referenced from method android.support.design.internal.ForegroundLinearLayout.drawableHotspotChanged
04-07 08:01:47.717 1193-1193/MaterialDesign.MaterialDesign W/dalvikvm: VFY: unable to resolve virtual method 14829: Landroid/support/v7/widget/LinearLayoutCompat;.drawableHotspotChanged (FF)V
04-07 08:01:47.717 1193-1193/MaterialDesign.MaterialDesign D/dalvikvm: VFY: replacing opcode 0x6f at 0x0000
04-07 08:01:47.729 1193-1193/MaterialDesign.MaterialDesign D/Mono: Assembly Ref addref Xamarin.Android.Support.v7.AppCompat[0xb9621c20] -> System.Core[0xb9705298]: 3
04-07 08:01:47.789 1193-1193/MaterialDesign.MaterialDesign D/OpenGLRenderer: TextureCache::get: create texture(0xb9633ef0): name, size, mSize = 2, 9216, 9216
04-07 08:01:47.805 1193-1193/MaterialDesign.MaterialDesign D/OpenGLRenderer: TextureCache::get: create texture(0xb98f1880): name, size, mSize = 3, 9216, 18432
04-07 08:01:48.033 1193-1193/MaterialDesign.MaterialDesign D/OpenGLRenderer: TextureCache::get: create texture(0xb98da550): name, size, mSize = 4, 6553600, 6572032
04-07 08:01:48.097 1193-1193/MaterialDesign.MaterialDesign D/OpenGLRenderer: TextureCache::get: create texture(0xb95fafd8): name, size, mSize = 7, 1600, 6573632
04-07 08:01:48.321 1193-1193/MaterialDesign.MaterialDesign D/OpenGLRenderer: TextureCache::get: create texture(0xb98486b8): name, size, mSize = 13, 9216, 6582848
04-07 08:01:48.321 1193-1193/MaterialDesign.MaterialDesign D/OpenGLRenderer: TextureCache::get: create texture(0xb960b438): name, size, mSize = 14, 4096, 6586944
04-07 08:01:48.357 1193-1193/MaterialDesign.MaterialDesign I/Choreographer: Skipped 36 frames! The application may be doing too much work on its main thread.
04-07 08:02:41.493 1193-1193/MaterialDesign.MaterialDesign D/OpenGLRenderer: TextureCache::get: create texture(0xb95ef230): name, size, mSize = 222, 1127520, 7714464
04-07 08:02:41.505 1193-1193/MaterialDesign.MaterialDesign D/OpenGLRenderer: TextureCache::get: create texture(0xb95ee6e8): name, size, mSize = 223, 100224, 7814688
04-07 08:02:47.293 1193-1193/MaterialDesign.MaterialDesign D/OpenGLRenderer: TextureCache::get: create texture(0xb95e7f10): name, size, mSize = 345, 576, 7815264
04-07 08:02:47.401 1193-1193/MaterialDesign.MaterialDesign D/dalvikvm: GC_FOR_ALLOC freed 1797K, 10% free 17775K/19655K, paused 5ms, total 5ms
04-07 08:02:47.405 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm-heap: Grow heap (frag case) to 28.633MB for 11746016-byte allocation
04-07 08:02:47.421 1193-1195/MaterialDesign.MaterialDesign D/dalvikvm: GC_CONCURRENT freed 13K, 7% free 29232K/31175K, paused 11ms+0ms, total 14ms
04-07 08:02:47.597 1193-1193/MaterialDesign.MaterialDesign D/dalvikvm: GC_FOR_ALLOC freed 0K, 7% free 29232K/31175K, paused 2ms, total 2ms
04-07 08:02:47.597 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm-heap: Forcing collection of SoftReferences for 46984028-byte allocation
04-07 08:02:47.601 1193-1193/MaterialDesign.MaterialDesign D/dalvikvm: GC_BEFORE_OOM freed 9K, 7% free 29222K/31175K, paused 6ms, total 6ms
04-07 08:02:47.601 1193-1193/MaterialDesign.MaterialDesign E/dalvikvm-heap: Out of memory on a 46984028-byte allocation.
04-07 08:02:47.601 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: "main" prio=5 tid=1 RUNNABLE
04-07 08:02:47.601 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: | group="main" sCount=0 dsCount=0 obj=0xa622e4b0 self=0xb951e510
04-07 08:02:47.601 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: | sysTid=1193 nice=0 sched=0/0 cgrp=[fopen-error:2] handle=-1217354688
04-07 08:02:47.601 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: | schedstat=( 2330495687 1274137896 5442 ) utm=171 stm=61 core=0
04-07 08:02:47.601 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
04-07 08:02:47.601 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:500)
04-07 08:02:47.601 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:353)
04-07 08:02:47.601 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:781)
04-07 08:02:47.601 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at android.content.res.Resources.loadDrawable(Resources.java:1930)
04-07 08:02:47.601 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
04-07 08:02:47.601 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at android.view.View.<init>(View.java:3336)
04-07 08:02:47.601 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at android.widget.ImageView.<init>(ImageView.java:114)
04-07 08:02:47.601 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:58)
04-07 08:02:47.601 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:54)
04-07 08:02:47.601 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:95)
04-07 08:02:47.601 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at android.support.v7.app.AppCompatDelegateImplV7.createView(AppCompatDelegateImplV7.java:938)
04-07 08:02:47.605 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at android.support.v7.app.AppCompatDelegateImplV7.onCreateView(AppCompatDelegateImplV7.java:992)
04-07 08:02:47.605 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44)
04-07 08:02:47.605 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:675)
04-07 08:02:47.605 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
04-07 08:02:47.605 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
04-07 08:02:47.605 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
04-07 08:02:47.605 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
04-07 08:02:47.605 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
04-07 08:02:47.605 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
04-07 08:02:47.605 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:256)
04-07 08:02:47.605 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
04-07 08:02:47.605 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at md5cdedf066eabae933cf5b8144b87f883b.DetailActivity.n_onCreate(Native Method)
04-07 08:02:47.605 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at md5cdedf066eabae933cf5b8144b87f883b.DetailActivity.onCreate(DetailActivity.java:28)
04-07 08:02:47.605 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at android.app.Activity.performCreate(Activity.java:5008)
04-07 08:02:47.605 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
04-07 08:02:47.605 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
04-07 08:02:47.605 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
04-07 08:02:47.605 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at android.app.ActivityThread.access$600(ActivityThread.java:130)
04-07 08:02:47.605 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
04-07 08:02:47.605 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at android.os.Handler.dispatchMessage(Handler.java:99)
04-07 08:02:47.605 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at android.os.Looper.loop(Looper.java:137)
04-07 08:02:47.605 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at android.app.ActivityThread.main(ActivityThread.java:4745)
04-07 08:02:47.605 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at java.lang.reflect.Method.invokeNative(Native Method)
04-07 08:02:47.605 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at java.lang.reflect.Method.invoke(Method.java:511)
04-07 08:02:47.605 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
04-07 08:02:47.605 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
04-07 08:02:47.605 1193-1193/MaterialDesign.MaterialDesign I/dalvikvm: at dalvik.system.NativeStart.main(Native Method)
04-07 08:02:47.605 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: Stacktrace:
04-07 08:02:47.605 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at <unknown> <0xffffffff>
04-07 08:02:47.605 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at (wrapper managed-to-native) object.wrapper_native_0xb66e1b90 (intptr,intptr,intptr,intptr,Android.Runtime.JValue*) <0xffffffff>
04-07 08:02:47.605 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (intptr,intptr,intptr,Android.Runtime.JValue*) <0x0008d>
04-07 08:02:47.605 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at Android.App.Activity.SetContentView (int) <0x0014f>
04-07 08:02:47.605 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at MaterialDesign.DetailActivity.OnCreate (Android.OS.Bundle) <0x0002e>
04-07 08:02:47.605 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at Android.Support.V4.App.FragmentActivity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) <0x00057>
04-07 08:02:47.605 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at (wrapper dynamic-method) object.f3681e7a-16a5-436b-bfa3-c04082252994 (intptr,intptr,intptr) <0x00027>
04-07 08:02:47.605 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at (wrapper native-to-managed) object.f3681e7a-16a5-436b-bfa3-c04082252994 (intptr,intptr,intptr) <0xffffffff>
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+377510 [0xb6d302a6]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+354302 [0xb6d2a7fe]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+440759 [0xb6d3f9b7]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+410143 [0xb6d3821f]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+837579 [0xb6da07cb]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+838916 [0xb6da0d04]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+567193 [0xb6d5e799]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+574224 [0xb6d60310]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+535528 [0xb6d56be8]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+490340 [0xb6d4bb64]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+462504 [0xb6d44ea8]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+471496 [0xb6d471c8]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+669154 [0xb700b5e2]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+671378 [0xb700be92]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+110240 [0xb66b6ea0]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+395513 [0xb66fc8f9]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+811016 [0xb6762008]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+168966 [0xb66c5406]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+157136 [0xb66c25d0]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+595124 [0xb672d4b4]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+385144 [0xb66fa078]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+285799 [0xb66e1c67]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+80308 [0x9302f9b4]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+79742 [0x9302f77e]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+128672 [0x9303b6a0]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+169583 [0x9304566f]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+126736 [0x9303af10]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+288 [0x93053120]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+91608 [0x930325d8]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+110240 [0xb66b6ea0]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+395513 [0xb66fc8f9]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+811016 [0xb6762008]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+168966 [0xb66c5406]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+157136 [0xb66c25d0]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+594202 [0xb672d11a]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+663802 [0xb673e0fa]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+811016 [0xb6762008]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+168966 [0xb66c5406]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+157136 [0xb66c25d0]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+595833 [0xb672d779]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+403306 [0xb66fe76a]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+344986 [0xb6fbc39a]
04-07 08:02:47.609 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+349705 [0xb6fbd609]
04-07 08:02:47.613 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+4599 [0xb770c1f7]
04-07 08:02:47.613 1193-1193/MaterialDesign.MaterialDesign E/mono-rt: at ???+94767 [0xb750022f]
04-07 08:02:47.613 1193-1193/MaterialDesign.MaterialDesign A/libc: Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 1193 (.MaterialDesign)
Line 28 in DetailActivity is this one:
SetContentView(Resource.Layout.activity_detail);
try to set Java heap size to 1G
Right click on project -> Options -> Android Builds -> Advanced
Related
when i click on button open another activity that is tab host activity but in my case when i click on button nothing to display and i didn't get any error.just blank screen display. below is log cat
04-12 15:16:30.799 25332-25332/? D/dalvikvm: Not late-enabling CheckJNI (already on)
04-12 15:16:35.129 25332-25332/com.novityrecharge E/Trace: error opening trace file: No such file or directory (2)
04-12 15:16:36.969 25332-25332/com.novityrecharge D/ImageLoader: Initialize ImageLoader with configuration
04-12 15:16:37.488 25332-25335/com.novityrecharge D/dalvikvm: GC_CONCURRENT freed 211K, 8% free 5458K/5895K, paused 152ms+4ms, total 416ms
04-12 15:16:37.521 25332-25332/com.novityrecharge W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/view/SearchEvent;)
04-12 15:16:37.521 25332-25332/com.novityrecharge I/dalvikvm: Could not find method android.view.Window$Callback.onSearchRequested, referenced from method android.support.v7.view.WindowCallbackWrapper.onSearchRequested
04-12 15:16:37.528 25332-25332/com.novityrecharge W/dalvikvm: VFY: unable to resolve interface method 18180: Landroid/view/Window$Callback;.onSearchRequested (Landroid/view/SearchEvent;)Z
04-12 15:16:37.528 25332-25332/com.novityrecharge D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
04-12 15:16:37.528 25332-25332/com.novityrecharge I/dalvikvm: Could not find method android.view.Window$Callback.onWindowStartingActionMode, referenced from method android.support.v7.view.WindowCallbackWrapper.onWindowStartingActionMode
04-12 15:16:37.528 25332-25332/com.novityrecharge W/dalvikvm: VFY: unable to resolve interface method 18184: Landroid/view/Window$Callback;.onWindowStartingActionMode (Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
04-12 15:16:37.528 25332-25332/com.novityrecharge D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
04-12 15:16:37.839 25332-25332/com.novityrecharge D/dalvikvm: GC_FOR_ALLOC freed 43K, 7% free 5497K/5895K, paused 32ms, total 33ms
04-12 15:16:37.866 25332-25332/com.novityrecharge I/dalvikvm-heap: Grow heap (frag case) to 6.242MB for 685600-byte allocation
04-12 15:16:37.908 25332-25335/com.novityrecharge D/dalvikvm: GC_CONCURRENT freed <1K, 7% free 6166K/6599K, paused 13ms+3ms, total 41ms
04-12 15:16:38.079 25332-25332/com.novityrecharge D/dalvikvm: GC_FOR_ALLOC freed 0K, 7% free 6166K/6599K, paused 116ms, total 116ms
04-12 15:16:38.152 25332-25332/com.novityrecharge I/dalvikvm-heap: Grow heap (frag case) to 6.611MB for 386900-byte allocation
04-12 15:16:38.339 25332-25338/com.novityrecharge D/dalvikvm: GC_FOR_ALLOC freed 0K, 7% free 6544K/6983K, paused 171ms, total 171ms
04-12 15:16:38.349 25332-25332/com.novityrecharge I/dalvikvm: Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.widget.TintTypedArray.getChangingConfigurations
04-12 15:16:38.349 25332-25332/com.novityrecharge W/dalvikvm: VFY: unable to resolve virtual method 460: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
04-12 15:16:38.349 25332-25332/com.novityrecharge D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
04-12 15:16:38.378 25332-25332/com.novityrecharge I/dalvikvm: Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.widget.TintTypedArray.getType
04-12 15:16:38.378 25332-25332/com.novityrecharge W/dalvikvm: VFY: unable to resolve virtual method 482: Landroid/content/res/TypedArray;.getType (I)I
04-12 15:16:38.378 25332-25332/com.novityrecharge D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
04-12 15:16:39.068 25332-25332/com.novityrecharge D/libEGL: loaded /system/lib/egl/libEGL_emulation.so
04-12 15:16:39.089 25332-25332/com.novityrecharge D/libEGL: loaded /system/lib/egl/libGLESv1_CM_emulation.so
04-12 15:16:39.154 25332-25332/com.novityrecharge D/libEGL: loaded /system/lib/egl/libGLESv2_emulation.so
04-12 15:16:39.418 25332-25332/com.novityrecharge D/: HostConnection::get() New Host Connection established 0x2a12c998, tid 25332
04-12 15:16:41.112 25332-25332/com.novityrecharge W/EGL_emulation: eglSurfaceAttrib not implemented
04-12 15:16:41.300 25332-25332/com.novityrecharge D/OpenGLRenderer: Enabling debug mode 0
04-12 15:16:41.333 25332-25332/com.novityrecharge I/Choreographer: Skipped 159 frames! The application may be doing too much work on its main thread.
04-12 15:16:42.806 25332-25332/com.novityrecharge I/Choreographer: Skipped 80 frames! The application may be doing too much work on its main thread.
04-12 15:16:44.440 25332-25332/com.novityrecharge I/dalvikvm: Could not find method android.content.res.Resources.getDrawable, referenced from method android.support.v7.widget.ResourcesWrapper.getDrawable
04-12 15:16:44.440 25332-25332/com.novityrecharge W/dalvikvm: VFY: unable to resolve virtual method 423: Landroid/content/res/Resources;.getDrawable (ILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
04-12 15:16:44.449 25332-25332/com.novityrecharge D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
04-12 15:16:44.449 25332-25332/com.novityrecharge I/dalvikvm: Could not find method android.content.res.Resources.getDrawableForDensity, referenced from method android.support.v7.widget.ResourcesWrapper.getDrawableForDensity
04-12 15:16:44.459 25332-25332/com.novityrecharge W/dalvikvm: VFY: unable to resolve virtual method 425: Landroid/content/res/Resources;.getDrawableForDensity (IILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
04-12 15:16:44.459 25332-25332/com.novityrecharge D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
04-12 15:16:44.878 25332-25332/com.novityrecharge D/text: 1234
04-12 15:16:44.888 25332-25332/com.novityrecharge I/Choreographer: Skipped 76 frames! The application may be doing too much work on its main thread.
04-12 15:16:45.818 25332-25332/com.novityrecharge W/EGL_emulation: eglSurfaceAttrib not implemented
04-12 15:16:46.054 25332-25332/com.novityrecharge I/Choreographer: Skipped 68 frames! The application may be doing too much work on its main thread.
04-12 15:16:47.792 25332-25332/com.novityrecharge I/Choreographer: Skipped 103 frames! The application may be doing too much work on its main thread.
04-12 15:16:52.486 25332-25332/com.novityrecharge D/AndroidRuntime: Shutting down VM
04-12 15:16:52.486 25332-25332/com.novityrecharge W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x40a122a0)
04-12 15:16:53.159 25332-25335/com.novityrecharge D/dalvikvm: GC_CONCURRENT freed 852K, 16% free 6114K/7239K, paused 84ms+16ms, total 171ms
04-12 15:20:41.062 25332-25337/com.novityrecharge I/dalvikvm: threadid=3: reacting to signal 3
04-12 15:20:41.589 25332-25337/com.novityrecharge I/dalvikvm: Wrote stack traces to '/data/anr/traces.txt'
SMSActivityTab.java
public class SMSActivityTab extends AppCompatActivity {
TabHost myTabHost;
// LocalActivityManager mlam;
TabWidget tw;
#Override
protected void onCreate(#Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.smsactivitytab);
if(!(Thread.getDefaultUncaughtExceptionHandler() instanceof ExceptionHandler))
{
Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler(this,"LoginActivity"));
}
//mlam = new LocalActivityManager(this, false);
// mlam.dispatchCreate(savedInstanceState);
myTabHost =(TabHost) findViewById(android.R.id.tabhost);
myTabHost.setup();
TabHost.TabSpec prepaid = myTabHost.newTabSpec("tab1");
TabHost.TabSpec dth = myTabHost.newTabSpec("tab2");
TabHost.TabSpec postpaid = myTabHost.newTabSpec("tab3");
//Below name is display on screen
prepaid.setIndicator(getResources().getString(R.string.lbl_prepaidrecharge));
prepaid.setContent(new Intent(SMSActivityTab.this, SMSPrepaid.class));
dth.setIndicator(getResources().getString(R.string.lbl_dthrecharge));
dth.setContent(new Intent(SMSActivityTab.this, SMSDTH.class));
postpaid.setIndicator(getResources().getString(R.string.lbl_prepaidrecharge));
postpaid.setContent(new Intent(SMSActivityTab.this, SMSPostpaid.class));
myTabHost.addTab(prepaid);
myTabHost.addTab(dth);
myTabHost.addTab(postpaid);
myTabHost.setCurrentTab(0);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu_main, menu);
return true;
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
// action with ID action_refresh was selected
case R.id.action_signout:
BaseActivity.logout(SMSActivityTab.this);
default:
return super.onOptionsItemSelected(item);
}
}
#Override
public void onBackPressed() {
Intent intent = new Intent(SMSActivityTab.this, LoginActivity.class);
startActivity(intent);
finish();
}
#Override
protected void onResume(){
super.onResume();
//mlam.dispatchResume();
}
#Override
protected void onPause(){
super.onPause();
//mlam.dispatchPause(isFinishing());
}
}
smsactivitytab.xml
<?xml version="1.0" encoding="utf-8"?>
<TabHost
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="5dp">
<TabWidget
android:id="#android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp" />
</LinearLayout>
</TabHost>
i think you problem is on this line
myTabHost =(TabHost) findViewById(android.R.id.tabhost);
you need to change this line to
myTabHost =(TabHost) findViewById(android.R.id.tabs);
Following is my imageview. I am using it in listview but app is crashing at startup.When I set layout width and height to wrap_content it is working but big images are shown as property is wrap_content. Please help
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:id="#+id/imgView"/>
Following is logcat:
12-29 17:47:24.803 15424-15424/? D/dalvikvm: Not late-enabling CheckJNI (already on)
12-29 17:47:24.843 15424-15424/com.example.parsaniahardik.listviewwithimage E/Trace: error opening trace file: No such file or directory (2)
12-29 17:47:24.884 15424-15424/com.example.parsaniahardik.listviewwithimage W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/view/SearchEvent;)
12-29 17:47:24.884 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: Could not find method android.view.Window$Callback.onSearchRequested, referenced from method android.support.v7.view.WindowCallbackWrapper.onSearchRequested
12-29 17:47:24.884 15424-15424/com.example.parsaniahardik.listviewwithimage W/dalvikvm: VFY: unable to resolve interface method 14515: Landroid/view/Window$Callback;.onSearchRequested (Landroid/view/SearchEvent;)Z
12-29 17:47:24.884 15424-15424/com.example.parsaniahardik.listviewwithimage D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
12-29 17:47:24.884 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: Could not find method android.view.Window$Callback.onWindowStartingActionMode, referenced from method android.support.v7.view.WindowCallbackWrapper.onWindowStartingActionMode
12-29 17:47:24.884 15424-15424/com.example.parsaniahardik.listviewwithimage W/dalvikvm: VFY: unable to resolve interface method 14519: Landroid/view/Window$Callback;.onWindowStartingActionMode (Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
12-29 17:47:24.884 15424-15424/com.example.parsaniahardik.listviewwithimage D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
12-29 17:47:24.924 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: Could not find method android.view.ViewGroup.onRtlPropertiesChanged, referenced from method android.support.v7.widget.Toolbar.onRtlPropertiesChanged
12-29 17:47:24.924 15424-15424/com.example.parsaniahardik.listviewwithimage W/dalvikvm: VFY: unable to resolve virtual method 14415: Landroid/view/ViewGroup;.onRtlPropertiesChanged (I)V
12-29 17:47:24.924 15424-15424/com.example.parsaniahardik.listviewwithimage D/dalvikvm: VFY: replacing opcode 0x6f at 0x0007
12-29 17:47:24.924 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.widget.TintTypedArray.getChangingConfigurations
12-29 17:47:24.924 15424-15424/com.example.parsaniahardik.listviewwithimage W/dalvikvm: VFY: unable to resolve virtual method 407: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
12-29 17:47:24.924 15424-15424/com.example.parsaniahardik.listviewwithimage D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
12-29 17:47:24.924 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.widget.TintTypedArray.getType
12-29 17:47:24.924 15424-15424/com.example.parsaniahardik.listviewwithimage W/dalvikvm: VFY: unable to resolve virtual method 429: Landroid/content/res/TypedArray;.getType (I)I
12-29 17:47:24.924 15424-15424/com.example.parsaniahardik.listviewwithimage D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
12-29 17:47:25.044 15424-15429/com.example.parsaniahardik.listviewwithimage D/dalvikvm: GC_CONCURRENT freed 195K, 3% free 8160K/8391K, paused 14ms+0ms, total 36ms
12-29 17:47:25.083 15424-15424/com.example.parsaniahardik.listviewwithimage D/dalvikvm: GC_FOR_ALLOC freed 7K, 3% free 8159K/8391K, paused 4ms, total 4ms
12-29 17:47:25.083 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm-heap: Grow heap (frag case) to 9.831MB for 1920012-byte allocation
12-29 17:47:25.104 15424-15429/com.example.parsaniahardik.listviewwithimage D/dalvikvm: GC_CONCURRENT freed <1K, 3% free 10034K/10311K, paused 0ms+0ms, total 6ms
12-29 17:47:25.154 15424-15424/com.example.parsaniahardik.listviewwithimage D/dalvikvm: GC_FOR_ALLOC freed 0K, 3% free 10034K/10311K, paused 0ms, total 5ms
12-29 17:47:25.154 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm-heap: Grow heap (frag case) to 13.950MB for 4320012-byte allocation
12-29 17:47:25.173 15424-15429/com.example.parsaniahardik.listviewwithimage D/dalvikvm: GC_CONCURRENT freed 0K, 2% free 14253K/14535K, paused 14ms+1ms, total 18ms
12-29 17:47:25.253 15424-15424/com.example.parsaniahardik.listviewwithimage D/dalvikvm: GC_FOR_ALLOC freed 1875K, 15% free 12385K/14535K, paused 3ms, total 5ms
12-29 17:47:25.253 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm-heap: Grow heap (frag case) to 15.125MB for 3145740-byte allocation
12-29 17:47:25.284 15424-15429/com.example.parsaniahardik.listviewwithimage D/dalvikvm: GC_CONCURRENT freed <1K, 13% free 15456K/17671K, paused 18ms+0ms, total 24ms
12-29 17:47:25.414 15424-15424/com.example.parsaniahardik.listviewwithimage D/dalvikvm: GC_FOR_ALLOC freed <1K, 13% free 15456K/17671K, paused 10ms, total 10ms
12-29 17:47:25.433 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm-heap: Grow heap (frag case) to 21.875MB for 7077900-byte allocation
12-29 17:47:25.454 15424-15429/com.example.parsaniahardik.listviewwithimage D/dalvikvm: GC_CONCURRENT freed 0K, 10% free 22368K/24647K, paused 16ms+1ms, total 21ms
12-29 17:47:25.574 15424-15424/com.example.parsaniahardik.listviewwithimage D/dalvikvm: GC_FOR_ALLOC freed 3072K, 17% free 20503K/24647K, paused 5ms, total 6ms
12-29 17:47:25.574 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm-heap: Grow heap (frag case) to 22.690MB for 2764812-byte allocation
12-29 17:47:25.604 15424-15429/com.example.parsaniahardik.listviewwithimage D/dalvikvm: GC_CONCURRENT freed <1K, 6% free 23202K/24647K, paused 20ms+1ms, total 24ms
12-29 17:47:25.643 15424-15424/com.example.parsaniahardik.listviewwithimage D/dalvikvm: GC_FOR_ALLOC freed 1200K, 11% free 22009K/24647K, paused 7ms, total 7ms
12-29 17:47:25.643 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm-heap: Grow heap (frag case) to 24.525MB for 3145740-byte allocation
12-29 17:47:25.664 15424-15429/com.example.parsaniahardik.listviewwithimage D/dalvikvm: GC_CONCURRENT freed <1K, 10% free 25081K/27783K, paused 14ms+1ms, total 19ms
12-29 17:47:25.713 15424-15424/com.example.parsaniahardik.listviewwithimage D/dalvikvm: GC_FOR_ALLOC freed 0K, 10% free 25081K/27783K, paused 4ms, total 4ms
12-29 17:47:25.713 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm-heap: Forcing collection of SoftReferences for 7077900-byte allocation
12-29 17:47:25.723 15424-15424/com.example.parsaniahardik.listviewwithimage D/dalvikvm: GC_BEFORE_OOM freed 9K, 10% free 25071K/27783K, paused 10ms, total 10ms
12-29 17:47:25.733 15424-15424/com.example.parsaniahardik.listviewwithimage E/dalvikvm-heap: Out of memory on a 7077900-byte allocation.
12-29 17:47:25.733 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: "main" prio=5 tid=1 RUNNABLE
12-29 17:47:25.733 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: | group="main" sCount=0 dsCount=0 obj=0xb4f3e4b0 self=0xb8c804e0
12-29 17:47:25.733 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: | sysTid=15424 nice=0 sched=0/0 cgrp=[fopen-error:2] handle=-1207602112
12-29 17:47:25.733 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: | schedstat=( 0 0 0 ) utm=39 stm=6 core=0
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:500)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:353)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:781)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.content.res.Resources.loadDrawable(Resources.java:1930)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.content.res.Resources.getDrawable(Resources.java:659)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:323)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.support.v7.widget.TintManager.getDrawable(TintManager.java:175)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.support.v7.widget.TintManager.getDrawable(TintManager.java:168)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.support.v7.widget.AppCompatImageHelper.setImageResource(AppCompatImageHelper.java:51)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.support.v7.widget.AppCompatImageView.setImageResource(AppCompatImageView.java:72)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at com.example.parsaniahardik.listviewwithimage.CustomListAdapter.getView(CustomListAdapter.java:46)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.widget.AbsListView.obtainView(AbsListView.java:2251)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.widget.ListView.measureHeightOfChildren(ListView.java:1244)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.widget.ListView.onMeasure(ListView.java:1156)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.view.View.measure(View.java:15172)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:617)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:399)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.view.View.measure(View.java:15172)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4814)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:135)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.view.View.measure(View.java:15172)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4814)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.support.v7.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:391)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.view.View.measure(View.java:15172)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4814)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.view.View.measure(View.java:15172)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4814)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1390)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.widget.LinearLayout.measureVertical(LinearLayout.java:681)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.widget.LinearLayout.onMeasure(LinearLayout.java:574)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.view.View.measure(View.java:15172)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4814)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2148)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.view.View.measure(View.java:15172)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1848)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1100)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1273)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:998)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4212)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.view.Choreographer.doCallbacks(Choreographer.java:555)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.view.Choreographer.doFrame(Choreographer.java:525)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.os.Handler.handleCallback(Handler.java:615)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.os.Handler.dispatchMessage(Handler.java:92)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.os.Looper.loop(Looper.java:137)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at android.app.ActivityThread.main(ActivityThread.java:4745)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at java.lang.reflect.Method.invokeNative(Native Method)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at java.lang.reflect.Method.invoke(Method.java:511)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage I/dalvikvm: at dalvik.system.NativeStart.main(Native Method)
12-29 17:47:25.743 15424-15424/com.example.parsaniahardik.listviewwithimage A/libc: Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 15424 (stviewwithimage)
You have an out of memory exception,I dont know the exact value,but when you load a bitmap in to the memory it takes the space like width*height*3 MB due to loading large bitmaps in memory like this the app runs out of memory and crashes,You may think that the reducing the size of the ImageView may fix this issue. But NO! that's only the size of the View not the bitmap.What you want to do is to somehow scale your image and then load it to the ImageView or use views like RecycleView in your app
Use the following code snippets for compressing the image,source: Displaying Bitmaps Efficiently
public static Bitmap decodeSampledBitmapFromFile(String path,
int reqWidth, int reqHeight) {
// First decode with inJustDecodeBounds=true to check dimensions
final BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(path, options);
// Calculate inSampleSize
options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight);
// Decode bitmap with inSampleSize set
options.inJustDecodeBounds = false;
return BitmapFactory.decodeFile(path, options);
}
Calculating sample size:
public static int calculateInSampleSize(
BitmapFactory.Options options, int reqWidth, int reqHeight) {
// Raw height and width of image
final int height = options.outHeight;
final int width = options.outWidth;
int inSampleSize = 1;
if (height > reqHeight || width > reqWidth) {
final int halfHeight = height / 2;
final int halfWidth = width / 2;
// Calculate the largest inSampleSize value that is a power of 2 and keeps both
// height and width larger than the requested height and width.
while ((halfHeight / inSampleSize) > reqHeight
&& (halfWidth / inSampleSize) > reqWidth) {
inSampleSize *= 2;
}
}
return inSampleSize;
}
In your case if you want to load the file image1.jpg to an ImageView of size 50x50 call the function like
Bitmap b=decodeSampledBitmapFromFile(path,50,50)
and set it to imageView like:
ImageView.setImageBitmap(b);
if you are using raw images
check whether height and width of image used to set in this ImageView is too large. if its size is large use image with small size.
When large images are set on small ImageViews it causes outofmemmory error.
Use this link to resize images to http://romannurik.github.io/AndroidAssetStudio/index.html
I want to add customized action bar in my Filter Activity which is a PreferenceActivity.
Can I use addPreferencesFromResource() method with ActionBarActivity ???
Every thing is working fine as my java file and xml file is correct. But there is no action bar, and when i attempt to call getActionBar().setBackgroundDrawable(R.drawable.xyz); there is a crash.
Please help me out.
here is my java code of the preference screen
import android.graphics.drawable.Drawable;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.preference.PreferenceActivity;
public class Filter extends PreferenceActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.filter_screen);
Drawable d=getResources().getDrawable(R.drawable.abfilter);
getActionBar().setBackgroundDrawable(d);
}
}
here is the logcat
11-22 16:18:13.377 7460-7460/com.example.avinash.swipetab D/dalvikvm﹕ Late-enabling CheckJNI
11-22 16:18:13.481 7460-7460/com.example.avinash.swipetab W/ActivityThread﹕ Application com.example.avinash.swipetab is waiting for the debugger on port 8100...
11-22 16:18:13.487 7460-7460/com.example.avinash.swipetab I/System.out﹕ Sending WAIT chunk
11-22 16:18:13.494 7460-7468/com.example.avinash.swipetab I/dalvikvm﹕ Debugger is active
11-22 16:18:13.687 7460-7460/com.example.avinash.swipetab I/System.out﹕ Debugger has connected
11-22 16:18:13.688 7460-7460/com.example.avinash.swipetab I/System.out﹕ waiting for debugger to settle...
11-22 16:18:13.888 7460-7460/com.example.avinash.swipetab I/System.out﹕ waiting for debugger to settle...
11-22 16:18:14.088 7460-7460/com.example.avinash.swipetab I/System.out﹕ waiting for debugger to settle...
11-22 16:18:14.289 7460-7460/com.example.avinash.swipetab I/System.out﹕ waiting for debugger to settle...
11-22 16:18:14.489 7460-7460/com.example.avinash.swipetab I/System.out﹕ waiting for debugger to settle...
11-22 16:18:14.689 7460-7460/com.example.avinash.swipetab I/System.out﹕ waiting for debugger to settle...
11-22 16:18:14.889 7460-7460/com.example.avinash.swipetab I/System.out﹕ waiting for debugger to settle...
11-22 16:18:15.090 7460-7460/com.example.avinash.swipetab I/System.out﹕ waiting for debugger to settle...
11-22 16:18:15.290 7460-7460/com.example.avinash.swipetab I/System.out﹕ debugger has settled (1413)
11-22 16:18:15.713 7460-7460/com.example.avinash.swipetab I/dalvikvm﹕ Could not find method android.view.ViewGroup.onNestedScrollAccepted, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.onNestedScrollAccepted
11-22 16:18:15.713 7460-7460/com.example.avinash.swipetab W/dalvikvm﹕ VFY: unable to resolve virtual method 11365: Landroid/view/ViewGroup;.onNestedScrollAccepted (Landroid/view/View;Landroid/view/View;I)V
11-22 16:18:15.713 7460-7460/com.example.avinash.swipetab D/dalvikvm﹕ VFY: replacing opcode 0x6f at 0x0000
11-22 16:18:15.714 7460-7460/com.example.avinash.swipetab I/dalvikvm﹕ Could not find method android.view.ViewGroup.onStopNestedScroll, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.onStopNestedScroll
11-22 16:18:15.714 7460-7460/com.example.avinash.swipetab W/dalvikvm﹕ VFY: unable to resolve virtual method 11371: Landroid/view/ViewGroup;.onStopNestedScroll (Landroid/view/View;)V
11-22 16:18:15.714 7460-7460/com.example.avinash.swipetab D/dalvikvm﹕ VFY: replacing opcode 0x6f at 0x0000
11-22 16:18:15.716 7460-7460/com.example.avinash.swipetab I/dalvikvm﹕ Could not find method android.support.v7.internal.widget.ActionBarOverlayLayout.stopNestedScroll, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.setHideOnContentScrollEnabled
11-22 16:18:15.716 7460-7460/com.example.avinash.swipetab W/dalvikvm﹕ VFY: unable to resolve virtual method 9059: Landroid/support/v7/internal/widget/ActionBarOverlayLayout;.stopNestedScroll ()V
11-22 16:18:15.716 7460-7460/com.example.avinash.swipetab D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x000e
11-22 16:18:15.734 7460-7460/com.example.avinash.swipetab I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.internal.widget.TintTypedArray.getChangingConfigurations
11-22 16:18:15.734 7460-7460/com.example.avinash.swipetab W/dalvikvm﹕ VFY: unable to resolve virtual method 367: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
11-22 16:18:15.734 7460-7460/com.example.avinash.swipetab D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
11-22 16:18:15.736 7460-7460/com.example.avinash.swipetab I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.internal.widget.TintTypedArray.getType
11-22 16:18:15.736 7460-7460/com.example.avinash.swipetab W/dalvikvm﹕ VFY: unable to resolve virtual method 389: Landroid/content/res/TypedArray;.getType (I)I
11-22 16:18:15.736 7460-7460/com.example.avinash.swipetab D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
11-22 16:18:15.886 7460-7460/com.example.avinash.swipetab D/dalvikvm﹕ GC_FOR_ALLOC freed 177K, 10% free 3028K/3328K, paused 10ms, total 10ms
11-22 16:18:15.887 7460-7460/com.example.avinash.swipetab I/dalvikvm-heap﹕ Grow heap (frag case) to 3.681MB for 635812-byte allocation
11-22 16:18:15.900 7460-7473/com.example.avinash.swipetab D/dalvikvm﹕ GC_FOR_ALLOC freed 8K, 8% free 3640K/3952K, paused 8ms, total 8ms
11-22 16:18:16.124 7460-7460/com.example.avinash.swipetab D/dalvikvm﹕ GC_FOR_ALLOC freed 49K, 6% free 4040K/4272K, paused 10ms, total 10ms
11-22 16:18:16.155 7460-7460/com.example.avinash.swipetab D/dalvikvm﹕ GC_FOR_ALLOC freed 323K, 13% free 3897K/4448K, paused 8ms, total 8ms
11-22 16:18:16.220 7460-7460/com.example.avinash.swipetab D/dalvikvm﹕ GC_FOR_ALLOC freed 1K, 6% free 4220K/4448K, paused 9ms, total 9ms
11-22 16:18:16.256 7460-7460/com.example.avinash.swipetab D/dalvikvm﹕ GC_FOR_ALLOC freed 318K, 12% free 4227K/4768K, paused 9ms, total 9ms
11-22 16:18:16.297 7460-7460/com.example.avinash.swipetab D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 5% free 4550K/4768K, paused 9ms, total 9ms
11-22 16:18:16.375 7460-7460/com.example.avinash.swipetab D/dalvikvm﹕ GC_FOR_ALLOC freed 1K, 4% free 4887K/5088K, paused 9ms, total 9ms
11-22 16:18:16.436 7460-7460/com.example.avinash.swipetab D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 4% free 5217K/5408K, paused 9ms, total 9ms
11-22 16:18:16.584 7460-7460/com.example.avinash.swipetab D/dalvikvm﹕ GC_FOR_ALLOC freed 1K, 3% free 5889K/6048K, paused 9ms, total 9ms
11-22 16:18:16.641 7460-7460/com.example.avinash.swipetab E/﹕ appName=com.example.avinash.swipetab, acAppName=/system/bin/surfaceflinger
11-22 16:18:16.641 7460-7460/com.example.avinash.swipetab E/﹕ 0
11-22 16:18:16.645 7460-7460/com.example.avinash.swipetab I/MaliEGL﹕ [Mali]window_type=1, is_framebuffer=0, errnum = 0
11-22 16:18:16.645 7460-7460/com.example.avinash.swipetab I/MaliEGL﹕ [Mali]surface->num_buffers=4, surface->num_frames=3, win_min_undequeued=1
11-22 16:18:16.645 7460-7460/com.example.avinash.swipetab I/MaliEGL﹕ [Mali]max_allowed_dequeued_buffers=3
11-22 16:18:16.649 7460-7460/com.example.avinash.swipetab D/OpenGLRenderer﹕ Enabling debug mode 0
11-22 16:18:17.386 7460-7460/com.example.avinash.swipetab D/dalvikvm﹕ GC_FOR_ALLOC freed 173K, 5% free 6246K/6544K, paused 10ms, total 10ms
11-22 16:18:17.471 7460-7460/com.example.avinash.swipetab D/dalvikvm﹕ GC_FOR_ALLOC freed 32K, 5% free 6989K/7312K, paused 9ms, total 9ms
11-22 16:18:17.572 7460-7460/com.example.avinash.swipetab I/Choreographer﹕ Skipped 94 frames! The application may be doing too much work on its main thread.
11-22 16:18:21.307 7460-7460/com.example.avinash.swipetab D/dalvikvm﹕ GC_FOR_ALLOC freed 94K, 3% free 8280K/8500K, paused 12ms, total 12ms
11-22 16:18:21.451 7460-7460/com.example.avinash.swipetab D/AndroidRuntime﹕ Shutting down VM
11-22 16:18:21.451 7460-7460/com.example.avinash.swipetab W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41541ba8)
11-22 16:18:21.467 7460-7460/com.example.avinash.swipetab E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.example.avinash.swipetab, PID: 7460
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.avinash.swipetab/com.example.avinash.swipetab.Filter}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.example.avinash.swipetab.Filter.onCreate(Filter.java:17)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
Thanks in advance.
In my Activity I have the following code:
int picture = Const.a1;
Const.backgroundBitmap = BitmapFactory.decodeResource(getResources(), picture);
Const.backgroundBitmapBonus0 = BitmapFactory.decodeResource(getResources(), Const.bonus_back[0]);
Const.backgroundBitmapBonus1 = BitmapFactory.decodeResource(getResources(), Const.bonus_back[1]);
Const.backgroundBitmapBonus2 = BitmapFactory.decodeResource(getResources(), Const.bonus_back[2]);
Const.backgroundBitmapBonus3 = BitmapFactory.decodeResource(getResources(), Const.bonus_back[3]);
Const.bitmapBackBonus = new Bitmap[4];
Const.bitmapBackBonus[0]= Const.backgroundBitmapBonus0;
Const.bitmapBackBonus[1] = Const.backgroundBitmapBonus1;
Const.bitmapBackBonus[2] = Const.backgroundBitmapBonus2;
Const.bitmapBackBonus[3] = Const.backgroundBitmapBonus3;
And in Const class I have
public static int[] bonus_back = { R.drawable.back_b0 , R.drawable.back_b1 , R.drawable.back_b2 , R.drawable.back_b3};
When I run the app on my device it crashes, while in AVD it worked fine.
How can I use these pictures in right way?
EDIT:
new code using http://developer.android.com/training/displaying-bitmaps/load-bitmap.html
still the same problem
Const.screenWidth = this.getWindowManager().getDefaultDisplay().getWidth();
Const.screenHeight = this.getWindowManager().getDefaultDisplay().getHeight();
int picture = Const.a1;
Const.backgroundBitmapBonus0 = decodeSampledBitmapFromResource(getResources(), Const.bonus_back[0], Const.screenWidth, Const.screenHeight);
Const.backgroundBitmapBonus1 =decodeSampledBitmapFromResource(getResources(), Const.bonus_back[1], Const.screenWidth, Const.screenHeight);
Const.backgroundBitmapBonus2 = decodeSampledBitmapFromResource(getResources(), Const.bonus_back[2], Const.screenWidth, Const.screenHeight);
Const.backgroundBitmapBonus3 = decodeSampledBitmapFromResource(getResources(), Const.bonus_back[3], Const.screenWidth, Const.screenHeight);
Const.backgroundBitmap = decodeSampledBitmapFromResource(getResources(), picture, 100, 100);
/*Const.backgroundBitmap = BitmapFactory.decodeResource(getResources(), picture);
Const.backgroundBitmapBonus0 = BitmapFactory.decodeResource(getResources(), Const.bonus_back[0]);
Const.backgroundBitmapBonus1 = BitmapFactory.decodeResource(getResources(), Const.bonus_back[1]);
Const.backgroundBitmapBonus2 = BitmapFactory.decodeResource(getResources(), Const.bonus_back[2]);
Const.backgroundBitmapBonus3 = BitmapFactory.decodeResource(getResources(), Const.bonus_back[3]);
*/
Const.bitmapBackBonus = new Bitmap[4];
Const.bitmapBackBonus[0]= Const.backgroundBitmapBonus0;
Const.bitmapBackBonus[1] = Const.backgroundBitmapBonus1;
Const.bitmapBackBonus[2] = Const.backgroundBitmapBonus2;
Const.bitmapBackBonus[3] = Const.backgroundBitmapBonus3;
EDIT 2 : Logcat
11-14 09:45:45.525: D/dalvikvm(5623): Late-enabling CheckJNI
11-14 09:45:45.805: D/skia(5623): ---- fAsset->read(3346) returned 0
11-14 09:45:45.905: D/dalvikvm(5623): GC_FOR_ALLOC freed 99K, 3% free 13923K/14343K, paused 37ms
11-14 09:45:45.905: I/dalvikvm-heap(5623): Grow heap (frag case) to 14.807MB for 992016-byte allocation
11-14 09:45:45.945: D/dalvikvm(5623): GC_CONCURRENT freed 1K, 4% free 14890K/15367K, paused 2ms+2ms
11-14 09:45:46.025: D/dalvikvm(5623): GC_FOR_ALLOC freed 0K, 4% free 14890K/15367K, paused 13ms
11-14 09:45:46.075: I/dalvikvm-heap(5623): Grow heap (frag case) to 29.942MB for 15872016-byte allocation
11-14 09:45:46.115: D/dalvikvm(5623): GC_CONCURRENT freed 0K, 2% free 30390K/30919K, paused 2ms+2ms
11-14 09:45:46.515: D/dalvikvm(5623): GC_FOR_ALLOC freed 969K, 5% free 30391K/31943K, paused 18ms
11-14 09:45:46.565: I/dalvikvm-heap(5623): Grow heap (frag case) to 45.080MB for 15872016-byte allocation
11-14 09:45:46.595: D/dalvikvm(5623): GC_CONCURRENT freed <1K, 4% free 45890K/47495K, paused 2ms+3ms
11-14 09:45:46.905: D/dalvikvm(5623): GC_FOR_ALLOC freed 969K, 4% free 45891K/47495K, paused 15ms
11-14 09:45:46.970: I/dalvikvm-heap(5623): Grow heap (frag case) to 60.216MB for 15872016-byte allocation
11-14 09:45:46.990: D/dalvikvm(5623): GC_FOR_ALLOC freed <1K, 3% free 61391K/63047K, paused 18ms
11-14 09:45:47.050: D/dalvikvm(5623): GC_CONCURRENT freed 0K, 3% free 61391K/63047K, paused 2ms+5ms
11-14 09:45:47.345: D/dalvikvm(5623): GC_FOR_ALLOC freed 969K, 3% free 61391K/63047K, paused 14ms
11-14 09:45:47.345: I/dalvikvm-heap(5623): Forcing collection of SoftReferences for 15872016-byte allocation
11-14 09:45:47.390: D/dalvikvm(5623): GC_BEFORE_OOM freed 9K, 3% free 61382K/63047K, paused 32ms
11-14 09:45:47.390: E/dalvikvm-heap(5623): Out of memory on a 15872016-byte allocation.
11-14 09:45:47.390: I/dalvikvm(5623): "main" prio=5 tid=1 RUNNABLE
11-14 09:45:47.390: I/dalvikvm(5623): | group="main" sCount=0 dsCount=0 obj=0x40c6d460 self=0x8a9288
11-14 09:45:47.390: I/dalvikvm(5623): | sysTid=5623 nice=0 sched=0/0 cgrp=default handle=1074558216
11-14 09:45:47.390: I/dalvikvm(5623): | schedstat=( 1288354466 258529951 3812 ) utm=106 stm=22 core=2
11-14 09:45:47.390: I/dalvikvm(5623): at android.graphics.Bitmap.nativeCreate(Native Method)
11-14 09:45:47.390: I/dalvikvm(5623): at android.graphics.Bitmap.createBitmap(Bitmap.java:605)
11-14 09:45:47.390: I/dalvikvm(5623): at android.graphics.Bitmap.createBitmap(Bitmap.java:551)
11-14 09:45:47.390: I/dalvikvm(5623): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:437)
11-14 09:45:47.390: I/dalvikvm(5623): at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:618)
11-14 09:45:47.390: I/dalvikvm(5623): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:593)
11-14 09:45:47.390: I/dalvikvm(5623): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:445)
11-14 09:45:47.390: I/dalvikvm(5623): at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:468)
11-14 09:45:47.390: I/dalvikvm(5623): at com.example.fishe.FullscreenActivity.decodeSampledBitmapFromResource(FullscreenActivity.java:248)
11-14 09:45:47.390: I/dalvikvm(5623): at com.example.fishe.FullscreenActivity.onCreate(FullscreenActivity.java:142)
11-14 09:45:47.390: I/dalvikvm(5623): at android.app.Activity.performCreate(Activity.java:4533)
11-14 09:45:47.395: I/dalvikvm(5623): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)
11-14 09:45:47.395: I/dalvikvm(5623): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)
11-14 09:45:47.395: I/dalvikvm(5623): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
11-14 09:45:47.395: I/dalvikvm(5623): at android.app.ActivityThread.access$600(ActivityThread.java:128)
11-14 09:45:47.395: I/dalvikvm(5623): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
11-14 09:45:47.395: I/dalvikvm(5623): at android.os.Handler.dispatchMessage(Handler.java:99)
11-14 09:45:47.395: I/dalvikvm(5623): at android.os.Looper.loop(Looper.java:137)
11-14 09:45:47.395: I/dalvikvm(5623): at android.app.ActivityThread.main(ActivityThread.java:4517)
11-14 09:45:47.395: I/dalvikvm(5623): at java.lang.reflect.Method.invokeNative(Native Method)
11-14 09:45:47.395: I/dalvikvm(5623): at java.lang.reflect.Method.invoke(Method.java:511)
11-14 09:45:47.395: I/dalvikvm(5623): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
11-14 09:45:47.395: I/dalvikvm(5623): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
11-14 09:45:47.395: I/dalvikvm(5623): at dalvik.system.NativeStart.main(Native Method)
11-14 09:45:47.395: D/AndroidRuntime(5623): Shutting down VM
11-14 09:45:47.395: W/dalvikvm(5623): threadid=1: thread exiting with uncaught exception (group=0x40c6c1f8)
11-14 09:45:47.395: E/AndroidRuntime(5623): FATAL EXCEPTION: main
11-14 09:45:47.395: E/AndroidRuntime(5623): java.lang.OutOfMemoryError
11-14 09:45:47.395: E/AndroidRuntime(5623): at android.graphics.Bitmap.nativeCreate(Native Method)
11-14 09:45:47.395: E/AndroidRuntime(5623): at android.graphics.Bitmap.createBitmap(Bitmap.java:605)
11-14 09:45:47.395: E/AndroidRuntime(5623): at android.graphics.Bitmap.createBitmap(Bitmap.java:551)
11-14 09:45:47.395: E/AndroidRuntime(5623): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:437)
11-14 09:45:47.395: E/AndroidRuntime(5623): at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:618)
11-14 09:45:47.395: E/AndroidRuntime(5623): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:593)
11-14 09:45:47.395: E/AndroidRuntime(5623): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:445)
11-14 09:45:47.395: E/AndroidRuntime(5623): at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:468)
11-14 09:45:47.395: E/AndroidRuntime(5623): at com.example.fishe.FullscreenActivity.decodeSampledBitmapFromResource(FullscreenActivity.java:248)
11-14 09:45:47.395: E/AndroidRuntime(5623): at com.example.fishe.FullscreenActivity.onCreate(FullscreenActivity.java:142)
11-14 09:45:47.395: E/AndroidRuntime(5623): at android.app.Activity.performCreate(Activity.java:4533)
11-14 09:45:47.395: E/AndroidRuntime(5623): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)
11-14 09:45:47.395: E/AndroidRuntime(5623): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)
11-14 09:45:47.395: E/AndroidRuntime(5623): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
11-14 09:45:47.395: E/AndroidRuntime(5623): at android.app.ActivityThread.access$600(ActivityThread.java:128)
11-14 09:45:47.395: E/AndroidRuntime(5623): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
11-14 09:45:47.395: E/AndroidRuntime(5623): at android.os.Handler.dispatchMessage(Handler.java:99)
11-14 09:45:47.395: E/AndroidRuntime(5623): at android.os.Looper.loop(Looper.java:137)
11-14 09:45:47.395: E/AndroidRuntime(5623): at android.app.ActivityThread.main(ActivityThread.java:4517)
11-14 09:45:47.395: E/AndroidRuntime(5623): at java.lang.reflect.Method.invokeNative(Native Method)
11-14 09:45:47.395: E/AndroidRuntime(5623): at java.lang.reflect.Method.invoke(Method.java:511)
11-14 09:45:47.395: E/AndroidRuntime(5623): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
11-14 09:45:47.395: E/AndroidRuntime(5623): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
11-14 09:45:47.395: E/AndroidRuntime(5623): at dalvik.system.NativeStart.main(Native Method)
11-14 09:45:56.490: I/Process(5623): Sending signal. PID: 5623 SIG: 9
If the image is too big you're probably running out of memory.
Check http://developer.android.com/training/displaying-bitmaps/load-bitmap.html to learn how to load a scaled-down version of the image.
I am using FragmentActivity in my application with several Fragments. Each of these fragments hold an image and some text with animation. When user swipes on the screen, the fragment changes.
Now I have been working on this since 10 days and have tested the FragmentActivity on different devices with different Android versions. The reason that I am stuck on this from last 10 days is I am getting a crash
Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 27830 (ple.myfragexample)
Now, this error occurs only when I test the FragmentActivity on Android 4.1.2 particularly. It would run fine on Android 2.3.3, 4.0.3, 4.0.4, 4.2 and even 2.2. The error log is as below:
08-07 14:34:13.843: D/dalvikvm(27830): GC_FOR_ALLOC freed 3845K, 14% free 35407K/40903K, paused 4ms, total 14ms
08-07 14:34:13.848: I/dalvikvm-heap(27830): Grow heap (frag case) to 39.590MB for 3932176-byte allocation
08-07 14:34:13.878: D/dalvikvm(27830): GC_CONCURRENT freed 3K, 5% free 39244K/40903K, paused 11ms+4ms, total 30ms
08-07 14:34:13.928: D/dalvikvm(27830): GC_FOR_ALLOC freed 0K, 5% free 39244K/40903K, paused 16ms, total 16ms
08-07 14:34:13.928: I/dalvikvm-heap(27830): Forcing collection of SoftReferences for 8847376-byte allocation
08-07 14:34:13.953: D/dalvikvm(27830): GC_BEFORE_OOM freed 9K, 5% free 39235K/40903K, paused 24ms, total 24ms
08-07 14:34:13.953: E/dalvikvm-heap(27830): Out of memory on a 8847376-byte allocation.
08-07 14:34:13.953: I/dalvikvm(27830): "main" prio=5 tid=1 RUNNABLE
08-07 14:34:13.953: I/dalvikvm(27830): | group="main" sCount=0 dsCount=0 obj=0x41ea8508 self=0x41e989c8
08-07 14:34:13.953: I/dalvikvm(27830): | sysTid=27830 nice=0 sched=0/0 cgrp=apps handle=1074937648
08-07 14:34:13.953: I/dalvikvm(27830): | schedstat=( 2591504030 1697770606 13588 ) utm=221 stm=38 core=0
08-07 14:34:13.953: I/dalvikvm(27830): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
08-07 14:34:13.953: I/dalvikvm(27830): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:625)
08-07 14:34:13.953: I/dalvikvm(27830): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:478)
08-07 14:34:13.953: I/dalvikvm(27830): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:781)
08-07 14:34:13.953: I/dalvikvm(27830): at android.content.res.Resources.loadDrawable(Resources.java:1963)
08-07 14:34:13.953: I/dalvikvm(27830): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
08-07 14:34:13.953: I/dalvikvm(27830): at android.view.View.<init>(View.java:3449)
08-07 14:34:13.953: I/dalvikvm(27830): at android.widget.ImageView.<init>(ImageView.java:114)
08-07 14:34:13.953: I/dalvikvm(27830): at android.widget.ImageView.<init>(ImageView.java:110)
08-07 14:34:13.953: I/dalvikvm(27830): at java.lang.reflect.Constructor.constructNative(Native Method)
08-07 14:34:13.953: I/dalvikvm(27830): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
08-07 14:34:13.953: I/dalvikvm(27830): at android.view.LayoutInflater.createView(LayoutInflater.java:587)
08-07 14:34:13.953: I/dalvikvm(27830): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
08-07 14:34:13.953: I/dalvikvm(27830): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
08-07 14:34:13.953: I/dalvikvm(27830): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
08-07 14:34:13.953: I/dalvikvm(27830): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
08-07 14:34:13.953: I/dalvikvm(27830): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
08-07 14:34:13.953: I/dalvikvm(27830): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
08-07 14:34:13.953: I/dalvikvm(27830): at com.example.myfragexample.pages.Page6.onCreateView(Page6.java:52)
08-07 14:34:13.953: I/dalvikvm(27830): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1460)
08-07 14:34:13.953: I/dalvikvm(27830): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:911)
08-07 14:34:13.953: I/dalvikvm(27830): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1088)
08-07 14:34:13.953: I/dalvikvm(27830): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
08-07 14:34:13.953: I/dalvikvm(27830): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1444)
08-07 14:34:13.953: I/dalvikvm(27830): at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:429)
08-07 14:34:13.953: I/dalvikvm(27830): at android.os.Handler.handleCallback(Handler.java:615)
08-07 14:34:13.953: I/dalvikvm(27830): at android.os.Handler.dispatchMessage(Handler.java:92)
08-07 14:34:13.953: I/dalvikvm(27830): at android.os.Looper.loop(Looper.java:137)
08-07 14:34:13.953: I/dalvikvm(27830): at android.app.ActivityThread.main(ActivityThread.java:4921)
08-07 14:34:13.953: I/dalvikvm(27830): at java.lang.reflect.Method.invokeNative(Native Method)
08-07 14:34:13.953: I/dalvikvm(27830): at java.lang.reflect.Method.invoke(Method.java:511)
08-07 14:34:13.953: I/dalvikvm(27830): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
08-07 14:34:13.953: I/dalvikvm(27830): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
08-07 14:34:13.953: I/dalvikvm(27830): at dalvik.system.NativeStart.main(Native Method)
08-07 14:34:13.953: A/libc(27830): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 27830 (ple.myfragexample)
I have searched a lot over the internet and tried many thing about this, however, the working of my Fragments got smoother on devices with any other version of Android, but just on Android 4.1.2. I also tried to use Universal Image Loader, but it still crashes with Fatal signal 11. The error log I get when I am using Universal Image Loader is as below:
08-07 14:20:03.678: D/dalvikvm(27268): GC_FOR_ALLOC freed 3857K, 32% free 33002K/48455K, paused 31ms, total 34ms
08-07 14:20:03.678: I/dalvikvm-heap(27268): Grow heap (frag case) to 37.241MB for 3932176-byte allocation
08-07 14:20:03.708: D/dalvikvm(27268): GC_FOR_ALLOC freed 5K, 24% free 36837K/48455K, paused 28ms, total 28ms
08-07 14:20:03.738: D/dalvikvm(27268): GC_CONCURRENT freed <1K, 24% free 36837K/48455K, paused 11ms+2ms, total 30ms
08-07 14:20:03.848: D/dalvikvm(27268): GC_FOR_ALLOC freed <1K, 24% free 36837K/48455K, paused 17ms, total 17ms
08-07 14:20:03.848: I/dalvikvm-heap(27268): Forcing collection of SoftReferences for 8847376-byte allocation
08-07 14:20:03.883: D/dalvikvm(27268): GC_BEFORE_OOM freed 9K, 24% free 36828K/48455K, paused 32ms, total 35ms
08-07 14:20:03.883: E/dalvikvm-heap(27268): Out of memory on a 8847376-byte allocation.
08-07 14:20:03.888: I/dalvikvm(27268): "pool-1-thread-1" prio=4 tid=12 RUNNABLE
08-07 14:20:03.888: I/dalvikvm(27268): | group="main" sCount=0 dsCount=0 obj=0x4293af60 self=0x4f6c9470
08-07 14:20:03.888: I/dalvikvm(27268): | sysTid=27283 nice=10 sched=0/0 cgrp=apps/bg_non_interactive handle=1098606736
08-07 14:20:03.888: I/dalvikvm(27268): | schedstat=( 2735922613 2106917058 1146 ) utm=266 stm=7 core=0
08-07 14:20:03.888: I/dalvikvm(27268): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
08-07 14:20:03.888: I/dalvikvm(27268): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:625)
08-07 14:20:03.888: I/dalvikvm(27268): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:478)
08-07 14:20:03.888: I/dalvikvm(27268): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:781)
08-07 14:20:03.888: I/dalvikvm(27268): at android.content.res.Resources.loadDrawable(Resources.java:1963)
08-07 14:20:03.888: I/dalvikvm(27268): at android.content.res.Resources.getDrawable(Resources.java:672)
08-07 14:20:03.888: I/dalvikvm(27268): at com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStreamFromDrawable(BaseImageDownloader.java:184)
08-07 14:20:03.888: I/dalvikvm(27268): at com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStream(BaseImageDownloader.java:84)
08-07 14:20:03.888: I/dalvikvm(27268): at com.nostra13.universalimageloader.core.decode.BaseImageDecoder.getImageStream(BaseImageDecoder.java:82)
08-07 14:20:03.888: I/dalvikvm(27268): at com.nostra13.universalimageloader.core.decode.BaseImageDecoder.decode(BaseImageDecoder.java:68)
08-07 14:20:03.888: I/dalvikvm(27268): at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.decodeImage(LoadAndDisplayImageTask.java:284)
08-07 14:20:03.888: I/dalvikvm(27268): at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.tryLoadBitmap(LoadAndDisplayImageTask.java:243)
08-07 14:20:03.888: I/dalvikvm(27268): at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.run(LoadAndDisplayImageTask.java:125)
08-07 14:20:03.888: I/dalvikvm(27268): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
08-07 14:20:03.888: I/dalvikvm(27268): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
08-07 14:20:03.888: I/dalvikvm(27268): at java.lang.Thread.run(Thread.java:856)
08-07 14:20:03.888: A/libc(27268): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 27283 (pool-1-thread-1)
Now, I know there are lots of questions with Fatal signal 11 on here too, but I am concerned and confused as I am getting this crash only on Android 4.1.2 and not on any other Android versions.
My issue is solved now. I just got my images re-sized from my Graphics team. Previously I was using 1280x768 resolution images but I got them scaled down to 800x480 and the crash is gone. Thanks for all the suggestions though.
Also, I think Jelly Bean (4.x) has enhanced UI and so, it occupies more memory for handling the UI itself than the lower versions of Android, and that's why it was not able to manage handling(scaling down) the larger images.
Have a look at my question:
Strange crash drawing on canvas on Android 4.0.3. A/libc: Fatal signal 11 (SIGSEGV)
maybe it's the same problem. The issue arises when I try to use a small number for stroke or others Paint properties.
setStrokeWidth(0.007f);
Never solved, I suggest to scale the Canvas and use bigger numbers.