Android app crashes unexpectedly on emulator - android
here is my error log please help?
I am a newbie to android and this is my first app
package gaurav.rapp.swamiji;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.animation.AnimationUtils;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ImageSwitcher;
import android.widget.ImageView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ViewSwitcher.ViewFactory;
public class BeWithSwamijiActivity extends Activity implements ViewFactory {
Integer pics[]={R.drawable.img1,R.drawable.img2,R.drawable.img3,R.drawable.img4,R.drawable.img5,R.drawable.img6,R.drawable.img7,R.drawable.img8,R.drawable.img9,R.drawable.img10,R.drawable.img11,R.drawable.img12,R.drawable.img13,R.drawable.img14,R.drawable.img15,R.drawable.img16,R.drawable.img17};
ImageSwitcher iSwitcher;
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
iSwitcher = (ImageSwitcher) findViewById(R.id.ImageSwitcher01);
iSwitcher.setFactory(this);
iSwitcher.setInAnimation(AnimationUtils.loadAnimation(this,
android.R.anim.fade_in));
iSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this,
android.R.anim.fade_out));
Gallery gallery = (Gallery) findViewById(R.id.Gallery01);
gallery.setAdapter(new ImageAdapter(this));
gallery.setOnItemClickListener(new OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
iSwitcher.setImageResource(pics[arg2]);
}
});
}
public class ImageAdapter extends BaseAdapter {
private Context ctx;
public ImageAdapter(Context c) {
ctx = c;
}
#Override
public int getCount() {
return pics.length;
}
#Override
public Object getItem(int arg0) {
return arg0;
}
#Override
public long getItemId(int arg0) {
return arg0;
}
#Override
public View getView(int arg0, View arg1, ViewGroup arg2) {
ImageView iView = new ImageView(ctx);
iView.setImageResource(pics[arg0]);
iView.setScaleType(ImageView.ScaleType.FIT_XY);
iView.setLayoutParams(new Gallery.LayoutParams(150, 150));
return iView;
}
}
#Override
public View makeView() {
ImageView iView=new ImageView(this);
iView.setScaleType(ImageView.ScaleType.FIT_CENTER);
iView.setLayoutParams(new ImageSwitcher.LayoutParams(
LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
iView.setBackgroundColor(0xFF000000);
return iView;
}
}
Log
05-13 21:58:39.107: I/Process(397): Sending signal. PID: 397 SIG: 9
05-13 21:58:45.517: D/dalvikvm(409): GC_FOR_ALLOC freed 43K, 4% free 6362K/6595K, paused 75ms
05-13 21:58:45.587: I/dalvikvm-heap(409): Grow heap (frag case) to 10.624MB for 4566704-byte allocation
05-13 21:58:45.697: D/dalvikvm(409): GC_FOR_ALLOC freed 1K, 3% free 10820K/11079K, paused 86ms
05-13 21:58:45.887: D/dalvikvm(409): GC_CONCURRENT freed <1K, 3% free 10820K/11079K, paused 25ms+3ms
05-13 21:58:46.427: D/dalvikvm(409): GC_FOR_ALLOC freed <1K, 3% free 10820K/11079K, paused 112ms
05-13 21:58:46.547: I/dalvikvm-heap(409): Grow heap (frag case) to 18.362MB for 8114772-byte allocation
05-13 21:58:46.839: D/dalvikvm(409): GC_FOR_ALLOC freed 0K, 2% free 18745K/19015K, paused 72ms
05-13 21:58:47.057: D/dalvikvm(409): GC_CONCURRENT freed 0K, 2% free 18745K/19015K, paused 4ms+16ms
05-13 21:58:47.680: D/dalvikvm(409): GC_FOR_ALLOC freed 5051K, 26% free 15340K/20679K, paused 72ms
05-13 21:58:47.889: D/dalvikvm(409): GC_FOR_ALLOC freed <1K, 21% free 16537K/20679K, paused 71ms
05-13 21:58:47.889: I/dalvikvm-heap(409): Grow heap (frag case) to 18.284MB for 2179600-byte allocation
05-13 21:58:48.037: D/dalvikvm(409): GC_FOR_ALLOC freed 0K, 10% free 18666K/20679K, paused 75ms
05-13 21:58:48.307: D/dalvikvm(409): GC_CONCURRENT freed 0K, 10% free 18666K/20679K, paused 5ms+3ms
05-13 21:58:48.511: D/dalvikvm(409): GC_FOR_ALLOC freed 1197K, 11% free 18425K/20679K, paused 73ms
05-13 21:58:48.530: I/dalvikvm-heap(409): Grow heap (frag case) to 19.705MB for 1735988-byte allocation
05-13 21:58:48.681: D/dalvikvm(409): GC_FOR_ALLOC freed 0K, 11% free 20120K/22407K, paused 76ms
05-13 21:59:09.187: D/dalvikvm(409): GC_FOR_ALLOC freed 961K, 13% free 19660K/22407K, paused 75ms
05-13 21:59:11.737: D/dalvikvm(409): GC_FOR_ALLOC freed 678K, 10% free 20385K/22407K, paused 143ms
05-13 21:59:11.797: I/dalvikvm-heap(409): Grow heap (frag case) to 24.518MB for 4776976-byte allocation
05-13 21:59:11.971: D/dalvikvm(409): GC_FOR_ALLOC freed <1K, 8% free 25049K/27079K, paused 85ms
05-13 21:59:12.117: D/dalvikvm(409): GC_CONCURRENT freed <1K, 8% free 25049K/27079K, paused 4ms+3ms
05-13 21:59:12.327: D/dalvikvm(409): GC_FOR_ALLOC freed <1K, 8% free 25049K/27079K, paused 93ms
05-13 21:59:12.437: I/dalvikvm-heap(409): Grow heap (frag case) to 32.619MB for 8494048-byte allocation
05-13 21:59:12.589: D/dalvikvm(409): GC_FOR_ALLOC freed 0K, 6% free 33344K/35399K, paused 82ms
05-13 21:59:12.877: D/dalvikvm(409): GC_CONCURRENT freed 0K, 6% free 33345K/35399K, paused 5ms+4ms
05-13 21:59:29.208: D/dalvikvm(409): GC_FOR_ALLOC freed 4862K, 17% free 29383K/35399K, paused 84ms
05-13 21:59:31.130: D/dalvikvm(409): GC_FOR_ALLOC freed 353K, 13% free 30855K/35399K, paused 84ms
05-13 21:59:31.137: I/dalvikvm-heap(409): Grow heap (frag case) to 32.266MB for 2179600-byte allocation
05-13 21:59:31.287: D/dalvikvm(409): GC_FOR_ALLOC freed <1K, 7% free 32983K/35399K, paused 82ms
05-13 21:59:31.538: D/dalvikvm(409): GC_CONCURRENT freed 0K, 7% free 32983K/35399K, paused 5ms+4ms
05-13 21:59:31.647: D/dalvikvm(409): GC_FOR_ALLOC freed 1549K, 12% free 31435K/35399K, paused 92ms
05-13 21:59:31.692: I/dalvikvm-heap(409): Grow heap (frag case) to 33.028MB for 2384216-byte allocation
05-13 21:59:31.880: D/dalvikvm(409): GC_FOR_ALLOC freed 0K, 11% free 33764K/37767K, paused 100ms
05-13 21:59:32.057: D/dalvikvm(409): GC_CONCURRENT freed <1K, 11% free 33764K/37767K, paused 4ms+4ms
05-13 21:59:32.307: D/dalvikvm(409): GC_FOR_ALLOC freed <1K, 11% free 33764K/37767K, paused 108ms
05-13 21:59:32.377: I/dalvikvm-heap(409): Grow heap (frag case) to 37.073MB for 4241380-byte allocation
05-13 21:59:32.547: D/dalvikvm(409): GC_FOR_ALLOC freed 0K, 10% free 37906K/41927K, paused 97ms
05-13 21:59:32.797: D/dalvikvm(409): GC_CONCURRENT freed 0K, 10% free 37906K/41927K, paused 4ms+14ms
05-13 21:59:34.747: D/dalvikvm(409): GC_FOR_ALLOC freed 2329K, 13% free 36533K/41927K, paused 98ms
05-13 21:59:35.037: D/dalvikvm(409): GC_CONCURRENT freed 1304K, 12% free 37261K/41927K, paused 4ms+4ms
05-13 21:59:42.547: D/dalvikvm(409): GC_FOR_ALLOC freed 337K, 11% free 37524K/41927K, paused 88ms
05-13 21:59:42.607: I/dalvikvm-heap(409): Grow heap (frag case) to 41.255MB for 4776976-byte allocation
05-13 21:59:42.801: D/dalvikvm(409): GC_FOR_ALLOC freed <1K, 10% free 42188K/46599K, paused 104ms
05-13 21:59:43.021: D/dalvikvm(409): GC_CONCURRENT freed <1K, 10% free 42188K/46599K, paused 4ms+4ms
05-13 21:59:43.180: D/dalvikvm(409): GC_FOR_ALLOC freed <1K, 10% free 42189K/46599K, paused 98ms
05-13 21:59:43.180: I/dalvikvm-heap(409): Forcing collection of SoftReferences for 8494048-byte allocation
05-13 21:59:43.327: D/dalvikvm(409): GC_BEFORE_OOM freed 8K, 10% free 42180K/46599K, paused 143ms
05-13 21:59:43.327: E/dalvikvm-heap(409): Out of memory on a 8494048-byte allocation.
05-13 21:59:43.337: I/dalvikvm(409): "main" prio=5 tid=1 RUNNABLE
05-13 21:59:43.337: I/dalvikvm(409): | group="main" sCount=0 dsCount=0 obj=0x4001b5c8 self=0x125d8
05-13 21:59:43.337: I/dalvikvm(409): | sysTid=409 nice=0 sched=0/0 cgrp=default handle=-1342913432
05-13 21:59:43.337: I/dalvikvm(409): | schedstat=( 10690152881 5424008534 597 ) utm=864 stm=205 core=0
05-13 21:59:43.337: I/dalvikvm(409): at android.graphics.Bitmap.nativeCreate(Native Method)
05-13 21:59:43.337: I/dalvikvm(409): at android.graphics.Bitmap.createBitmap(Bitmap.java:604)
05-13 21:59:43.337: I/dalvikvm(409): at android.graphics.Bitmap.createBitmap(Bitmap.java:551)
05-13 21:59:43.337: I/dalvikvm(409): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:437)
05-13 21:59:43.337: I/dalvikvm(409): at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:524)
05-13 21:59:43.347: I/dalvikvm(409): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:499)
05-13 21:59:43.347: I/dalvikvm(409): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:351)
05-13 21:59:43.347: I/dalvikvm(409): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:738)
05-13 21:59:43.347: I/dalvikvm(409): at android.content.res.Resources.loadDrawable(Resources.java:1918)
05-13 21:59:43.347: I/dalvikvm(409): at android.content.res.Resources.getDrawable(Resources.java:655)
05-13 21:59:43.357: I/dalvikvm(409): at android.widget.ImageView.resolveUri(ImageView.java:510)
05-13 21:59:43.357: I/dalvikvm(409): at android.widget.ImageView.setImageResource(ImageView.java:289)
05-13 21:59:43.357: I/dalvikvm(409): at android.widget.ImageSwitcher.setImageResource(ImageSwitcher.java:41)
05-13 21:59:43.357: I/dalvikvm(409): at gaurav.rapp.swamiji.BeWithSwamijiActivity$1.onItemClick(BeWithSwamijiActivity.java:39)
05-13 21:59:43.357: I/dalvikvm(409): at android.widget.AdapterView.performItemClick(AdapterView.java:282)
05-13 21:59:43.357: I/dalvikvm(409): at android.widget.Gallery.onSingleTapUp(Gallery.java:867)
05-13 21:59:43.357: I/dalvikvm(409): at android.view.GestureDetector.onTouchEvent(GestureDetector.java:557)
05-13 21:59:43.357: I/dalvikvm(409): at android.widget.Gallery.onTouchEvent(Gallery.java:842)
05-13 21:59:43.377: I/dalvikvm(409): at android.view.View.dispatchTouchEvent(View.java:4609)
05-13 21:59:43.377: I/dalvikvm(409): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1554)
05-13 21:59:43.377: I/dalvikvm(409): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1320)
05-13 21:59:43.377: I/dalvikvm(409): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
05-13 21:59:43.387: I/dalvikvm(409): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
05-13 21:59:43.387: I/dalvikvm(409): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
05-13 21:59:43.387: I/dalvikvm(409): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
05-13 21:59:43.387: I/dalvikvm(409): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
05-13 21:59:43.387: I/dalvikvm(409): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
05-13 21:59:43.387: I/dalvikvm(409): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
05-13 21:59:43.387: I/dalvikvm(409): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
05-13 21:59:43.387: I/dalvikvm(409): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1709)
05-13 21:59:43.407: I/dalvikvm(409): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1264)
05-13 21:59:43.407: I/dalvikvm(409): at android.app.Activity.dispatchTouchEvent(Activity.java:2315)
05-13 21:59:43.407: I/dalvikvm(409): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1682)
05-13 21:59:43.417: I/dalvikvm(409): at android.view.View.dispatchPointerEvent(View.java:4677)
05-13 21:59:43.417: I/dalvikvm(409): at android.view.ViewRoot.deliverPointerEvent(ViewRoot.java:2392)
05-13 21:59:43.417: I/dalvikvm(409): at android.view.ViewRoot.handleMessage(ViewRoot.java:2054)
05-13 21:59:43.417: I/dalvikvm(409): at android.os.Handler.dispatchMessage(Handler.java:99)
05-13 21:59:43.417: I/dalvikvm(409): at android.os.Looper.loop(Looper.java:132)
05-13 21:59:43.417: I/dalvikvm(409): at android.app.ActivityThread.main(ActivityThread.java:4123)
05-13 21:59:43.417: I/dalvikvm(409): at java.lang.reflect.Method.invokeNative(Native Method)
05-13 21:59:43.417: I/dalvikvm(409): at java.lang.reflect.Method.invoke(Method.java:491)
05-13 21:59:43.417: I/dalvikvm(409): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
05-13 21:59:43.417: I/dalvikvm(409): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
05-13 21:59:43.417: I/dalvikvm(409): at dalvik.system.NativeStart.main(Native Method)
05-13 21:59:43.417: D/AndroidRuntime(409): Shutting down VM
05-13 21:59:43.417: W/dalvikvm(409): threadid=1: thread exiting with uncaught exception (group=0x40014760)
05-13 21:59:43.467: E/AndroidRuntime(409): FATAL EXCEPTION: main
05-13 21:59:43.467: E/AndroidRuntime(409): java.lang.OutOfMemoryError
05-13 21:59:43.467: E/AndroidRuntime(409): at android.graphics.Bitmap.nativeCreate(Native Method)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.graphics.Bitmap.createBitmap(Bitmap.java:604)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.graphics.Bitmap.createBitmap(Bitmap.java:551)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:437)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:524)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:499)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:351)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:738)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.content.res.Resources.loadDrawable(Resources.java:1918)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.content.res.Resources.getDrawable(Resources.java:655)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.widget.ImageView.resolveUri(ImageView.java:510)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.widget.ImageView.setImageResource(ImageView.java:289)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.widget.ImageSwitcher.setImageResource(ImageSwitcher.java:41)
05-13 21:59:43.467: E/AndroidRuntime(409): at gaurav.rapp.swamiji.BeWithSwamijiActivity$1.onItemClick(BeWithSwamijiActivity.java:39)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.widget.AdapterView.performItemClick(AdapterView.java:282)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.widget.Gallery.onSingleTapUp(Gallery.java:867)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.view.GestureDetector.onTouchEvent(GestureDetector.java:557)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.widget.Gallery.onTouchEvent(Gallery.java:842)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.view.View.dispatchTouchEvent(View.java:4609)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1554)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1320)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
05-13 21:59:43.467: E/AndroidRuntime(409): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1709)
05-13 21:59:43.467: E/AndroidRuntime(409): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1264)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.app.Activity.dispatchTouchEvent(Activity.java:2315)
05-13 21:59:43.467: E/AndroidRuntime(409): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1682)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.view.View.dispatchPointerEvent(View.java:4677)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.view.ViewRoot.deliverPointerEvent(ViewRoot.java:2392)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.view.ViewRoot.handleMessage(ViewRoot.java:2054)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.os.Handler.dispatchMessage(Handler.java:99)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.os.Looper.loop(Looper.java:132)
05-13 21:59:43.467: E/AndroidRuntime(409): at android.app.ActivityThread.main(ActivityThread.java:4123)
05-13 21:59:43.467: E/AndroidRuntime(409): at java.lang.reflect.Method.invokeNative(Native Method)
05-13 21:59:43.467: E/AndroidRuntime(409): at java.lang.reflect.Method.invoke(Method.java:491)
05-13 21:59:43.467: E/AndroidRuntime(409): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
05-13 21:59:43.467: E/AndroidRuntime(409): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
05-13 21:59:43.467: E/AndroidRuntime(409): at dalvik.system.NativeStart.main(Native Method)
05-13 21:59:46.117: I/Process(409): Sending signal. PID: 409 SIG: 9
Out of memory on a 8494048-byte allocation.
Don't try to load 8MB bitmaps! Resize your assets to something more appropriate, or look at BitmapFactory.Options to downscale whatever it is you are trying to load.
Related
Cannot parse JSON - android
I'm new to android, I can't understand why am I getting this exception when trying to parse JSON. Please help, or suggest any alternative. Json File containing all countries with their cities: citiesjson.txt A sample of above file is: {"China":["Guangzhou","Fuzhou","Beijing","Baotou","Hohhot","Guiyang","Yinchuan","Nanjing","Changzhou","Chuzhou","Jiaoyun","Guizhoumanzuxiang","Qingzhen","Changde","Xianning","Jiaozhou","Weifang","Tai'an","Luoxi","Guoji","Guangdong","Sijiqing","Huzhou","Panjin Shi","Daqing","Jilin City","Lianyungang","Yancheng","Yuehu","Kunshan","Taicang","Lianshui","Nantong","Jiaotong","Changshu City","Xingxiangcun","Jinsha","Jiangyan","Chaigoubu","Ma'anshan","Huainan","Haibei","Shenlong","Nangxian","Rongsheng","Changfeng","Chengqiao","Jiafu","Shenzhou","Shantou","Qingyuan","Gyari","Xinshijie","Zhaoqing","Zhanjiang","Kuicheng","Taoyuan","Jincheng","Caishen","Shiyan","Liaoyang","Xingtai","Wenchang","Wanning","Qionghai","Huilongba","Dingcheng","Baodian","Wuzhishan","Chengmai","Yinggen","Ledong","Lincheng","Baisha","Changjiang","Dongfang","Changjian","Jinmao","Yangpu","Baipo","Jiefang","Danzhou","Lingshui","Haidian","Sanya","Rongjiang","Longyan","Jinghe","Zhangjiakou","Renqiu","Yaocheng","Kaifeng","Hebi","Jiaozuo","Pingdingshan","Anshan","Dandong","Haitang","Tongchuan","Ankang","Guozhen","Shangluo","Yulong","Haixing","Sanjiaocheng","Pinghu","Jinling","Fengming","Tongxiang","Puyuan","Dingqiao","Yanjiang","Wutong","Pingchuan","Dushu","Nanxun","Wuxing","Yangzhou","Hongyuan","Anji","Shangying","Deqing","Digang","Sanguan","Yuantong","Changxin","Huating","Putuoshan","Jinyuan","Dinghai","Xiangnan","Putuo","Xintian","Donghuxu","Zhuji","Jingcheng","Jiangtian","Xingchang","Jindou","Xinchang","Baiyun","Qianqing","Tianchang","Tianchi","Luzhou","Qinjiang","Tianzhu","Mingdu","Shenjiamen","Longshan","Dengbu","Xiushan","Daizhong","Longteng","Beiyuan","Taili","Choucheng","Lucheng","Chengxiang","Dongying","Gangcun","Sailing","Shifan","Yaohua","Jingyuan","Fengtai","Gaocheng","Gu'an","Shuangshipu","Li'ao","Xi'ao","Tang Xian","Tara","Li'an","Hu'an","Datang","Tumu","Shuyi","Gaoxin","Bo’ao","Baocheng","Haifu","Xiuying","Xuanzhou","Gongjiang","Huayuji","Qu'an","Fuhao","Weiyang","Laohekou","Nanshan","Chen Xian","Siting","Wuhou","Ji’an","Fuxin","Xiqu","Wangluo","Erqi","Donghong","Gaobeidian","Lianhua","Chenzhou","Dajie","Chenghua","Dongfeng","Zhu'ang","Maji","Songling","Chum","Cenyang","Hanshan","Xiaomi","Luohu","Hainan","Guangxi","Changle","Linfen","Yuanping","Jiazhuang","Heibei","Liaocheng","Huaihua","Rizhao","Fuzhou","Duyun","Tianshui","Guli","Jinhai","Chaoyang","Taixing","Fengxiang","Jinpan","Yizheng","Yunfu","Xinhui","Wenlan","Tieli","Taihe","Liuzhou","Hechi","Yunyang","Zhuxi Chengguanzhen","Heze","Shiqiaopu","Jiangbei","Shanzhuang","Danyang","Huai'an","Yantan","Guangchang","Xiguan","Xigu","Anying","Xiangtong","Guixi","Xidian","Pingliang","Pinghu","Changhe","Yangshan","Suji","Baizhang","Shuangxi","Yanming","Yiqiao","Xinxing","Dabao","Sanyuanpu","Gaobu","Linghu","Qingtong","Shuanglin","Dampu","Qi'an","Gouzhuang","Changsheng","Qianyu","Datong","Sandu","Anjiang","Huangjue","Name","Linqi","Zhanghe","Zheshang","Huadian","Kangcun","Zhangshan","Shouchang","Qiantan","Hongpan","Lin'an","Dingzhou","Jiuzong","Yuting","Guali","Jianci","Kaiyun","Chunhua","Hongwei","Shuguang","Diankou","Lidong","Fengqing","Fengqiao","Fengqi","Rongle","Huangzhai","Wuning","Yahao","Jifeng","Ancheng","Shangfang","Jiahu","Jinpu","Potang","Shangjiang","Xingqiao","Doujiang","Nyingchi County","Yangxunqiao","Chadianzi","Zhongyicun","Jialing","Jianxing","Xichong","Sanyi","Hongyan","Base","Yongxing","Nanhe","Naxi Yaozuxiang","Dongxing","Rongxian","Jinghong","Ning'er","Zhuozhou","Luquan","Li'an","Suqian","Dabu","Luoyang","Feiyun"],"Japan":["Tokyo", My code: JSONArray jsonArray = new JSONArray(jsonString); throws exception where jsonString = And the exception is: 02-08 11:29:45.239 558-589/? E/SWIPE﹕ clear() 02-08 11:29:45.239 558-589/? D/SWIPE﹕ Check swipe down for x/y: 249.0 / 173.0 02-08 11:29:45.279 558-589/? D/SWIPE﹕ touch up event 249.0 173.0 02-08 11:29:45.279 558-589/? D/SWIPE﹕ send replay touch down event 02-08 11:29:45.329 3385-3385/com.zerotech.cricketscoring.cricketscoring D/BYD_Flex﹕ getValue() name = #NOKIAFLEX#packageNeedData 02-08 11:29:45.509 3385-3385/com.zerotech.cricketscoring.cricketscoring D/BYD_Flex﹕ getValue() readFlexFromXml = TypedValue{t=0x0/d=0x0} 02-08 11:29:45.509 3385-3385/com.zerotech.cricketscoring.cricketscoring D/BYD_Flex﹕ getValue() name = #NOKIAFLEX#setDataUsageReminder 02-08 11:29:45.679 3385-3385/com.zerotech.cricketscoring.cricketscoring D/BYD_Flex﹕ getValue() readFlexFromXml = TypedValue{t=0x0/d=0x0} 02-08 11:29:45.719 3385-3385/com.zerotech.cricketscoring.cricketscoring W/dalvikvm﹕ VFY: unable to resolve virtual method 11351: Landroid/view/ViewGroup;.onNestedScrollAccepted (Landroid/view/View;Landroid/view/View;I)V 02-08 11:29:45.719 3385-3385/com.zerotech.cricketscoring.cricketscoring W/dalvikvm﹕ VFY: unable to resolve virtual method 11357: Landroid/view/ViewGroup;.onStopNestedScroll (Landroid/view/View;)V 02-08 11:29:45.729 3385-3385/com.zerotech.cricketscoring.cricketscoring W/dalvikvm﹕ VFY: unable to resolve virtual method 9043: Landroid/support/v7/internal/widget/ActionBarOverlayLayout;.stopNestedScroll ()V 02-08 11:29:45.769 3385-3385/com.zerotech.cricketscoring.cricketscoring W/dalvikvm﹕ VFY: unable to resolve virtual method 11354: Landroid/view/ViewGroup;.onRtlPropertiesChanged (I)V 02-08 11:29:45.779 3385-3385/com.zerotech.cricketscoring.cricketscoring W/dalvikvm﹕ VFY: unable to resolve virtual method 368: Landroid/content/res/TypedArray;.getChangingConfigurations ()I 02-08 11:29:45.779 3385-3385/com.zerotech.cricketscoring.cricketscoring W/dalvikvm﹕ VFY: unable to resolve virtual method 390: Landroid/content/res/TypedArray;.getType (I)I 02-08 11:29:45.869 701-701/? D/Swype﹕ [IME] onStartInput(): false 02-08 11:29:45.919 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed 295K, 7% free 8369K/8903K, paused 13ms+13ms, total 43ms 02-08 11:29:46.169 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 133K, 7% free 8542K/9095K, paused 15ms, total 15ms 02-08 11:29:46.199 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 75K, 8% free 8575K/9223K, paused 15ms, total 15ms 02-08 11:29:46.299 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed 108K, 9% free 8872K/9671K, paused 12ms+12ms, total 57ms 02-08 11:29:46.359 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 162K, 10% free 8710K/9671K, paused 14ms, total 14ms 02-08 11:29:46.439 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 243K, 9% free 8831K/9671K, paused 15ms, total 15ms 02-08 11:29:46.479 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed <1K, 9% free 9378K/10247K, paused 12ms+12ms, total 37ms 02-08 11:29:46.619 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 365K, 13% free 9014K/10247K, paused 15ms, total 15ms 02-08 11:29:46.649 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed <1K, 12% free 9834K/11079K, paused 12ms+2ms, total 27ms 02-08 11:29:46.819 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 547K, 17% free 9287K/11079K, paused 15ms, total 15ms 02-08 11:29:46.859 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed <1K, 15% free 10518K/12359K, paused 12ms+13ms, total 38ms 02-08 11:29:47.129 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 821K, 22% free 9697K/12359K, paused 14ms, total 14ms 02-08 11:29:47.169 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed <1K, 19% free 11543K/14215K, paused 12ms+3ms, total 27ms 02-08 11:29:47.559 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 1232K, 28% free 10313K/14215K, paused 15ms, total 15ms 02-08 11:29:47.599 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed <1K, 8% free 13081K/14215K, paused 13ms+3ms, total 35ms 02-08 11:29:47.759 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 1846K, 21% free 11235K/14215K, paused 14ms, total 14ms 02-08 11:29:47.789 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed 0K, 7% free 13320K/14215K, paused 15ms+2ms, total 31ms 02-08 11:29:47.789 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ WAIT_FOR_CONCURRENT_GC blocked 15ms 02-08 11:29:47.799 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 2768K, 26% free 10551K/14215K, paused 15ms, total 15ms 02-08 11:29:47.839 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed <1K, 12% free 12636K/14215K, paused 13ms+3ms, total 36ms 02-08 11:29:47.839 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ WAIT_FOR_CONCURRENT_GC blocked 17ms 02-08 11:29:47.859 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 12% free 12636K/14215K, paused 18ms, total 18ms 02-08 11:29:47.899 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed 0K, 10% free 15762K/17351K, paused 12ms+2ms, total 28ms 02-08 11:29:47.899 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ WAIT_FOR_CONCURRENT_GC blocked 11ms 02-08 11:29:47.909 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 2084K, 22% free 13678K/17351K, paused 15ms, total 15ms 02-08 11:29:47.939 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed 0K, 10% free 15762K/17351K, paused 12ms+3ms, total 27ms 02-08 11:29:47.939 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ WAIT_FOR_CONCURRENT_GC blocked 5ms 02-08 11:29:47.959 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 0K, 10% free 15762K/17351K, paused 15ms, total 15ms 02-08 11:29:48.029 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed 1K, 9% free 17864K/19463K, paused 12ms+29ms, total 64ms 02-08 11:29:50.209 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed 8013K, 42% free 11804K/20039K, paused 12ms+27ms, total 90ms 02-08 11:29:51.559 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed 409K, 38% free 12555K/20039K, paused 12ms+21ms, total 86ms 02-08 11:29:53.179 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed 484K, 33% free 13488K/20039K, paused 13ms+23ms, total 108ms 02-08 11:29:55.189 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed 601K, 27% free 14633K/20039K, paused 12ms+13ms, total 129ms 02-08 11:29:57.459 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed 675K, 21% free 15935K/20039K, paused 13ms+24ms, total 159ms 02-08 11:29:59.839 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed 661K, 15% free 17211K/20039K, paused 12ms+31ms, total 179ms 02-08 11:29:59.989 558-588/? W/PowerManager﹕ accept Wake require,start process. the mTag is:AlarmManager, the mFlags is:1 02-08 11:30:00.019 558-575/? W/PowerManager﹕ accept Wake release,start process. the mTag is:AlarmManager, the mFlags is:1 02-08 11:30:01.639 558-588/? W/PowerManager﹕ accept Wake require,start process. the mTag is:AlarmManager, the mFlags is:1 02-08 11:30:01.649 558-707/? D/NtpTrustedTime﹕ forceRefresh() from cache miss 02-08 11:30:01.649 558-575/? W/PowerManager﹕ accept Wake release,start process. the mTag is:AlarmManager, the mFlags is:1 02-08 11:30:01.649 558-707/? D/SntpClient﹕ request time failed: java.net.UnknownHostException: Unable to resolve host "2.android.pool.ntp.org": No address associated with hostname 02-08 11:30:01.649 558-707/? W/ThrottleService﹕ unable to find stats for iface rmnet0 02-08 11:30:08.389 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 1280K, 12% free 17822K/20039K, paused 71ms, total 71ms 02-08 11:30:13.059 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 649K, 10% free 18145K/20039K, paused 72ms, total 72ms 02-08 11:30:19.949 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 970K, 14% free 18630K/21511K, paused 73ms, total 73ms 02-08 11:30:20.069 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed <1K, 13% free 20813K/23751K, paused 12ms+13ms, total 107ms 02-08 11:30:22.949 558-584/? D/BatteryService﹕ level:99 scale:100 status:2 health:2 present:true voltage: 4196 temperature: 410 technology: Li-ion AC powered:false USB powered:true icon:17303055 invalid charger:0 02-08 11:30:28.729 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 1457K, 19% free 19358K/23751K, paused 72ms, total 72ms 02-08 11:30:28.819 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed 0K, 18% free 21442K/25863K, paused 12ms+3ms, total 86ms 02-08 11:30:28.819 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ WAIT_FOR_CONCURRENT_GC blocked 64ms 02-08 11:30:28.889 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 0K, 18% free 21442K/25863K, paused 73ms, total 73ms 02-08 11:30:28.999 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed 0K, 16% free 23527K/27975K, paused 12ms+3ms, total 98ms 02-08 11:30:28.999 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ WAIT_FOR_CONCURRENT_GC blocked 81ms 02-08 11:30:29.069 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 2182K, 24% free 21344K/27975K, paused 73ms, total 73ms 02-08 11:30:29.169 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed 2084K, 20% free 22386K/27975K, paused 12ms+3ms, total 97ms 02-08 11:30:29.169 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ WAIT_FOR_CONCURRENT_GC blocked 84ms 02-08 11:30:29.249 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 2084K, 28% free 20302K/27975K, paused 81ms, total 81ms 02-08 11:30:29.339 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed <1K, 20% free 22387K/27975K, paused 12ms+3ms, total 86ms 02-08 11:30:29.339 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ WAIT_FOR_CONCURRENT_GC blocked 73ms 02-08 11:30:29.409 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 3126K, 32% free 19260K/27975K, paused 73ms, total 73ms 02-08 11:30:29.499 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed <1K, 24% free 21344K/27975K, paused 12ms+3ms, total 86ms 02-08 11:30:29.499 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ WAIT_FOR_CONCURRENT_GC blocked 74ms 02-08 11:30:29.579 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 0K, 24% free 21344K/27975K, paused 83ms, total 83ms 02-08 11:30:29.679 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed <1K, 17% free 23429K/27975K, paused 13ms+3ms, total 98ms 02-08 11:30:30.579 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 2084K, 24% free 21344K/27975K, paused 73ms, total 73ms 02-08 11:30:30.679 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed 0K, 22% free 24471K/31111K, paused 12ms+13ms, total 97ms 02-08 11:30:31.579 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 2084K, 29% free 22386K/31111K, paused 73ms, total 73ms 02-08 11:30:31.619 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ org.json.JSONException: Value {"Belarus":["Minsk","Mogilev","Brest","Vitebsk","Dvor-Gomel'","Hrodna","Navapolatsk","Lida","Horki","Borisov","Lyakhovichi","Radoshkovichi","Polatsk","Orsha","Valer'yanovo","Baranovichi","Mazyr","Lyaskavichy","Zhodzina","Zaslawye","Lahoysk","Shklow","Mozyr'","Dzyarzhynsk","Pinsk"],"":[""],"Philippines":["Manila","Ayala","Bayan","Roosevelt","Blumentritt","Cardona","Pasong Tamo","Valenzuela","Caloocan City","Taytay","Quezon City","Las Pinas","Makati City","Marikina City","San Juan","Pasig","Paranaque City","Muntinlupa","Salinas","Poblacion","Roxas City","Puerto Princesa City","Pasay","Caloocan","Buting","Lipa City","Taguig","Baguio City","San Pablo City","San Mateo","Rizal","Dasmarinas","Sucat","Sampaloc","Marilag","Angeles City","Mandaluyong City","Malabon","Rodriguez","Fairview","Angeles City","Davao City","Iligan","Cagayan de Oro","Tagum","Butuan","Mawab","Ozamiz City","Bacoor","Cavite City","Carmona","Imus","Tacurong","Pateros","Dumaguete","Carolinas","San Pedro","General Santos","Malolos","Cebu City","Malate","New Manila","Antipolo","Villanueva","Concepcion","Koronadal","Pandi","West","Lucena City","Balayan","Laguna","Calamba","Subic","Bonifacio","Quezon","Lapu-Lapu City","Tagaytay","San Carlos City","San Jose","Asia","Subic","Libis","Palma Gil","Fernandez","Kalibo","Santos","Vargas","Novaliches","Plaza","San Antonio","Philippine","Rizal","Alabang","Legaspi","Laguna","Summit","Bates","Bagumbayan","Salcedo","Batis","Cubao","Binondo","Balabag","General","Guagua","Liberty","Tandang Sora","Capitol","Naga City","Binangonan","San Francisco","Mabalacat","Pikit","Antipolo","Imus","Tarlac City","Batangas","Calapan","Binan","Cabuyao","Hilongos","Mandaue City","Tanza","Caloocan","Silang","Malabon","Navotas","Angat","Navotas","Bulacan","Laoag","Bocaue","Dagupan","Calasiao","Dingras","Cainta","Iloilo City","Iloilo City","Tagbilaran City","Balanga","Pulilan","Olongapo City","Marilao","San Jose","San Fernando","Plaridel","Baliuag","Cabanatuan City","Bataan","Navotas","San Fernando","Meycauayan","Manila","Kawit","Bacolod City","Angono","Los Banos","Paete","Santa Rosa","Calamba City","Santa Cruz","Pangil","Canlubang","Tayabas","Pagsanjan","Zamboanga City","Talisay City","Mandaue City","Ugong Norte","Luna","Olongapo City","Tanauan","Cabatuan","Pasig","West Triangle","Pias","San Pedro","Dipolog City","Victorias City","Zamboanga City","Subic","Abucay","Samal","Orion","Arayat","Boac","Siniloan","San Agustin","Cotabato City","Veronica","Masbate","Bool","Tacloban City","Danao","Rosario West","Taft","Sulo","Centre","Santo","Pagasinan","Cafe","Leyte","Interior","Pagadian","Molave","Palo","Mamungan","Hagonoy","Paul","Bagong Nayon","Mauban","La Trinidad","Apalit","Mariveles","General Trias","Cabugao","Province of Pangasinan","Urdaneta","Alaminos","Malasiqui","Bay","Balungao","Amadeo","Macabebe","Del Monte","Limay","Calbayog City","Real","Tanay","Kapatagan","Trece Martires City","Lamitan","Bagac","Jagna","Obando","Balagtas","Kidapawan","Pampanga","Naga","Diliman Primero","Baao","Cauayan","Pacita","Central","Rosales","Bulacan","Roque","Silang","La Salette","San Miguel","Baclaran","Marcos","Suyo","Maquiling","Plaridel","Los Martires","Acacia","Minalin","Salle","Agusan Pequeno","Gitagum","Pardo","Gallego","Gloria","Nueva","Upper Bicutan","Wines","Vito","La Union","Poblacion, San Felipe","Lawis","Toledo City","Concepcion","Digos","Cogan","Calinan","Mindanaw","Dagupan","Barbar","Mangaldan","San Fabian","Alcala","Bautista","Aquino","Ilog","Manaoag","Tayug","Luzon","San Miguel","Victory","Sta Cruz","Sultan Kudarat","Magsaysay","Dapitan","Mangrove","Tanauan","Alfonso","Island Park","Maria","Tigbauan","Campus","Valencia","Occidental","Panabo","Munoz East","Aguilar","Fortuna","Matandang Balara","Osmena","Leon","Balamban","Cotabato City","Cavinti","Alitagtag","Trinidad","Lilio","Carlos","Vigan","Domingo","Candon","Norte","Oara","Alaminos","Calaca","Padre Garcia","Bauan","Cagayan","Tuguegarao City","Ilagan","Santiago","Llanera","China","Ramon","Feliciano","Marina","Cruz","Ventura","Tambo","Tejer 02-08 11:30:31.629 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at org.json.JSON.typeMismatch(JSON.java:111) 02-08 11:30:31.629 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at org.json.JSONArray.<init>(JSONArray.java:91) 02-08 11:30:31.629 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at org.json.JSONArray.<init>(JSONArray.java:103) 02-08 11:30:31.629 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at ui.CreateNewTeamActivity.populateCitySpinner(CreateNewTeamActivity.java:66) 02-08 11:30:31.629 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at ui.CreateNewTeamActivity.populateSpinners(CreateNewTeamActivity.java:56) 02-08 11:30:31.629 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at ui.CreateNewTeamActivity.onCreate(CreateNewTeamActivity.java:50) 02-08 11:30:31.639 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at android.app.Activity.performCreate(Activity.java:5181) 02-08 11:30:31.639 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094) 02-08 11:30:31.639 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2031) 02-08 11:30:31.639 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at android.app.ActivityThread.startActivityNow(ActivityThread.java:1908) 02-08 11:30:31.639 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:135) 02-08 11:30:31.639 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:347) 02-08 11:30:31.639 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:694) 02-08 11:30:31.649 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at android.widget.TabHost.setCurrentTab(TabHost.java:358) 02-08 11:30:31.649 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at android.widget.TabHost$2.onTabSelectionChanged(TabHost.java:150) 02-08 11:30:31.649 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at android.widget.TabWidget$TabClickListener.onClick(TabWidget.java:548) 02-08 11:30:31.649 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at android.view.View.performClick(View.java:4084) 02-08 11:30:31.649 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at android.view.View$PerformClick.run(View.java:16987) 02-08 11:30:31.649 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at android.os.Handler.handleCallback(Handler.java:615) 02-08 11:30:31.659 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at android.os.Handler.dispatchMessage(Handler.java:92) 02-08 11:30:31.659 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at android.os.Looper.loop(Looper.java:137) 02-08 11:30:31.659 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at android.app.ActivityThread.main(ActivityThread.java:4807) 02-08 11:30:31.659 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at java.lang.reflect.Method.invokeNative(Native Method) 02-08 11:30:31.659 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at java.lang.reflect.Method.invoke(Method.java:511) 02-08 11:30:31.659 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792) 02-08 11:30:31.669 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:559) 02-08 11:30:31.669 3385-3385/com.zerotech.cricketscoring.cricketscoring W/System.err﹕ at dalvik.system.NativeStart.main(Native Method) 02-08 11:30:31.909 1228-1234/? E/ThermalDaemon﹕ CPU[1] offline 02-08 11:30:32.669 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed 12K, 22% free 24480K/31111K, paused 12ms+978ms, total 1081ms 02-08 11:30:32.739 3385-3385/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_FOR_ALLOC freed 8730K, 50% free 15749K/31111K, paused 74ms, total 74ms 02-08 11:30:32.779 3385-3387/com.zerotech.cricketscoring.cricketscoring D/dalvikvm﹕ GC_CONCURRENT freed 0K, 43% free 17834K/31111K, paused 12ms+3ms, total 33ms 02-08 11:30:33.139 1228-1234/? E/ThermalDaemon﹕ CPU[1] offline 02-08 11:30:38.299 558-586/? D/PowerManagerService﹕ qyq:Set brightness target = 7 currentValue = 255 02-08 11:30:38.299 558-585/? E/lights﹕ debug:set_light_backlight 254 02-08 11:30:38.299 558-586/? D/PowerManagerService﹕ qyq:Set brightness target = 255 currentValue = 255 And the exception snapshot is: Or if someone has the all countries with their cities 'string-array', then that would be another solution to my problem. Thank you!
Your Json have a list of JSONObject(s) and each JSONObject have a JSONArray as value. So to parse it, you need to loop through JSONObject(s) keys (China, Japan...) and then get the JSONArray for each one: JSONObject jObj = new JSONObject(yourJson); Iterator<String> itr = jObj.keys(); // get the keys list (countries name) while(itr.hasNext()) { // loop the list of countries String countryName = itr.next(); // get the next key (a new country name) JSONArray cytiesArray = jObj.getJSONArray(countryName);// get cities for the current country }
The problem solved because of you guys, I'm thankful to Henry and Haider Saddique. There were two problems: 1) Rather than JSONArray jsonArray = new JSONArray(jsonString); I must use: JSONObject jsonArray = new JSONObject(jsonString); Thanks to Henry. But only changing this causes type mismatch exception, so follow 2nd point. 2) There were many "" in my .json So I removed all objects with empty string in my .json file. Thanks to Haider Saddique.
OutOfMemory error on Xoom when other devices with same heap size do not produce OOM
I'm having a weird issue. I've created an app which works fine on a Samsung Galaxy S2 (heap size 48MB) but when I test it on a Motorola Xoom (heap size also 48MB) it exits with an OutOfMemory error. This is particularly strange since from what I can tell I'm only actually loading about 20MB of data into the heap. The crash occurs at the same place every time, it's when I'm loading the dictionary file into a Vector (the app is a word-game, and the dictionary file that is being loaded is about 2MB and resides in the assets folder). The dictionary makes it about as far as the words starting with R and then gives up the ghost. The Samsung is running Android 2.2 and the Xoom is running 4.0.3 Here's the code which loads the dictionary: public class Dictionary { Vector words = new Vector(); public Dictionary() { } public void loadWords(String dFile) { try { InputStream is = AndroidFileIO.assets.open(dFile); BufferedReader f = new BufferedReader(new InputStreamReader(is), 8192); String word = null; if (is != null) { while ((word = f.readLine()) != null) { words.addElement(word.toUpperCase()); } } is.close(); f = null; } catch (Exception e) { System.err.println("Unable to read from " + dFile); // continue with empty dictionary } } ...and here's the LogCat output: 01-27 17:16:12.750: D/dalvikvm(9050): GC_FOR_ALLOC freed 63K, 4% free 6529K/6787K, paused 53ms 01-27 17:16:12.760: I/dalvikvm-heap(9050): Grow heap (frag case) to 8.383MB for 2048016-byte allocation 01-27 17:16:12.810: D/dalvikvm(9050): GC_CONCURRENT freed <1K, 4% free 8529K/8839K, paused 2ms+8ms 01-27 17:16:12.870: D/dalvikvm(9050): GC_FOR_ALLOC freed 20K, 4% free 8543K/8839K, paused 25ms 01-27 17:16:12.890: I/dalvikvm-heap(9050): Grow heap (frag case) to 12.302MB for 4096016-byte allocation 01-27 17:16:12.940: D/dalvikvm(9050): GC_FOR_ALLOC freed 0K, 3% free 12543K/12871K, paused 24ms 01-27 17:16:12.980: D/dalvikvm(9050): GC_CONCURRENT freed <1K, 3% free 12543K/12871K, paused 3ms+3ms 01-27 17:16:13.350: D/libEGL(9050): loaded /system/lib/egl/libGLES_android.so 01-27 17:16:13.360: D/libEGL(9050): loaded /system/lib/egl/libEGL_tegra.so 01-27 17:16:13.390: D/libEGL(9050): loaded /system/lib/egl/libGLESv1_CM_tegra.so 01-27 17:16:13.400: D/libEGL(9050): loaded /system/lib/egl/libGLESv2_tegra.so 01-27 17:16:13.440: D/OpenGLRenderer(9050): Enabling debug mode 0 01-27 17:16:13.840: D/dalvikvm(9050): GC_FOR_ALLOC freed 11K, 1% free 14001K/14087K, paused 20ms 01-27 17:16:13.890: D/dalvikvm(9050): GC_CONCURRENT freed 1K, 1% free 16000K/16135K, paused 2ms+3ms 01-27 17:16:13.990: D/dalvikvm(9050): GC_FOR_ALLOC freed <1K, 1% free 16001K/16135K, paused 19ms 01-27 17:16:14.000: I/dalvikvm-heap(9050): Grow heap (frag case) to 19.585MB for 4096016-byte allocation 01-27 17:16:14.060: D/dalvikvm(9050): GC_CONCURRENT freed <1K, 1% free 20001K/20167K, paused 1ms+20ms 01-27 17:16:14.370: D/dalvikvm(9050): GC_FOR_ALLOC freed <1K, 1% free 20001K/20167K, paused 17ms 01-27 17:16:14.380: I/dalvikvm-heap(9050): Grow heap (frag case) to 21.540MB for 2048016-byte allocation 01-27 17:16:14.420: D/dalvikvm(9050): GC_CONCURRENT freed <1K, 1% free 22001K/22215K, paused 2ms+3ms 01-27 17:16:14.510: D/dalvikvm(9050): GC_FOR_ALLOC freed <1K, 1% free 22001K/22215K, paused 17ms 01-27 17:16:14.520: I/dalvikvm-heap(9050): Grow heap (frag case) to 25.446MB for 4096016-byte allocation 01-27 17:16:14.540: D/dalvikvm(9050): GC_CONCURRENT freed <1K, 1% free 26001K/26247K, paused 2ms+3ms 01-27 17:16:14.840: D/dalvikvm(9050): GC_FOR_ALLOC freed <1K, 1% free 26001K/26247K, paused 20ms 01-27 17:16:14.840: I/dalvikvm-heap(9050): Grow heap (frag case) to 27.399MB for 2048016-byte allocation 01-27 17:16:14.870: D/dalvikvm(9050): GC_CONCURRENT freed <1K, 2% free 28001K/28295K, paused 1ms+3ms 01-27 17:16:15.070: D/dalvikvm(9050): GC_FOR_ALLOC freed <1K, 2% free 28389K/28743K, paused 20ms 01-27 17:16:15.080: I/dalvikvm-heap(9050): Grow heap (frag case) to 31.683MB for 4096016-byte allocation 01-27 17:16:15.130: D/dalvikvm(9050): GC_CONCURRENT freed <1K, 2% free 32388K/32775K, paused 2ms+3ms 01-27 17:16:15.220: D/dalvikvm(9050): GC_FOR_ALLOC freed 1K, 2% free 32390K/32775K, paused 19ms 01-27 17:16:15.220: I/dalvikvm-heap(9050): Grow heap (frag case) to 35.591MB for 4096016-byte allocation 01-27 17:16:15.260: D/dalvikvm(9050): GC_CONCURRENT freed <1K, 2% free 36390K/36807K, paused 1ms+4ms 01-27 17:16:16.510: D/dalvikvm(9050): GC_CONCURRENT freed 554K, 2% free 37925K/38535K, paused 2ms+5ms 01-27 17:16:16.940: D/dalvikvm(9050): GC_CONCURRENT freed 1047K, 3% free 38914K/40071K, paused 2ms+6ms 01-27 17:16:17.150: D/dalvikvm(9050): GC_CONCURRENT freed 982K, 3% free 39891K/41031K, paused 2ms+8ms 01-27 17:16:17.430: D/dalvikvm(9050): GC_CONCURRENT freed 1012K, 3% free 40876K/42055K, paused 2ms+8ms 01-27 17:16:17.770: D/dalvikvm(9050): GC_FOR_ALLOC freed 997K, 3% free 41820K/43015K, paused 65ms 01-27 17:16:18.100: D/dalvikvm(9050): GC_FOR_ALLOC freed 989K, 3% free 42757K/43975K, paused 75ms 01-27 17:16:18.480: D/dalvikvm(9050): GC_FOR_ALLOC freed 950K, 3% free 43636K/44871K, paused 81ms 01-27 17:16:18.780: D/dalvikvm(9050): GC_FOR_ALLOC freed 940K, 3% free 44525K/45767K, paused 84ms 01-27 17:16:19.130: D/dalvikvm(9050): GC_FOR_ALLOC freed 946K, 3% free 45421K/46663K, paused 94ms 01-27 17:16:19.410: D/dalvikvm(9050): GC_FOR_ALLOC freed 905K, 3% free 46303K/47559K, paused 99ms 01-27 17:16:19.770: I/dalvikvm-heap(9050): Clamp target GC heap from 48.105MB to 48.000MB 01-27 17:16:19.770: D/dalvikvm(9050): GC_FOR_ALLOC freed 897K, 3% free 47157K/48455K, paused 106ms 01-27 17:16:20.050: I/dalvikvm-heap(9050): Clamp target GC heap from 48.855MB to 48.000MB 01-27 17:16:20.050: D/dalvikvm(9050): GC_FOR_ALLOC freed 793K, 3% free 47924K/49159K, paused 112ms 01-27 17:16:20.220: I/dalvikvm-heap(9050): Clamp target GC heap from 49.239MB to 48.000MB 01-27 17:16:20.220: D/dalvikvm(9050): GC_FOR_ALLOC freed 396K, 2% free 48317K/49159K, paused 112ms 01-27 17:16:20.360: I/dalvikvm-heap(9050): Clamp target GC heap from 49.439MB to 48.000MB 01-27 17:16:20.360: D/dalvikvm(9050): GC_FOR_ALLOC freed 206K, 2% free 48523K/49159K, paused 109ms 01-27 17:16:20.480: I/dalvikvm-heap(9050): Clamp target GC heap from 49.541MB to 48.000MB 01-27 17:16:20.480: D/dalvikvm(9050): GC_FOR_ALLOC freed 104K, 2% free 48626K/49159K, paused 107ms 01-27 17:16:20.600: I/dalvikvm-heap(9050): Clamp target GC heap from 49.592MB to 48.000MB 01-27 17:16:20.600: D/dalvikvm(9050): GC_FOR_ALLOC freed 53K, 1% free 48679K/49159K, paused 111ms 01-27 17:16:20.720: I/dalvikvm-heap(9050): Clamp target GC heap from 49.618MB to 48.000MB 01-27 17:16:20.730: D/dalvikvm(9050): GC_FOR_ALLOC freed 26K, 1% free 48706K/49159K, paused 117ms 01-27 17:16:20.830: I/dalvikvm-heap(9050): Clamp target GC heap from 49.628MB to 48.000MB 01-27 17:16:20.830: D/dalvikvm(9050): GC_FOR_ALLOC freed 11K, 1% free 48717K/49159K, paused 105ms 01-27 17:16:20.950: I/dalvikvm-heap(9050): Clamp target GC heap from 49.631MB to 48.000MB 01-27 17:16:20.950: D/dalvikvm(9050): GC_FOR_ALLOC freed 2K, 1% free 48719K/49159K, paused 114ms 01-27 17:16:21.060: I/dalvikvm-heap(9050): Clamp target GC heap from 49.633MB to 48.000MB 01-27 17:16:21.060: D/dalvikvm(9050): GC_FOR_ALLOC freed 1K, 1% free 48721K/49159K, paused 112ms 01-27 17:16:21.170: I/dalvikvm-heap(9050): Clamp target GC heap from 49.636MB to 48.000MB 01-27 17:16:21.170: D/dalvikvm(9050): GC_FOR_ALLOC freed 3K, 1% free 48724K/49159K, paused 108ms 01-27 17:16:21.170: I/dalvikvm-heap(9050): Forcing collection of SoftReferences for 176-byte allocation 01-27 17:16:21.300: I/dalvikvm-heap(9050): Clamp target GC heap from 49.628MB to 48.000MB 01-27 17:16:21.300: D/dalvikvm(9050): GC_BEFORE_OOM freed 9K, 1% free 48715K/49159K, paused 127ms 01-27 17:16:21.410: I/dalvikvm-heap(9050): Clamp target GC heap from 49.635MB to 48.000MB 01-27 17:16:21.410: D/dalvikvm(9050): GC_FOR_ALLOC freed 8K, 1% free 48722K/49159K, paused 108ms 01-27 17:16:21.520: I/dalvikvm-heap(9050): Clamp target GC heap from 49.639MB to 48.000MB 01-27 17:16:21.520: D/dalvikvm(9050): GC_FOR_ALLOC freed 4K, 1% free 48727K/49159K, paused 109ms 01-27 17:16:21.620: I/dalvikvm-heap(9050): Clamp target GC heap from 49.641MB to 48.000MB 01-27 17:16:21.620: D/dalvikvm(9050): GC_FOR_ALLOC freed 2K, 1% free 48729K/49159K, paused 109ms 01-27 17:16:21.730: I/dalvikvm-heap(9050): Clamp target GC heap from 49.643MB to 48.000MB 01-27 17:16:21.730: D/dalvikvm(9050): GC_FOR_ALLOC freed 1K, 1% free 48730K/49159K, paused 105ms 01-27 17:16:21.840: I/dalvikvm-heap(9050): Clamp target GC heap from 49.643MB to 48.000MB 01-27 17:16:21.840: D/dalvikvm(9050): GC_FOR_ALLOC freed <1K, 1% free 48730K/49159K, paused 110ms 01-27 17:16:21.950: I/dalvikvm-heap(9050): Clamp target GC heap from 49.643MB to 48.000MB 01-27 17:16:21.950: D/dalvikvm(9050): GC_FOR_ALLOC freed <1K, 1% free 48730K/49159K, paused 106ms 01-27 17:16:22.050: I/dalvikvm-heap(9050): Clamp target GC heap from 49.643MB to 48.000MB 01-27 17:16:22.050: D/dalvikvm(9050): GC_FOR_ALLOC freed 0K, 1% free 48730K/49159K, paused 106ms 01-27 17:16:22.050: I/dalvikvm-heap(9050): Forcing collection of SoftReferences for 44-byte allocation 01-27 17:16:22.170: I/dalvikvm-heap(9050): Clamp target GC heap from 49.643MB to 48.000MB 01-27 17:16:22.170: D/dalvikvm(9050): GC_BEFORE_OOM freed 0K, 1% free 48730K/49159K, paused 119ms 01-27 17:16:22.170: E/dalvikvm-heap(9050): Out of memory on a 44-byte allocation. 01-27 17:16:22.170: I/dalvikvm(9050): "Thread-1489" prio=5 tid=13 RUNNABLE 01-27 17:16:22.170: I/dalvikvm(9050): | group="main" sCount=0 dsCount=0 obj=0x417e7bd8 self=0x1a6a168 01-27 17:16:22.170: I/dalvikvm(9050): | sysTid=9119 nice=0 sched=0/0 cgrp=default handle=27700176 01-27 17:16:22.180: I/dalvikvm(9050): | schedstat=( 6918844000 741848000 1627 ) utm=668 stm=23 core=0 01-27 17:16:22.180: I/dalvikvm(9050): at java.lang.String.<init>(String.java:~432) 01-27 17:16:22.180: I/dalvikvm(9050): at java.io.BufferedReader.readLine(BufferedReader.java:363) 01-27 17:16:22.180: I/dalvikvm(9050): at com.kittykazoo.game.Dictionary.loadWords(Dictionary.java:22) 01-27 17:16:22.180: I/dalvikvm(9050): at com.kittykazoo.gamecore.ScreenLoading.loadAssets(ScreenLoading.java:232) 01-27 17:16:22.180: I/dalvikvm(9050): at com.kittykazoo.gamecore.ScreenLoading.update(ScreenLoading.java:64) 01-27 17:16:22.180: I/dalvikvm(9050): at com.kittykazoo.framework.implementation.AndroidFastRenderView.run(AndroidFastRenderView.java:48) 01-27 17:16:22.180: I/dalvikvm(9050): at java.lang.Thread.run(Thread.java:856) 01-27 17:16:22.280: I/dalvikvm-heap(9050): Clamp target GC heap from 49.643MB to 48.000MB 01-27 17:16:22.280: D/dalvikvm(9050): GC_FOR_ALLOC freed 0K, 1% free 48730K/49159K, paused 107ms 01-27 17:16:22.280: I/dalvikvm-heap(9050): Forcing collection of SoftReferences for 72-byte allocation 01-27 17:16:22.400: I/dalvikvm-heap(9050): Clamp target GC heap from 49.643MB to 48.000MB 01-27 17:16:22.400: D/dalvikvm(9050): GC_BEFORE_OOM freed 0K, 1% free 48730K/49159K, paused 118ms 01-27 17:16:22.400: E/dalvikvm-heap(9050): Out of memory on a 72-byte allocation. 01-27 17:16:22.400: I/dalvikvm(9050): "Thread-1489" prio=5 tid=13 RUNNABLE 01-27 17:16:22.400: I/dalvikvm(9050): | group="main" sCount=0 dsCount=0 obj=0x417e7bd8 self=0x1a6a168 01-27 17:16:22.400: I/dalvikvm(9050): | sysTid=9119 nice=0 sched=0/0 cgrp=default handle=27700176 01-27 17:16:22.400: I/dalvikvm(9050): | schedstat=( 7142111000 746215000 1665 ) utm=690 stm=24 core=0 01-27 17:16:22.400: I/dalvikvm(9050): at java.lang.Throwable.nativeFillInStackTrace(Native Method) 01-27 17:16:22.400: I/dalvikvm(9050): at java.lang.Throwable.fillInStackTrace(Throwable.java:160) 01-27 17:16:22.400: I/dalvikvm(9050): at java.lang.Throwable.<init>(Throwable.java:83) 01-27 17:16:22.400: I/dalvikvm(9050): at java.lang.Error.<init>(Error.java:37) 01-27 17:16:22.400: I/dalvikvm(9050): at java.lang.VirtualMachineError.<init>(VirtualMachineError.java:35) 01-27 17:16:22.400: I/dalvikvm(9050): at java.lang.OutOfMemoryError.<init>(OutOfMemoryError.java:33) 01-27 17:16:22.400: I/dalvikvm(9050): at java.lang.String.<init>(String.java:-1) 01-27 17:16:22.400: I/dalvikvm(9050): at java.io.BufferedReader.readLine(BufferedReader.java:363) 01-27 17:16:22.400: I/dalvikvm(9050): at com.kittykazoo.game.Dictionary.loadWords(Dictionary.java:22) 01-27 17:16:22.400: I/dalvikvm(9050): at com.kittykazoo.gamecore.ScreenLoading.loadAssets(ScreenLoading.java:232) 01-27 17:16:22.400: I/dalvikvm(9050): at com.kittykazoo.gamecore.ScreenLoading.update(ScreenLoading.java:64) 01-27 17:16:22.400: I/dalvikvm(9050): at com.kittykazoo.framework.implementation.AndroidFastRenderView.run(AndroidFastRenderView.java:48) 01-27 17:16:22.400: I/dalvikvm(9050): at java.lang.Thread.run(Thread.java:856) 01-27 17:16:22.410: W/dalvikvm(9050): Exception thrown (Ljava/lang/OutOfMemoryError;) while throwing internal exception (Ljava/lang/OutOfMemoryError;) 01-27 17:16:22.510: I/dalvikvm-heap(9050): Clamp target GC heap from 49.643MB to 48.000MB 01-27 17:16:22.510: D/dalvikvm(9050): GC_FOR_ALLOC freed <1K, 1% free 48730K/49159K, paused 106ms 01-27 17:16:22.510: I/dalvikvm-heap(9050): Forcing collection of SoftReferences for 54-byte allocation 01-27 17:16:22.630: I/dalvikvm-heap(9050): Clamp target GC heap from 49.643MB to 48.000MB 01-27 17:16:22.630: D/dalvikvm(9050): GC_BEFORE_OOM freed 0K, 1% free 48730K/49159K, paused 122ms 01-27 17:16:22.630: E/dalvikvm-heap(9050): Out of memory on a 54-byte allocation. 01-27 17:16:22.630: I/dalvikvm(9050): "Thread-1489" prio=5 tid=13 RUNNABLE 01-27 17:16:22.630: I/dalvikvm(9050): | group="main" sCount=0 dsCount=0 obj=0x417e7bd8 self=0x1a6a168 01-27 17:16:22.630: I/dalvikvm(9050): | sysTid=9119 nice=0 sched=0/0 cgrp=default handle=27700176 01-27 17:16:22.630: I/dalvikvm(9050): | schedstat=( 7366692000 753065000 1725 ) utm=709 stm=27 core=0 01-27 17:16:22.630: I/dalvikvm(9050): at java.io.BufferedReader.readLine(BufferedReader.java:~422) 01-27 17:16:22.630: I/dalvikvm(9050): at com.kittykazoo.game.Dictionary.loadWords(Dictionary.java:22) 01-27 17:16:22.630: I/dalvikvm(9050): at com.kittykazoo.gamecore.ScreenLoading.loadAssets(ScreenLoading.java:232) 01-27 17:16:22.630: I/dalvikvm(9050): at com.kittykazoo.gamecore.ScreenLoading.update(ScreenLoading.java:64) 01-27 17:16:22.630: I/dalvikvm(9050): at com.kittykazoo.framework.implementation.AndroidFastRenderView.run(AndroidFastRenderView.java:48) 01-27 17:16:22.630: I/dalvikvm(9050): at java.lang.Thread.run(Thread.java:856) 01-27 17:16:22.750: I/dalvikvm-heap(9050): Clamp target GC heap from 49.643MB to 48.000MB 01-27 17:16:22.750: D/dalvikvm(9050): GC_FOR_ALLOC freed 0K, 1% free 48730K/49159K, paused 112ms 01-27 17:16:22.750: I/dalvikvm-heap(9050): Forcing collection of SoftReferences for 64-byte allocation 01-27 17:16:22.870: I/dalvikvm-heap(9050): Clamp target GC heap from 49.643MB to 48.000MB 01-27 17:16:22.870: D/dalvikvm(9050): GC_BEFORE_OOM freed 0K, 1% free 48730K/49159K, paused 122ms 01-27 17:16:22.870: E/dalvikvm-heap(9050): Out of memory on a 64-byte allocation. 01-27 17:16:22.870: I/dalvikvm(9050): "Thread-1489" prio=5 tid=13 RUNNABLE 01-27 17:16:22.870: I/dalvikvm(9050): | group="main" sCount=0 dsCount=0 obj=0x417e7bd8 self=0x1a6a168 01-27 17:16:22.870: I/dalvikvm(9050): | sysTid=9119 nice=0 sched=0/0 cgrp=default handle=27700176 01-27 17:16:22.870: I/dalvikvm(9050): | schedstat=( 7590841000 762536000 1798 ) utm=731 stm=28 core=1 01-27 17:16:22.870: I/dalvikvm(9050): at java.lang.Throwable.nativeFillInStackTrace(Native Method) 01-27 17:16:22.870: I/dalvikvm(9050): at java.lang.Throwable.fillInStackTrace(Throwable.java:160) 01-27 17:16:22.870: I/dalvikvm(9050): at java.lang.Throwable.<init>(Throwable.java:83) 01-27 17:16:22.870: I/dalvikvm(9050): at java.lang.Error.<init>(Error.java:37) 01-27 17:16:22.870: I/dalvikvm(9050): at java.lang.VirtualMachineError.<init>(VirtualMachineError.java:35) 01-27 17:16:22.870: I/dalvikvm(9050): at java.lang.OutOfMemoryError.<init>(OutOfMemoryError.java:33) 01-27 17:16:22.870: I/dalvikvm(9050): at java.io.BufferedReader.readLine(BufferedReader.java:-1) 01-27 17:16:22.870: I/dalvikvm(9050): at com.kittykazoo.game.Dictionary.loadWords(Dictionary.java:22) 01-27 17:16:22.870: I/dalvikvm(9050): at com.kittykazoo.gamecore.ScreenLoading.loadAssets(ScreenLoading.java:232) 01-27 17:16:22.870: I/dalvikvm(9050): at com.kittykazoo.gamecore.ScreenLoading.update(ScreenLoading.java:64) 01-27 17:16:22.870: I/dalvikvm(9050): at com.kittykazoo.framework.implementation.AndroidFastRenderView.run(AndroidFastRenderView.java:48) 01-27 17:16:22.870: I/dalvikvm(9050): at java.lang.Thread.run(Thread.java:856) 01-27 17:16:22.870: W/dalvikvm(9050): Exception thrown (Ljava/lang/OutOfMemoryError;) while throwing internal exception (Ljava/lang/OutOfMemoryError;) 01-27 17:16:22.870: W/dalvikvm(9050): Could not resolve class ref'ed in exception catch list (class index 1237, exception Ljava/lang/OutOfMemoryError;) 01-27 17:16:22.870: W/dalvikvm(9050): threadid=13: thread exiting with uncaught exception (group=0x40a391f8) 01-27 17:16:23.000: I/dalvikvm-heap(9050): Clamp target GC heap from 49.620MB to 48.000MB 01-27 17:16:23.000: D/dalvikvm(9050): GC_FOR_ALLOC freed 24K, 1% free 48706K/49159K, paused 128ms 01-27 17:16:23.000: E/AndroidRuntime(9050): FATAL EXCEPTION: Thread-1489 01-27 17:16:23.000: E/AndroidRuntime(9050): java.lang.OutOfMemoryError: [memory exhausted] 01-27 17:16:23.000: E/AndroidRuntime(9050): at dalvik.system.NativeStart.main(Native Method) 01-27 17:18:00.910: I/Process(9050): Sending signal. PID: 9050 SIG: 9
Ended up finding a workaround by using android:largeHeap="true" in the AndroidManifest.xml file. The AndroidDev documentation says that most applications shouldn't require that, but I don't feel the least bit guilty about it -- if they're going to limit each app to 48mb of RAM with a normal sized heap then I don't see how anyone is supposed to avoid using largeHeap for anything with more than a dozen small bitmaps and some background music.
App crash because of big picture
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.
Why is a page in my Android app not displaying properly?
I'm writing an Android app. It has two pages. The second page is supposed to be a page full of image buttons. But when I run my app in the emulator and go to the second page, the page is not displayed. Why? Here's an error I get: Android logcat Text :Fatal signal 11(SIGSEGV) at 0X00000000 (code==1) ,thread 614(com.s THIS IS THE ENTIRE LOGCAT : D/gralloc_goldfish(614): Emulator without GPU emulation detected. 01-14 09:08:14.554: D/dalvikvm(614): GC_FOR_ALLOC freed 89K, 3% free 8141K/8327K, paused 33ms, total 35ms 01-14 09:08:14.584: I/dalvikvm-heap(614): Grow heap (frag case) to 10.998MB for 3145744-byte allocation 01-14 09:08:14.744: D/dalvikvm(614): GC_CONCURRENT freed 4K, 3% free 11209K/11463K, paused 105ms+15ms, total 160ms 01-14 09:08:15.054: D/dalvikvm(614): GC_FOR_ALLOC freed 0K, 3% free 11209K/11463K, paused 22ms, total 22ms 01-14 09:08:15.104: I/dalvikvm-heap(614): Grow heap (frag case) to 17.744MB for 7077904-byte allocation 01-14 09:08:15.254: D/dalvikvm(614): GC_CONCURRENT freed 0K, 2% free 18121K/18439K, paused 97ms+6ms, total 157ms 01-14 09:08:15.424: D/dalvikvm(614): GC_FOR_ALLOC freed 3072K, 19% free 15050K/18439K, paused 27ms, total 27ms 01-14 09:08:15.424: I/dalvikvm-heap(614): Grow heap (frag case) to 17.745MB for 3145744-byte allocation 01-14 09:08:15.574: D/dalvikvm(614): GC_CONCURRENT freed <1K, 2% free 18122K/18439K, paused 102ms+15ms, total 149ms 01-14 09:08:15.904: D/dalvikvm(614): GC_FOR_ALLOC freed 0K, 2% free 18122K/18439K, paused 27ms, total 27ms 01-14 09:08:15.954: I/dalvikvm-heap(614): Grow heap (frag case) to 24.495MB for 7077904-byte allocation 01-14 09:08:16.094: D/dalvikvm(614): GC_CONCURRENT freed 0K, 2% free 25034K/25415K, paused 76ms+6ms, total 140ms 01-14 09:08:16.304: D/dalvikvm(614): GC_FOR_ALLOC freed 3072K, 14% free 21964K/25415K, paused 32ms, total 33ms 01-14 09:08:16.314: I/dalvikvm-heap(614): Grow heap (frag case) to 24.498MB for 3145744-byte allocation 01-14 09:08:16.484: D/dalvikvm(614): GC_CONCURRENT freed <1K, 2% free 25036K/25415K, paused 109ms+16ms, total 170ms 01-14 09:08:16.764: D/dalvikvm(614): GC_FOR_ALLOC freed 0K, 2% free 25036K/25415K, paused 30ms, total 30ms 01-14 09:08:16.814: I/dalvikvm-heap(614): Grow heap (frag case) to 31.248MB for 7077904-byte allocation 01-14 09:08:16.994: D/dalvikvm(614): GC_CONCURRENT freed 0K, 2% free 31948K/32391K, paused 99ms+7ms, total 180ms 01-14 09:08:17.145: D/dalvikvm(614): GC_FOR_ALLOC freed 3072K, 11% free 28878K/32391K, paused 37ms, total 37ms 01-14 09:08:17.154: I/dalvikvm-heap(614): Grow heap (frag case) to 31.249MB for 3145744-byte allocation 01-14 09:08:17.314: D/dalvikvm(614): GC_CONCURRENT freed <1K, 2% free 31950K/32391K, paused 82ms+18ms, total 161ms 01-14 09:08:17.624: D/dalvikvm(614): GC_FOR_ALLOC freed 0K, 2% free 31950K/32391K, paused 41ms, total 41ms 01-14 09:08:17.674: I/dalvikvm-heap(614): Grow heap (frag case) to 37.999MB for 7077904-byte allocation 01-14 09:08:17.874: D/dalvikvm(614): GC_CONCURRENT freed 0K, 2% free 38862K/39367K, paused 108ms+8ms, total 204ms 01-14 09:08:18.024: D/dalvikvm(614): GC_FOR_ALLOC freed 3072K, 10% free 35791K/39367K, paused 41ms, total 42ms 01-14 09:08:18.024: I/dalvikvm-heap(614): Grow heap (frag case) to 38.000MB for 3145744-byte allocation 01-14 09:08:18.184: D/dalvikvm(614): GC_CONCURRENT freed <1K, 2% free 38863K/39367K, paused 73ms+20ms, total 157ms 01-14 09:08:18.514: D/dalvikvm(614): GC_FOR_ALLOC freed 0K, 2% free 38863K/39367K, paused 40ms, total 40ms 01-14 09:08:18.564: I/dalvikvm-heap(614): Grow heap (frag case) to 44.750MB for 7077904-byte allocation 01-14 09:08:18.794: D/dalvikvm(614): GC_CONCURRENT freed 0K, 2% free 45775K/46343K, paused 92ms+21ms, total 228ms 01-14 09:08:18.954: D/dalvikvm(614): GC_FOR_ALLOC freed 3072K, 8% free 42704K/46343K, paused 43ms, total 44ms 01-14 09:08:18.954: I/dalvikvm-heap(614): Grow heap (frag case) to 44.751MB for 3145744-byte allocation 01-14 09:08:19.114: D/dalvikvm(614): GC_CONCURRENT freed <1K, 2% free 45776K/46343K, paused 74ms+7ms, total 162ms 01-14 09:08:19.445: D/dalvikvm(614): GC_FOR_ALLOC freed 0K, 2% free 45776K/46343K, paused 60ms, total 60ms 01-14 09:08:19.445: I/dalvikvm-heap(614): Forcing collection of SoftReferences for 7077904-byte allocation 01-14 09:08:19.875: D/dalvikvm(614): GC_BEFORE_OOM freed 9K, 2% free 45767K/46343K, paused 426ms, total 427ms 01-14 09:08:19.875: E/dalvikvm-heap(614): Out of memory on a 7077904-byte allocation. 01-14 09:08:19.875: I/dalvikvm(614): "main" prio=5 tid=1 RUNNABLE 01-14 09:08:19.875: I/dalvikvm(614): | group="main" sCount=0 dsCount=0 obj=0x40a14568 self=0x2a00b9e0 01-14 09:08:19.875: I/dalvikvm(614): | sysTid=614 nice=0 sched=0/0 cgrp=apps handle=1073870640 01-14 09:08:19.885: I/dalvikvm(614): | schedstat=( 3996873888 1969503221 492 ) utm=351 stm=48 core=0 01-14 09:08:19.885: I/dalvikvm(614): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method) 01-14 09:08:19.885: I/dalvikvm(614): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:500) 01-14 09:08:19.885: I/dalvikvm(614): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:353) 01-14 09:08:19.885: I/dalvikvm(614): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:781) 01-14 09:08:19.885: I/dalvikvm(614): at android.content.res.Resources.loadDrawable(Resources.java:1930) 01-14 09:08:19.885: I/dalvikvm(614): at android.content.res.TypedArray.getDrawable(TypedArray.java:601) 01-14 09:08:19.894: I/dalvikvm(614): at android.widget.ImageView.<init>(ImageView.java:120) 01-14 09:08:19.894: I/dalvikvm(614): at android.widget.ImageView.<init>(ImageView.java:110) 01-14 09:08:19.904: I/dalvikvm(614): at java.lang.reflect.Constructor.constructNative(Native Method) 01-14 09:08:19.904: I/dalvikvm(614): at java.lang.reflect.Constructor.newInstance(Constructor.java:417) 01-14 09:08:19.904: I/dalvikvm(614): at android.view.LayoutInflater.createView(LayoutInflater.java:587) 01-14 09:08:19.904: I/dalvikvm(614): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) 01-14 09:08:19.904: I/dalvikvm(614): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660) 01-14 09:08:19.904: I/dalvikvm(614): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685) 01-14 09:08:19.904: I/dalvikvm(614): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) 01-14 09:08:19.904: I/dalvikvm(614): at android.view.LayoutInflater.inflate(LayoutInflater.java:489) 01-14 09:08:19.904: I/dalvikvm(614): at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 01-14 09:08:19.904: I/dalvikvm(614): at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 01-14 09:08:19.904: I/dalvikvm(614): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256) 01-14 09:08:19.904: I/dalvikvm(614): at android.app.Activity.setContentView(Activity.java:1867) 01-14 09:08:19.904: I/dalvikvm(614): at com.sgs.First.onCreate(First.java:13) 01-14 09:08:19.904: I/dalvikvm(614): at android.app.Activity.performCreate(Activity.java:5008) 01-14 09:08:19.904: I/dalvikvm(614): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) 01-14 09:08:19.904: I/dalvikvm(614): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023) 01-14 09:08:19.904: I/dalvikvm(614): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 01-14 09:08:19.904: I/dalvikvm(614): at android.app.ActivityThread.access$600(ActivityThread.java:130) 01-14 09:08:19.904: I/dalvikvm(614): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 01-14 09:08:19.904: I/dalvikvm(614): at android.os.Handler.dispatchMessage(Handler.java:99) 01-14 09:08:19.904: I/dalvikvm(614): at android.os.Looper.loop(Looper.java:137) 01-14 09:08:19.904: I/dalvikvm(614): at android.app.ActivityThread.main(ActivityThread.java:4745) 01-14 09:08:19.904: I/dalvikvm(614): at java.lang.reflect.Method.invokeNative(Native Method) 01-14 09:08:19.904: I/dalvikvm(614): at java.lang.reflect.Method.invoke(Method.java:511) 01-14 09:08:19.904: I/dalvikvm(614): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 01-14 09:08:19.914: I/dalvikvm(614): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 01-14 09:08:19.914: I/dalvikvm(614): at dalvik.system.NativeStart.main(Native Method) 01-14 09:08:19.930: A/libc(614): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 614 (com.sgs) THIS IS THE XML CODE <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="100dp" android:orientation="horizontal" > <ImageView android:id="#+id/imageButton1" android:layout_width="160dp" android:layout_height="100dp" android:src="#drawable/c" /> <ImageView android:id="#+id/imageButton2" android:layout_width="160dp" android:layout_height="100dp" android:src="#drawable/d" /> </LinearLayout> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="300dp" android:orientation="horizontal" > <ImageView android:id="#+id/imageButton3" android:layout_width="80dp" android:layout_height="300dp" android:src="#drawable/e" /> <ImageView android:id="#+id/imageButton4" android:layout_width="160dp" android:layout_height="300dp" android:src="#drawable/g" /> <ImageView android:id="#+id/imageButton5" android:layout_width="80dp" android:layout_height="300dp" android:src="#drawable/f" /> </LinearLayout> <ImageView android:id="#+id/imageButton6" android:layout_width="320dp" android:layout_height="100dp" android:src="#drawable/h" /> </LinearLayout> THIS IS THE CORRESPONDING JAVA FILE package com.sgs; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.ImageView; public class First extends Activity implements OnClickListener { #Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.first); ImageView image1 = (ImageView) findViewById(R.id.imageButton1); ImageView image2 = (ImageView) findViewById(R.id.imageButton2); ImageView image3 = (ImageView) findViewById(R.id.imageButton3); ImageView image4 = (ImageView) findViewById(R.id.imageButton4); ImageView image5 = (ImageView) findViewById(R.id.imageButton5); image1.setOnClickListener(this); image2.setOnClickListener(this); image3.setOnClickListener(this); image4.setOnClickListener(this); image5.setOnClickListener(this); } public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()){ case R.id.imageButton1: } } }
From the log you can see an out of memory error when an image is beeing decoded: 01-14 09:08:19.875: E/dalvikvm-heap(614): Out of memory on a 7077904-byte allocation. Maybe the images used (by mistake) are to large for the memory allocated by you emulator device profile. You could try increasing the heap size of the device (Window-->AVD Manager-->Virtual Devices-->Edit : Hardware properties)
out of memory android imageview
on my person name device i get an error caused by out of memory but when i tried the same program on another device it seems to work just fine 05-14 21:52:54.625: I/dalvikvm(3561): Wrote stack traces to '/data/anr/traces.txt' 05-14 21:52:55.135: I/dalvikvm(3561): threadid=3: reacting to signal 3 05-14 21:52:55.135: I/dalvikvm(3561): Wrote stack traces to '/data/anr/traces.txt' 05-14 21:52:56.785: D/dalvikvm(3561): GC_FOR_ALLOC freed 10K, 3% free 9663K/9863K, paused 13ms 05-14 21:52:56.785: I/dalvikvm-heap(3561): Grow heap (frag case) to 10.158MB for 633616-byte allocation 05-14 21:52:56.820: D/dalvikvm(3561): GC_CONCURRENT freed 3K, 3% free 10278K/10503K, paused 1ms+1ms 05-14 21:52:56.845: D/dalvikvm(3561): GC_FOR_ALLOC freed <1K, 3% free 10280K/10503K, paused 10ms 05-14 21:52:56.850: I/dalvikvm-heap(3561): Grow heap (frag case) to 10.759MB for 633616-byte allocation 05-14 21:52:56.885: D/dalvikvm(3561): GC_CONCURRENT freed <1K, 3% free 10898K/11143K, paused 2ms+2ms 05-14 21:52:56.910: D/dalvikvm(3561): GC_FOR_ALLOC freed <1K, 3% free 10899K/11143K, paused 13ms 05-14 21:52:56.910: I/dalvikvm-heap(3561): Grow heap (frag case) to 11.365MB for 633616-byte allocation 05-14 21:52:56.935: D/dalvikvm(3561): GC_CONCURRENT freed <1K, 3% free 11518K/11783K, paused 1ms+1ms 05-14 21:53:04.005: D/dalvikvm(3561): GC_FOR_ALLOC freed 13K, 2% free 11708K/11847K, paused 24ms 05-14 21:53:04.055: D/dalvikvm(3561): GC_CONCURRENT freed 419K, 5% free 12089K/12679K, paused 1ms+2ms 05-14 21:53:04.080: D/dalvikvm(3561): GC_FOR_ALLOC freed 0K, 5% free 12089K/12679K, paused 9ms 05-14 21:53:04.080: I/dalvikvm-heap(3561): Grow heap (frag case) to 13.680MB for 1843216-byte allocation 05-14 21:53:04.105: D/dalvikvm(3561): GC_CONCURRENT freed 0K, 5% free 13889K/14535K, paused 1ms+1ms 05-14 21:53:04.150: D/dalvikvm(3561): GC_FOR_ALLOC freed 800K, 10% free 13891K/15367K, paused 9ms 05-14 21:53:04.155: I/dalvikvm-heap(3561): Grow heap (frag case) to 15.440MB for 1843216-byte allocation 05-14 21:53:04.175: D/dalvikvm(3561): GC_CONCURRENT freed <1K, 9% free 15691K/17223K, paused 1ms+2ms 05-14 21:53:05.370: E/AndroidRuntime(3561): at dalvik.system.NativeStart.main(Native Method) 05-14 21:53:05.370: E/AndroidRuntime(3561): Caused by: android.view.InflateException: Binary XML file line #158: Error inflating class <unknown> 05-14 21:53:05.370: E/AndroidRuntime(3561): at android.view.LayoutInflater.createView(LayoutInflater.java:606) 05-14 21:53:05.370: E/AndroidRuntime(3561): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) 05-14 21:53:05.370: E/AndroidRuntime(3561): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653) 05-14 21:53:05.370: E/AndroidRuntime(3561): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678) 05-14 21:53:05.370: E/AndroidRuntime(3561): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739) 05-14 21:53:05.370: E/AndroidRuntime(3561): at android.view.LayoutInflater.rInflate(LayoutInflater.java:742) 05-14 21:53:05.370: E/AndroidRuntime(3561): at android.view.LayoutInflater.rInflate(LayoutInflater.java:742) 05-14 21:53:05.370: E/AndroidRuntime(3561): at android.view.LayoutInflater.inflate(LayoutInflater.java:489) 05-14 21:53:05.370: E/AndroidRuntime(3561): at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 05-14 21:53:05.370: E/AndroidRuntime(3561): at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 05-14 21:53:05.370: E/AndroidRuntime(3561): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251) 05-14 21:53:05.370: E/AndroidRuntime(3561): at android.app.Activity.setContentView(Activity.java:1835) 05-14 21:53:05.370: E/AndroidRuntime(3561): at pilestudios.dirtyyou.singleplay.onCreate(singleplay.java:23) 05-14 21:53:05.370: E/AndroidRuntime(3561): at android.app.Activity.performCreate(Activity.java:4465) 05-14 21:53:05.370: E/AndroidRuntime(3561): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049) 05-14 21:53:05.370: E/AndroidRuntime(3561): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920) 05-14 21:53:05.370: E/AndroidRuntime(3561): ... 11 more 05-14 21:53:05.370: E/AndroidRuntime(3561): Caused by: java.lang.reflect.InvocationTargetException 05-14 21:53:05.370: E/AndroidRuntime(3561): at java.lang.reflect.Constructor.constructNative(Native Method) 05-14 21:53:05.370: E/AndroidRuntime(3561): at java.lang.reflect.Constructor.newInstance(Constructor.java:417) 05-14 21:53:05.370: E/AndroidRuntime(3561): at android.view.LayoutInflater.createView(LayoutInflater.java:586) 05-14 21:53:05.370: E/AndroidRuntime(3561): ... 26 more 05-14 21:53:05.370: E/AndroidRuntime(3561): Caused by: java.lang.OutOfMemoryError 05-14 21:53:05.370: E/AndroidRuntime(3561): at android.graphics.Bitmap.nativeCreate(Native Method) 05-14 21:53:05.370: E/AndroidRuntime(3561): at android.graphics.Bitmap.createBitmap(Bitmap.java:605) 05-14 21:53:05.370: E/AndroidRuntime(3561): at android.graphics.Bitmap.createBitmap(Bitmap.java:551) 05-14 21:53:05.370: E/AndroidRuntime(3561): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:437) 05-14 21:53:05.370: E/AndroidRuntime(3561): at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:524) 05-14 21:53:05.370: E/AndroidRuntime(3561): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:499) 05-14 21:53:05.370: E/AndroidRuntime(3561): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:351) 05-14 21:53:05.370: E/AndroidRuntime(3561): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:773) 05-14 21:53:05.370: E/AndroidRuntime(3561): at android.content.res.Resources.loadDrawable(Resources.java:1966) 05-14 21:53:05.370: E/AndroidRuntime(3561): at android.content.res.TypedArray.getDrawable(TypedArray.java:601) 05-14 21:53:05.370: E/AndroidRuntime(3561): at android.widget.ImageView.<init>(ImageView.java:119) 05-14 21:53:05.370: E/AndroidRuntime(3561): at android.widget.ImageView.<init>(ImageView.java:109)
Different devices have different heap sizes. You can try scaling down your image to see if it helps.