Why is a page in my Android app not displaying properly? - android

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)

Related

Android app: how can I use up memory, leaving only 20-100 MB

I'm working on a stress testing tool, one of designed scenario is to use up memory, and leave only a few mega for the app under test and others.
By searching internet about this topic, I learned that Android Dalvik vm limit program allocation in 16MB, 24MB, or 32MB. But I do realized some app can retain up to 80 MB memory. So is that idea reasonable? if so, how to achieve that goal.
thanks in advance,
Forrest
I would use one or several services to consume memory.
This article tells us that Leaving a service running when it’s not needed is one of the worst memory-management mistakes:
https://developer.android.com/training/articles/memory.html#Services
and this one tells us which process is killed last:
http://developer.android.com/guide/components/processes-and-threads.html#Lifecycle
In addition, I would use a foreground activity to cause killing the app under test (and see if the data survive): when the memory is already allocated to services, a foreground activity would cause killing of the background activities.
Android is a Linux, so you can use stuff like /proc/$PID/maps (see here).
It's interesting to know what you will use, so please answer your own question after you solve the problem.
thanks following up with me. Now I believe I get an answer to this question.
Generally speaking, we cannot rely on one app/service to use up the whole system RAM. Andoid app runs in Dalvik vm and there's an upper limit for each application or service. It's also known as maximum heap size limit. Different phones has different limit heap size:
HUAWEI U9508: 256MB android 4.0.4
Meizu MX3: 192MB android 4.2.1* ll
We can get this heap size by code:
Runtime.getRuntime().maxMemory();
Android Service fall into this rule as well, the heap size limit is the same as normal app.
Initially, android os give the app a relatively small heap, when the app reach the capacity, memory manager will grow the heap size automatically. Later, if app reaches the heap size limit, you'll get OutOfMemoryError. See below log(copy to text editor for better reading):
02-15 09:22:25.438: D/dalvikvm(9992): GC_FOR_ALLOC freed 140K, 11% free 2943K/3280K, paused 11ms, total 11ms
02-15 09:22:25.478: I/dalvikvm-heap(9992): Grow heap (frag case) to 27.059MB for 25165840-byte allocation
02-15 09:22:25.478: D/dalvikvm(9992): threadid=1: still suspended after undo (sc=1 dc=1)
02-15 09:22:25.488: D/dalvikvm(9992): threadid=1: still suspended after undo (sc=1 dc=1)
02-15 09:22:25.488: D/dalvikvm(9992): GC_CONCURRENT freed 15K, 2% free 27504K/27860K, paused 1ms+2ms, total 13ms
02-15 09:22:25.488: D/dalvikvm(9992): WAIT_FOR_CONCURRENT_GC blocked 12ms
02-15 09:22:43.758: I/Choreographer(9992): Skipped 1100 frames! The application may be doing too much work on its main thread.
02-15 09:22:43.913: D/dalvikvm(9992): GC_FOR_ALLOC freed 2K, 2% free 27504K/27856K, paused 25ms, total 25ms
02-15 09:22:43.963: I/dalvikvm-heap(9992): Grow heap (frag case) to 51.044MB for 25165840-byte allocation
02-15 09:22:43.978: D/dalvikvm(9992): GC_FOR_ALLOC freed <1K, 1% free 52080K/52436K, paused 14ms, total 14ms
02-15 09:22:43.998: D/dalvikvm(9992): GC_CONCURRENT freed <1K, 1% free 52080K/52436K, paused 2ms+4ms, total 21ms
02-15 09:22:52.578: D/dalvikvm(9992): GC_FOR_ALLOC freed 4K, 1% free 52080K/52432K, paused 12ms, total 12ms
02-15 09:22:52.613: I/dalvikvm-heap(9992): Grow heap (frag case) to 75.044MB for 25165840-byte allocation
02-15 09:22:52.633: D/dalvikvm(9992): GC_CONCURRENT freed 0K, 1% free 76656K/77012K, paused 3ms+4ms, total 20ms
02-15 09:22:52.633: D/dalvikvm(9992): WAIT_FOR_CONCURRENT_GC blocked 17ms
02-15 09:22:52.633: D/dalvikvm(9992): WAIT_FOR_CONCURRENT_GC blocked 17ms
02-15 09:22:55.198: D/dalvikvm(9992): GC_FOR_ALLOC freed 1K, 1% free 76656K/77012K, paused 13ms, total 13ms
02-15 09:22:55.233: I/dalvikvm-heap(9992): Grow heap (frag case) to 99.044MB for 25165840-byte allocation
02-15 09:22:55.253: D/dalvikvm(9992): GC_CONCURRENT freed 0K, 1% free 101232K/101592K, paused 1ms+5ms, total 17ms
02-15 09:22:55.253: D/dalvikvm(9992): WAIT_FOR_CONCURRENT_GC blocked 17ms
02-15 09:22:55.253: D/dalvikvm(9992): WAIT_FOR_CONCURRENT_GC blocked 17ms
02-15 09:22:56.438: D/dalvikvm(9992): GC_FOR_ALLOC freed <1K, 1% free 101232K/101592K, paused 17ms, total 17ms
02-15 09:22:56.478: I/dalvikvm-heap(9992): Grow heap (frag case) to 123.044MB for 25165840-byte allocation
02-15 09:22:56.493: D/dalvikvm(9992): GC_FOR_ALLOC freed 0K, 1% free 125808K/126172K, paused 18ms, total 18ms
02-15 09:22:56.523: D/dalvikvm(9992): GC_CONCURRENT freed <1K, 1% free 125808K/126172K, paused 2ms+7ms, total 27ms
02-15 09:22:57.458: D/dalvikvm(9992): GC_FOR_ALLOC freed <1K, 1% free 125808K/126172K, paused 17ms, total 18ms
02-15 09:22:57.493: I/dalvikvm-heap(9992): Grow heap (frag case) to 147.044MB for 25165840-byte allocation
02-15 09:22:57.513: D/dalvikvm(9992): GC_FOR_ALLOC freed 0K, 1% free 150384K/150752K, paused 18ms, total 18ms
02-15 09:22:57.543: D/dalvikvm(9992): GC_CONCURRENT freed <1K, 1% free 150384K/150752K, paused 3ms+7ms, total 29ms
02-15 09:22:58.668: D/dalvikvm(9992): GC_FOR_ALLOC freed <1K, 1% free 150384K/150752K, paused 17ms, total 17ms
02-15 09:22:58.708: I/dalvikvm-heap(9992): Grow heap (frag case) to 171.044MB for 25165840-byte allocation
02-15 09:22:58.733: D/dalvikvm(9992): GC_FOR_ALLOC freed 0K, 1% free 174960K/175332K, paused 24ms, total 24ms
02-15 09:22:58.768: D/dalvikvm(9992): GC_CONCURRENT freed <1K, 1% free 174960K/175332K, paused 2ms+11ms, total 36ms
02-15 09:22:59.718: D/dalvikvm(9992): GC_FOR_ALLOC freed <1K, 1% free 174960K/175332K, paused 35ms, total 35ms
02-15 09:22:59.718: I/dalvikvm-heap(9992): Forcing collection of SoftReferences for 25165840-byte allocation
02-15 09:22:59.778: D/dalvikvm(9992): GC_BEFORE_OOM freed 10K, 1% free 174950K/175332K, paused 58ms, total 58ms
02-15 09:22:59.778: E/dalvikvm-heap(9992): Out of memory on a 25165840-byte allocation.
02-15 09:22:59.778: I/dalvikvm(9992): "main" prio=5 tid=1 RUNNABLE
02-15 09:22:59.778: I/dalvikvm(9992): | group="main" sCount=0 dsCount=0 obj=0x40dd19a0 self=0x40bc6010
02-15 09:22:59.778: I/dalvikvm(9992): | sysTid=9992 nice=0 sched=0/0 cgrp=apps handle=1074504668
02-15 09:22:59.778: I/dalvikvm(9992): | state=R schedstat=( 0 0 0 ) utm=295 stm=49 core=0
02-15 09:22:59.778: I/dalvikvm(9992): at com.jdmobile.stresstestingutility.MainActivity$2.onClick(MainActivity.java:~148)
02-15 09:22:59.778: I/dalvikvm(9992): at android.view.View.performClick(View.java:4203)
02-15 09:22:59.778: I/dalvikvm(9992): at android.view.View$PerformClick.run(View.java:17556)
02-15 09:22:59.778: I/dalvikvm(9992): at android.os.Handler.handleCallback(Handler.java:725)
02-15 09:22:59.778: I/dalvikvm(9992): at android.os.Handler.dispatchMessage(Handler.java:92)
02-15 09:22:59.778: I/dalvikvm(9992): at android.os.Looper.loop(Looper.java:137)
02-15 09:22:59.778: I/dalvikvm(9992): at android.app.ActivityThread.main(ActivityThread.java:5105)
02-15 09:22:59.778: I/dalvikvm(9992): at java.lang.reflect.Method.invokeNative(Native Method)
02-15 09:22:59.778: I/dalvikvm(9992): at java.lang.reflect.Method.invoke(Method.java:511)
02-15 09:22:59.778: I/dalvikvm(9992): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
02-15 09:22:59.778: I/dalvikvm(9992): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
02-15 09:22:59.778: I/dalvikvm(9992): at dalvik.system.NativeStart.main(Native Method)
02-15 09:23:52.643: D/AndroidRuntime(9992): Shutting down VM
The other memory allocation limit is a chunk of memory(no fragment): 16MB, 24MB, or bigger, see this piece of code demonstration, ActivityManager:
/**
* Return the approximate per-application memory class of the current
* device. This gives you an idea of how hard a memory limit you should
* impose on your application to let the overall system work best. The
* returned value is in megabytes; the baseline Android memory class is
* 16 (which happens to be the Java heap limit of those devices); some
* device with more memory may return 24 or even higher numbers.
*/
public int getMemoryClass() {
return staticGetMemoryClass();
}

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.

Framedrops --> Ideas for better Android Game rendering?

my simple application suffers from framedrop. I think this is due to my rendering method:
public void draw(Canvas canvas) {
drawBackground(canvas);
drawPlayer(canvas);
drawEnemy(canvas);
}
As you can see, the background gets drawn every single time this method is called, as well as player and enemy... the "drawBackground(canvas)" looks kinda like this:
public void paintBackground(Canvas canvas) {
canvas.drawBitmap(background, 0, 0, null);
}
drawPlayer and drawEnemy draw circles at the position my player/ or enemyobject returns.
Is there any better solution for displaying background, player and other objects, without constantly redrawing them?
Logcat:
02-14 17:30:11.904: D/dalvikvm(17783): GC_FOR_ALLOC freed 29K, 1% free 9069K/9132K, paused 17ms, total 18ms
02-14 17:30:11.912: I/dalvikvm-heap(17783): Grow heap (frag case) to 12.404MB for 3686416-byte allocation
02-14 17:30:11.927: D/dalvikvm(17783): GC_FOR_ALLOC freed <1K, 1% free 12669K/12736K, paused 20ms, total 20ms
02-14 17:30:12.341: D/dalvikvm(17783): GC_FOR_ALLOC freed 16K, 1% free 12696K/12748K, paused 24ms, total 24ms
02-14 17:30:12.349: I/dalvikvm-heap(17783): Grow heap (frag case) to 15.945MB for 3686416-byte allocation
02-14 17:30:12.373: D/dalvikvm(17783): GC_FOR_ALLOC freed <1K, 1% free 16296K/16352K, paused 24ms, total 24ms
02-14 17:30:12.560: D/OpenGLRenderer(17783): Enabling debug mode 0
02-14 17:30:18.045: D/dalvikvm(17783): GC_FOR_ALLOC freed 218K, 2% free 16377K/16632K, paused 20ms, total 20ms
02-14 17:30:18.052: I/dalvikvm-heap(17783): Grow heap (frag case) to 19.541MB for 3686416-byte allocation
02-14 17:30:18.076: D/dalvikvm(17783): GC_FOR_ALLOC freed 6K, 2% free 19971K/20236K, paused 21ms, total 22ms
02-14 17:30:28.529: D/dalvikvm(17783): GC_FOR_ALLOC freed 3899K, 20% free 16395K/20332K, paused 19ms, total 19ms
02-14 17:30:28.537: I/dalvikvm-heap(17783): Grow heap (frag case) to 19.557MB for 3686416-byte allocation
02-14 17:30:28.560: D/dalvikvm(17783): GC_FOR_ALLOC freed <1K, 2% free 19995K/20332K, paused 18ms, total 18ms
02-14 17:30:49.756: D/dalvikvm(17783): GC_FOR_ALLOC freed 4050K, 20% free 16464K/20552K, paused 20ms, total 34ms
02-14 17:30:49.763: I/dalvikvm-heap(17783): Grow heap (frag case) to 19.625MB for 3686416-byte allocation
02-14 17:30:49.779: D/dalvikvm(17783): GC_FOR_ALLOC freed 6K, 3% free 20057K/20552K, paused 21ms, total 21ms
02-14 17:30:57.107: D/dalvikvm(17783): GC_FOR_ALLOC freed 3938K, 21% free 16373K/20552K, paused 17ms, total 17ms
02-14 17:30:57.107: I/dalvikvm-heap(17783): Grow heap (frag case) to 19.536MB for 3686416-byte allocation
02-14 17:30:57.138: D/dalvikvm(17783): GC_FOR_ALLOC freed 14K, 3% free 19958K/20552K, paused 13ms, total 13ms
02-14 17:31:03.310: D/dalvikvm(17783): GC_FOR_ALLOC freed 3824K, 21% free 16370K/20552K, paused 31ms, total 31ms
02-14 17:31:03.310: I/dalvikvm-heap(17783): Grow heap (frag case) to 19.533MB for 3686416-byte allocation
02-14 17:31:03.381: D/dalvikvm(17783): GC_FOR_ALLOC freed 7K, 3% free 19962K/20552K, paused 30ms, total 30ms
02-14 17:33:31.943: D/dalvikvm(17783): GC_FOR_ALLOC freed 6253K, 27% free 17352K/23640K, paused 37ms, total 39ms
Thanks in advance

Android OnClickListner Start intent error

import com.nextgenintl.edlineformobile.R;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.ProgressBar;
#SuppressLint("SetJavaScriptEnabled")
public class MainActivity extends Activity {
/** Called when the activity is first created. */
private WebView myWebView;
private ProgressBar progressBar1;
private Button button1;
final Activity activity = this;
#Override
public void onBackPressed() {
if (myWebView.copyBackForwardList().getCurrentIndex() > 0) {
myWebView.goBack();
}
else {
super.onBackPressed(); // finishes activity
}
}
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().requestFeature(Window.FEATURE_PROGRESS);
setContentView(R.layout.activity_main);
myWebView = (WebView) findViewById(R.id.webView1);
progressBar1 = (ProgressBar) findViewById(R.id.progressBar1);
button1 = (Button) findViewById(R.id.button1);
//
String url = "http://www.example.com";
myWebView.setWebViewClient(new WebViewClient());
myWebView.getSettings().setJavaScriptEnabled(true);
myWebView.loadUrl(url);
button1.setOnClickListener( new View.OnClickListener() {
public void onClick(View v) {
String currentUrl = myWebView.getUrl();
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(currentUrl));
startActivity(i);
}
});
myWebView.setWebChromeClient(new WebChromeClient()
{
public void onProgressChanged(WebView view, int progress)
{
if (progress<100)
{
progressBar1.setVisibility(ProgressBar.VISIBLE);
}
else if (progress==100)
{
progressBar1.setVisibility(ProgressBar.GONE);
}
progressBar1.setProgress(progress);
}
});
}
}
I have this code, and on a button click, it is supposed to send the current url to a browser. However, the app crashes. What should I fix and how to properly use onckicklistner? I have seen many questions that did not solve my problem. Thank you.
EDIT
My log cat:
02-03 12:29:55.385: E/cutils-trace(1278): Error opening trace file: No such file or directory (2)
02-03 12:29:55.405: D/TilesManager(1278): Starting TG #0, 0xb8abf2e8
02-03 12:29:55.409: D/TilesManager(1278): new EGLContext from framework: b8a1fe00
02-03 12:29:55.409: D/GLWebViewState(1278): Reinit shader
02-03 12:29:55.717: D/GLWebViewState(1278): Reinit transferQueue
02-03 12:29:57.133: A/libc(1278): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 1299 (WebViewCoreThre)
02-03 12:30:01.613: D/dalvikvm(1324): Late-enabling CheckJNI
02-03 12:30:01.693: D/dalvikvm(1324): GC_FOR_ALLOC freed 168K, 25% free 2777K/3656K, paused 6ms, total 6ms
02-03 12:30:01.701: D/dalvikvm(1324): GC_FOR_ALLOC freed 0K, 24% free 2929K/3808K, paused 6ms, total 6ms
02-03 12:30:01.705: I/dalvikvm-heap(1324): Grow heap (frag case) to 3.878MB for 349068-byte allocation
02-03 12:30:01.709: D/dalvikvm(1324): GC_FOR_ALLOC freed 3K, 22% free 3267K/4152K, paused 2ms, total 2ms
02-03 12:30:01.717: D/dalvikvm(1324): GC_FOR_ALLOC freed 152K, 25% free 3267K/4304K, paused 3ms, total 3ms
02-03 12:30:01.721: I/dalvikvm-heap(1324): Grow heap (frag case) to 4.208MB for 349068-byte allocation
02-03 12:30:01.729: D/dalvikvm(1324): GC_FOR_ALLOC freed <1K, 23% free 3608K/4648K, paused 9ms, total 9ms
02-03 12:30:01.749: D/dalvikvm(1324): GC_FOR_ALLOC freed 151K, 23% free 3608K/4648K, paused 5ms, total 5ms
02-03 12:30:01.757: I/dalvikvm-heap(1324): Grow heap (frag case) to 4.542MB for 349068-byte allocation
02-03 12:30:01.765: D/dalvikvm(1324): GC_FOR_ALLOC freed <1K, 21% free 3949K/4992K, paused 3ms, total 3ms
02-03 12:30:01.765: D/dalvikvm(1324): GC_FOR_ALLOC freed 151K, 21% free 3950K/4992K, paused 2ms, total 2ms
02-03 12:30:01.765: I/dalvikvm-heap(1324): Grow heap (frag case) to 4.875MB for 349068-byte allocation
02-03 12:30:01.769: D/dalvikvm(1324): GC_FOR_ALLOC freed <1K, 20% free 4290K/5336K, paused 2ms, total 2ms
02-03 12:30:01.773: D/dalvikvm(1324): GC_FOR_ALLOC freed 151K, 20% free 4291K/5336K, paused 2ms, total 2ms
02-03 12:30:01.777: I/dalvikvm-heap(1324): Grow heap (frag case) to 5.208MB for 349068-byte allocation
02-03 12:30:01.777: D/dalvikvm(1324): GC_FOR_ALLOC freed 0K, 19% free 4632K/5680K, paused 2ms, total 2ms
02-03 12:30:01.785: D/dalvikvm(1324): GC_FOR_ALLOC freed 303K, 20% free 4822K/6024K, paused 3ms, total 3ms
02-03 12:30:01.789: D/dalvikvm(1324): GC_FOR_ALLOC freed <1K, 18% free 4974K/6024K, paused 3ms, total 3ms
02-03 12:30:01.797: D/dalvikvm(1324): GC_FOR_ALLOC freed 151K, 17% free 5315K/6368K, paused 3ms, total 3ms
02-03 12:30:01.813: D/dalvikvm(1324): GC_FOR_ALLOC freed 256K, 18% free 5738K/6936K, paused 2ms, total 2ms
02-03 12:30:01.813: I/dalvikvm-heap(1324): Grow heap (frag case) to 7.364MB for 1127532-byte allocation
02-03 12:30:01.817: D/dalvikvm(1324): GC_FOR_ALLOC freed 1K, 15% free 6838K/8040K, paused 3ms, total 3ms
02-03 12:30:01.821: D/dalvikvm(1324): GC_FOR_ALLOC freed <1K, 15% free 6837K/8040K, paused 3ms, total 3ms
02-03 12:30:01.829: I/dalvikvm-heap(1324): Grow heap (frag case) to 9.782MB for 2536932-byte allocation
02-03 12:30:01.833: D/dalvikvm(1324): GC_FOR_ALLOC freed <1K, 12% free 9314K/10520K, paused 5ms, total 5ms
02-03 12:30:01.937: D/dalvikvm(1324): GC_FOR_ALLOC freed 1585K, 21% free 9437K/11856K, paused 6ms, total 6ms
02-03 12:30:01.953: D/dalvikvm(1324): GC_FOR_ALLOC freed 456K, 12% free 10460K/11856K, paused 3ms, total 3ms
02-03 12:30:02.081: D/libEGL(1324): loaded /system/lib/egl/libEGL_genymotion.so
02-03 12:30:02.081: D/(1324): HostConnection::get() New Host Connection established 0xb8a4e328, tid 1324
02-03 12:30:02.093: D/libEGL(1324): loaded /system/lib/egl/libGLESv1_CM_genymotion.so
02-03 12:30:02.097: D/libEGL(1324): loaded /system/lib/egl/libGLESv2_genymotion.so
02-03 12:30:02.157: W/EGL_genymotion(1324): eglSurfaceAttrib not implemented
02-03 12:30:02.161: E/OpenGLRenderer(1324): Getting MAX_TEXTURE_SIZE from GradienCache
02-03 12:30:02.169: E/OpenGLRenderer(1324): Getting MAX_TEXTURE_SIZE from Caches::initConstraints()
02-03 12:30:02.173: D/OpenGLRenderer(1324): Enabling debug mode 0
02-03 12:30:04.161: W/chromium_net(1324): external/chromium/net/disk_cache/backend_impl.cc:1835: [0203/123004:WARNING:backend_impl.cc(1835)] Destroying invalid entry.
02-03 12:30:04.873: E/cutils-trace(1324): Error opening trace file: No such file or directory (2)
02-03 12:30:04.889: D/TilesManager(1324): Starting TG #0, 0xb8bb4350
02-03 12:30:04.889: D/TilesManager(1324): new EGLContext from framework: b8a50898
02-03 12:30:04.889: D/GLWebViewState(1324): Reinit shader
02-03 12:30:05.417: D/GLWebViewState(1324): Reinit transferQueue
02-03 12:45:45.121: D/dalvikvm(2158): GC_FOR_ALLOC freed 172K, 25% free 2777K/3660K, paused 4ms, total 4ms
02-03 12:45:45.125: D/dalvikvm(2158): GC_FOR_ALLOC freed 3K, 24% free 2925K/3812K, paused 3ms, total 3ms
02-03 12:45:45.125: I/dalvikvm-heap(2158): Grow heap (frag case) to 3.875MB for 349068-byte allocation
02-03 12:45:45.129: D/dalvikvm(2158): GC_FOR_ALLOC freed <1K, 22% free 3266K/4156K, paused 3ms, total 3ms
02-03 12:45:45.141: D/dalvikvm(2158): GC_FOR_ALLOC freed 151K, 25% free 3267K/4308K, paused 4ms, total 4ms
02-03 12:45:45.141: I/dalvikvm-heap(2158): Grow heap (frag case) to 4.208MB for 349068-byte allocation
02-03 12:45:45.149: D/dalvikvm(2158): GC_FOR_ALLOC freed <1K, 23% free 3608K/4652K, paused 2ms, total 4ms
02-03 12:45:45.153: D/dalvikvm(2158): GC_FOR_ALLOC freed 151K, 23% free 3608K/4652K, paused 1ms, total 1ms
02-03 12:45:45.153: I/dalvikvm-heap(2158): Grow heap (frag case) to 4.541MB for 349068-byte allocation
02-03 12:45:45.165: D/dalvikvm(2158): GC_FOR_ALLOC freed <1K, 21% free 3949K/4996K, paused 4ms, total 4ms
02-03 12:45:45.173: D/dalvikvm(2158): GC_FOR_ALLOC freed 151K, 21% free 3949K/4996K, paused 5ms, total 5ms
02-03 12:45:45.173: I/dalvikvm-heap(2158): Grow heap (frag case) to 4.875MB for 349068-byte allocation
02-03 12:45:45.193: D/dalvikvm(2158): GC_FOR_ALLOC freed <1K, 20% free 4290K/5340K, paused 2ms, total 2ms
02-03 12:45:45.217: D/dalvikvm(2158): GC_FOR_ALLOC freed 151K, 20% free 4291K/5340K, paused 18ms, total 21ms
02-03 12:45:45.221: I/dalvikvm-heap(2158): Grow heap (frag case) to 5.208MB for 349068-byte allocation
02-03 12:45:45.237: D/dalvikvm(2158): GC_FOR_ALLOC freed <1K, 19% free 4632K/5684K, paused 1ms, total 1ms
02-03 12:45:45.249: D/dalvikvm(2158): GC_FOR_ALLOC freed 303K, 20% free 4822K/6028K, paused 3ms, total 3ms
02-03 12:45:45.253: D/dalvikvm(2158): GC_FOR_ALLOC freed <1K, 18% free 4973K/6028K, paused 3ms, total 3ms
02-03 12:45:45.265: D/dalvikvm(2158): GC_FOR_ALLOC freed 151K, 17% free 5315K/6372K, paused 5ms, total 6ms
02-03 12:45:45.273: D/dalvikvm(2158): GC_FOR_ALLOC freed 256K, 18% free 5738K/6940K, paused 2ms, total 2ms
02-03 12:45:45.277: I/dalvikvm-heap(2158): Grow heap (frag case) to 7.364MB for 1127532-byte allocation
02-03 12:45:45.281: D/dalvikvm(2158): GC_FOR_ALLOC freed 1K, 15% free 6837K/8044K, paused 4ms, total 4ms
02-03 12:45:45.285: D/dalvikvm(2158): GC_FOR_ALLOC freed <1K, 16% free 6837K/8044K, paused 4ms, total 4ms
02-03 12:45:45.289: I/dalvikvm-heap(2158): Grow heap (frag case) to 9.782MB for 2536932-byte allocation
02-03 12:45:45.293: D/dalvikvm(2158): GC_FOR_ALLOC freed <1K, 12% free 9314K/10524K, paused 5ms, total 5ms
02-03 12:45:45.373: D/dalvikvm(2158): GC_FOR_ALLOC freed 1585K, 21% free 9437K/11860K, paused 2ms, total 2ms
02-03 12:45:45.385: D/dalvikvm(2158): GC_FOR_ALLOC freed 456K, 12% free 10460K/11860K, paused 4ms, total 5ms
02-03 12:45:45.393: D/AndroidRuntime(2158): Shutting down VM
02-03 12:45:45.393: W/dalvikvm(2158): threadid=1: thread exiting with uncaught exception (group=0xa4c0f648)
02-03 12:45:45.409: E/AndroidRuntime(2158): FATAL EXCEPTION: main
02-03 12:45:45.409: E/AndroidRuntime(2158): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.nextgenintl.edlineformobile/com.nextgenintl.edlineformobile.MainActivity}: java.lang.NullPointerException
02-03 12:45:45.409: E/AndroidRuntime(2158): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
02-03 12:45:45.409: E/AndroidRuntime(2158): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
02-03 12:45:45.409: E/AndroidRuntime(2158): at android.app.ActivityThread.access$600(ActivityThread.java:141)
02-03 12:45:45.409: E/AndroidRuntime(2158): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
02-03 12:45:45.409: E/AndroidRuntime(2158): at android.os.Handler.dispatchMessage(Handler.java:99)
02-03 12:45:45.409: E/AndroidRuntime(2158): at android.os.Looper.loop(Looper.java:137)
02-03 12:45:45.409: E/AndroidRuntime(2158): at android.app.ActivityThread.main(ActivityThread.java:5103)
02-03 12:45:45.409: E/AndroidRuntime(2158): at java.lang.reflect.Method.invokeNative(Native Method)
02-03 12:45:45.409: E/AndroidRuntime(2158): at java.lang.reflect.Method.invoke(Method.java:525)
02-03 12:45:45.409: E/AndroidRuntime(2158): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
02-03 12:45:45.409: E/AndroidRuntime(2158): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
02-03 12:45:45.409: E/AndroidRuntime(2158): at dalvik.system.NativeStart.main(Native Method)
02-03 12:45:45.409: E/AndroidRuntime(2158): Caused by: java.lang.NullPointerException
02-03 12:45:45.409: E/AndroidRuntime(2158): at com.nextgenintl.edlineformobile.MainActivity.onCreate(MainActivity.java:58)
02-03 12:45:45.409: E/AndroidRuntime(2158): at android.app.Activity.performCreate(Activity.java:5133)
02-03 12:45:45.409: E/AndroidRuntime(2158): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
02-03 12:45:45.409: E/AndroidRuntime(2158): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
02-03 12:45:45.409: E/AndroidRuntime(2158): ... 11 more
02-03 12:45:48.285: D/dalvikvm(2185): GC_FOR_ALLOC freed 175K, 25% free 2777K/3664K, paused 4ms, total 4ms
02-03 12:45:48.289: D/dalvikvm(2185): GC_FOR_ALLOC freed 0K, 24% free 2929K/3816K, paused 4ms, total 4ms
02-03 12:45:48.293: I/dalvikvm-heap(2185): Grow heap (frag case) to 3.878MB for 349068-byte allocation
02-03 12:45:48.305: D/dalvikvm(2185): GC_FOR_ALLOC freed 3K, 22% free 3266K/4160K, paused 10ms, total 10ms
02-03 12:45:48.317: D/dalvikvm(2185): GC_FOR_ALLOC freed 152K, 25% free 3267K/4312K, paused 3ms, total 3ms
02-03 12:45:48.321: I/dalvikvm-heap(2185): Grow heap (frag case) to 4.208MB for 349068-byte allocation
02-03 12:45:48.341: D/dalvikvm(2185): GC_FOR_ALLOC freed <1K, 23% free 3608K/4656K, paused 21ms, total 21ms
02-03 12:45:48.353: D/dalvikvm(2185): GC_FOR_ALLOC freed 151K, 23% free 3608K/4656K, paused 4ms, total 4ms
02-03 12:45:48.353: I/dalvikvm-heap(2185): Grow heap (frag case) to 4.541MB for 349068-byte allocation
02-03 12:45:48.357: D/dalvikvm(2185): GC_FOR_ALLOC freed <1K, 22% free 3949K/5000K, paused 2ms, total 2ms
02-03 12:45:48.365: D/dalvikvm(2185): GC_FOR_ALLOC freed 151K, 22% free 3949K/5000K, paused 3ms, total 3ms
02-03 12:45:48.365: I/dalvikvm-heap(2185): Grow heap (frag case) to 4.875MB for 349068-byte allocation
02-03 12:45:48.369: D/dalvikvm(2185): GC_FOR_ALLOC freed <1K, 20% free 4290K/5344K, paused 4ms, total 4ms
02-03 12:45:48.373: D/dalvikvm(2185): GC_FOR_ALLOC freed 151K, 20% free 4291K/5344K, paused 2ms, total 2ms
02-03 12:45:48.373: I/dalvikvm-heap(2185): Grow heap (frag case) to 5.208MB for 349068-byte allocation
02-03 12:45:48.381: D/dalvikvm(2185): GC_FOR_ALLOC freed <1K, 19% free 4632K/5688K, paused 3ms, total 4ms
02-03 12:45:48.393: D/dalvikvm(2185): GC_FOR_ALLOC freed 303K, 21% free 4822K/6032K, paused 2ms, total 2ms
02-03 12:45:48.397: D/dalvikvm(2185): GC_FOR_ALLOC freed <1K, 18% free 4973K/6032K, paused 2ms, total 2ms
02-03 12:45:48.405: D/dalvikvm(2185): GC_FOR_ALLOC freed 151K, 17% free 5315K/6376K, paused 3ms, total 3ms
02-03 12:45:48.417: D/dalvikvm(2185): GC_FOR_ALLOC freed 256K, 18% free 5738K/6944K, paused 2ms, total 2ms
02-03 12:45:48.417: I/dalvikvm-heap(2185): Grow heap (frag case) to 7.364MB for 1127532-byte allocation
02-03 12:45:48.421: D/dalvikvm(2185): GC_FOR_ALLOC freed 1K, 16% free 6837K/8048K, paused 3ms, total 3ms
02-03 12:45:48.425: D/dalvikvm(2185): GC_FOR_ALLOC freed <1K, 16% free 6837K/8048K, paused 3ms, total 3ms
02-03 12:45:48.429: I/dalvikvm-heap(2185): Grow heap (frag case) to 9.782MB for 2536932-byte allocation
02-03 12:45:48.433: D/dalvikvm(2185): GC_FOR_ALLOC freed <1K, 12% free 9314K/10528K, paused 3ms, total 3ms
02-03 12:45:48.505: D/dalvikvm(2185): GC_FOR_ALLOC freed 1585K, 21% free 9437K/11864K, paused 2ms, total 2ms
02-03 12:45:48.521: D/dalvikvm(2185): GC_FOR_ALLOC freed 456K, 12% free 10460K/11864K, paused 6ms, total 6ms
02-03 12:45:48.529: D/AndroidRuntime(2185): Shutting down VM
02-03 12:45:48.529: W/dalvikvm(2185): threadid=1: thread exiting with uncaught exception (group=0xa4c0f648)
02-03 12:45:48.529: E/AndroidRuntime(2185): FATAL EXCEPTION: main
02-03 12:45:48.529: E/AndroidRuntime(2185): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.nextgenintl.edlineformobile/com.nextgenintl.edlineformobile.MainActivity}: java.lang.NullPointerException
02-03 12:45:48.529: E/AndroidRuntime(2185): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
02-03 12:45:48.529: E/AndroidRuntime(2185): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
02-03 12:45:48.529: E/AndroidRuntime(2185): at android.app.ActivityThread.access$600(ActivityThread.java:141)
02-03 12:45:48.529: E/AndroidRuntime(2185): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
02-03 12:45:48.529: E/AndroidRuntime(2185): at android.os.Handler.dispatchMessage(Handler.java:99)
02-03 12:45:48.529: E/AndroidRuntime(2185): at android.os.Looper.loop(Looper.java:137)
02-03 12:45:48.529: E/AndroidRuntime(2185): at android.app.ActivityThread.main(ActivityThread.java:5103)
02-03 12:45:48.529: E/AndroidRuntime(2185): at java.lang.reflect.Method.invokeNative(Native Method)
02-03 12:45:48.529: E/AndroidRuntime(2185): at java.lang.reflect.Method.invoke(Method.java:525)
02-03 12:45:48.529: E/AndroidRuntime(2185): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
02-03 12:45:48.529: E/AndroidRuntime(2185): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
02-03 12:45:48.529: E/AndroidRuntime(2185): at dalvik.system.NativeStart.main(Native Method)
02-03 12:45:48.529: E/AndroidRuntime(2185): Caused by: java.lang.NullPointerException
02-03 12:45:48.529: E/AndroidRuntime(2185): at com.nextgenintl.edlineformobile.MainActivity.onCreate(MainActivity.java:58)
02-03 12:45:48.529: E/AndroidRuntime(2185): at android.app.Activity.performCreate(Activity.java:5133)
02-03 12:45:48.529: E/AndroidRuntime(2185): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
02-03 12:45:48.529: E/AndroidRuntime(2185): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
02-03 12:45:48.529: E/AndroidRuntime(2185): ... 11 more
The url is null because the page loading is not finished yed. You can check if the theUrl is null or not. and use the following code to set theUrl
String theUrl;
WebView webView = new WebView(this);
setContentView(webView);
webview.setWebViewClient(new WebViewClient() {
public void onPageFinished(WebView view, String url) {
theUrl = url;
}
});
webView.loadUrl(myURL);

ZXing onActivityResult not called multiple times

I'm trying to integrate ZXing in my project, but having problems. It works correctly on the first scan, and on the second scan. But on the third+ scans the onActivityResult method never gets fired.
Here is where I start the scan:
public void performScan(){
IntentIntegrator scanIntegrator = new IntentIntegrator(thisActivity);
scanIntegrator.initiateScan();
}
Here is my onActivityResult method:
#Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
//retrieve scan result
Log.w("ZZ", activityName + ": onActivityResult ... requestCode=" + requestCode + " ... resultCode=" + resultCode);
//BT_debugger.showIt(activityName + ": onActivityResult ... requestCode=" + requestCode + " ... resultCode=" + resultCode);
if (resultCode == RESULT_OK){
IntentResult scanningResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
if (scanningResult != null) {
//we have a result
String scanContent = scanningResult.getContents();
//resultText.setText(scanContent);
if (scanContent.length()>0) loadQuestion(scanContent);
else {
Toast toast = Toast.makeText(getApplicationContext(),
"No scan data received!", Toast.LENGTH_SHORT);
toast.show();
}
}
else{
Toast toast = Toast.makeText(getApplicationContext(),
"No scan data received!", Toast.LENGTH_SHORT);
toast.show();
}
}
}
And here is the resulting LogCat starting with the scan that doesn't work.
09-02 01:24:48.310 435-13722/? I/ActivityManager: START u0 {act=com.google.zxing.client.android.SCAN cat=[android.intent.category.DEFAULT] flg=0x4080000 pkg=com.google.zxing.client.android cmp=com.google.zxing.client.android/.CaptureActivity} from pid 8312
09-02 01:24:48.310 435-13722/? W/ActivityManager: startActivity called from non-Activity context; forcing Intent.FLAG_ACTIVITY_NEW_TASK for: Intent { act=com.google.zxing.client.android.SCAN cat=[android.intent.category.DEFAULT] flg=0x4080000 pkg=com.google.zxing.client.android cmp=com.google.zxing.client.android/.CaptureActivity }
09-02 01:24:48.340 8312-8312/com.testrotary I/Choreographer: Skipped 50 frames! The application may be doing too much work on its main thread.
09-02 01:24:48.410 8312-8312/com.testrotary W/ZZ: Cr_rr_qrreader:onPause (BASE CLASS)
09-02 01:24:48.430 435-682/? I/ActivityManager: Config changes=1480 {1.0 310mcc?mnc en_US ldltr sw600dp w961dp h528dp 213dpi lrg land finger -keyb/v/h -nav/h s.259}
09-02 01:24:48.550 435-487/? I/InputReader: Reconfiguring input devices. changes=0x00000004
09-02 01:24:48.550 435-487/? I/InputReader: Device reconfigured: id=2, name='elan-touchscreen', size 800x1280, orientation 1, mode 1, display id 0
09-02 01:24:48.550 435-487/? I/InputReader: Reconfiguring input devices. changes=0x00000004
09-02 01:24:48.550 435-487/? I/InputReader: Device reconfigured: id=2, name='elan-touchscreen', size 800x1280, orientation 1, mode 1, display id 0
09-02 01:24:48.620 4263-4271/? W/MediaPlayer-JNI: MediaPlayer finalized without being released
09-02 01:24:48.620 4263-4267/? D/dalvikvm: GC_CONCURRENT freed 407K, 13% free 8241K/9396K, paused 7ms+26ms, total 63ms
09-02 01:24:48.640 4263-4263/? I/PlatformSupportManager: Using implementation class com.google.zxing.client.android.common.executor.HoneycombAsyncTaskExecInterface of interface com.google.zxing.client.android.common.executor.AsyncTaskExecInterface for SDK 11
09-02 01:24:48.720 520-520/? D/PhoneStatusBar: mSettingsPanelGravity = 8388661
09-02 01:24:48.760 8312-8312/com.testrotary W/ZZ: testrotary_appDelegate: onTrimMemory with level: 20
09-02 01:24:48.820 4263-4263/? I/com.google.zxing.client.android.camera.open.OpenCameraInterface: No camera facing back; returning camera #0
09-02 01:24:48.820 125-459/? I/AwesomePlayer: setDataSource_l(URL suppressed)
09-02 01:24:48.850 3245-3249/? D/dalvikvm: GC_CONCURRENT freed 386K, 8% free 7878K/8488K, paused 72ms+2ms, total 188ms
09-02 01:24:48.860 125-459/? I/AwesomePlayer: setDataSource_l(URL suppressed)
09-02 01:24:48.890 125-459/? I/CameraClient: Opening camera 0
09-02 01:24:48.890 125-459/? I/NvOmxCamera: HAL_camera_device_open: open camera 0
09-02 01:24:48.920 125-8922/? E/: ioctl SetWhiteBalance failed: -1
09-02 01:24:48.920 125-459/? E/NvOmxCameraSettingsParser: Param type 70 not supported
09-02 01:24:48.920 125-459/? I/NvOmxCamera: HAL_camera_device_open: opened camera 0 (0x4761bb20)
09-02 01:24:48.930 4263-4263/? I/CameraConfiguration: Screen resolution: Point(1280, 736)
09-02 01:24:48.930 4263-4263/? I/CameraConfiguration: Supported preview sizes: 1280x720 960x720 720x576 704x576 800x448 720x480 768x432 640x480 720x408 480x480 352x288 320x240 176x144
09-02 01:24:48.930 4263-4263/? I/CameraConfiguration: Using largest suitable preview size: Point(1280, 720)
09-02 01:24:48.930 4263-4263/? I/CameraConfiguration: Camera resolution: Point(1280, 720)
09-02 01:24:48.930 4263-4263/? I/CameraConfiguration: Initial camera parameters: preferred-preview-size-for-video=720x576;rotation-values=0,90,180,270;zoom=0;recording-hint=false;max-num-detected-faces-hw=0;video-stabilization=false;zoom-supported=true;whitebalance=auto;video-stabilization-values=false,true;jpeg-quality=95;nv-flip-preview=off;preview-format-values=yuv420p,yuv420sp;rotation=0;jpeg-thumbnail-quality=90;preview-format=yuv420sp;metering-areas=(0,0,0,0,0);video-frame-format-values=yuv420p;video-size-values=40x30,176x144,320x240,352x288,640x480,704x576,720x480,720x576,768x432,1280x720;nv-flip-preview-values=off,vertical,horizontal,both;preview-size=320x240;focal-length=2.080;preview-frame-rate-values=5,8,10,15,20,24,25,30;max-num-metering-areas=0;preview-frame-rate=30;nv-flip-still=off;focus-mode-values=fixed;jpeg-thumbnail-width=320;video-size=1280x720;preview-fps-range-values=(4000,60000);jpeg-thumbnail-size-values=0x0,320x240;zoom-ratios=100,125,150,175,200,225,250,275,300,325,350,375,400,425,450,475,500,525,550,575,600,625,650,675,700,725,750,775,800;preview-size-values=176x144,320x240,352x288,480x480,640x480,704x576,720x408,720x480,720x576,768x432,800x448,960x720,1280x720;recording-hint-values=false,true;picture-size-values=320x240,480x480,640x480,800x600,1024x768,1280x720,1280x960;preview-fps-range=4000,60000;auto-whitebalance-lock=false;min-exposure-compensation=-20;antibanding=off;max-num-focus-areas=0;vertical-view-angle=72.600;horizontal-view-angle=72.600;video-stabilization-supported=false;jpeg-thumbnail-height=240;smooth-zoom-supported=true;focus-mode=fixed;nv-flip-still-values=off,vertical,horizontal,both;auto-whitebalance-lock-supported=true;video-frame-format=yuv420p;picture-format-values=jpeg,jfif,exif;max-exposure-compensation=20;video-snapshot-supported=true;exposure-compensation=0;exposure-compensation-step=0.1;auto-exposure-lock=false;effect-values=mono,negative,none,posterize,sepia,aqua,solarize,nv-vivid,nv-emboss;picture-size=1280x960;max-zoom=28;effect=none;whitebalance-values=auto,incandescent,fluorescent,daylight;picture-format=jpeg;focus-distances=0.95,1.9,Infinity;auto-exposure-lock-values=false,true;auto-exposure-lock-supported=true;auto-whitebalance-lock-values=false,true;antibanding-values=off,auto,50hz,60hz
09-02 01:24:48.930 4263-4263/? I/CameraConfiguration: Supported values: null
09-02 01:24:48.940 4263-4263/? I/CameraConfiguration: Settable value: null
09-02 01:24:48.940 4263-4263/? I/CameraConfiguration: Supported values: [fixed]
09-02 01:24:48.940 4263-4263/? I/CameraConfiguration: Settable value: null
09-02 01:24:48.940 4263-4263/? I/CameraConfiguration: Supported values: [fixed]
09-02 01:24:48.940 4263-4263/? I/CameraConfiguration: Settable value: null
09-02 01:24:48.940 4263-4263/? I/DecodeThread: Hints: {POSSIBLE_FORMATS=[CODABAR, CODE_39, CODE_93, CODE_128, DATA_MATRIX, EAN_8, EAN_13, ITF, QR_CODE, RSS_14, RSS_EXPANDED, UPC_A, UPC_E], NEED_RESULT_POINT_CALLBACK=com.google.zxing.client.android.ViewfinderResultPointCallback#420c8040}
09-02 01:24:48.960 125-8929/? D/NvOsDebugPrintf: NvMMLiteBlockCreate : Block : BlockType = 1
09-02 01:24:48.970 125-8929/? D/NvOsDebugPrintf: NvMMLiteJPEGEncGetBufferRequirements : BufferSize 1843200
09-02 01:24:49.020 125-8922/? D/: Camera fd open as: 151
09-02 01:24:49.550 125-8929/? D/NvOsDebugPrintf: Image Physically rotated in DZ
09-02 01:24:49.550 125-8929/? D/NvOsDebugPrintf: NvMMExif_Orientation_0_Degrees= 1
09-02 01:24:49.550 125-889/? E/NvOmxCamera: OMX_ERRORTYPE android::NvOmxCamera::getCameraStereoMode(NvxComponent*, NvOmxCameraUserStereoMode&): Error: invalid NVX mode 0.
09-02 01:24:49.550 125-889/? E/NvOmxCamera: OMX_ERRORTYPE android::NvOmxCamera::getCameraStereoModeAndCaptureInfo(NvxComponent*, NvOmxCameraUserStereoMode&, NVX_STEREOCAPTUREINFO&): getCameraStereoMode failed with 0x00000000
09-02 01:24:49.580 4263-4263/? I/PlatformSupportManager: Using implementation class com.google.zxing.client.android.common.executor.HoneycombAsyncTaskExecInterface of interface com.google.zxing.client.android.common.executor.AsyncTaskExecInterface for SDK 11
09-02 01:24:49.580 4263-4263/? I/AutoFocusManager: Current focus mode 'fixed'; use auto focus? false
09-02 01:24:49.600 4263-4263/? I/Choreographer: Skipped 47 frames! The application may be doing too much work on its main thread.
09-02 01:24:49.610 4263-4263/? D/CameraManager: Calculated framing rect: Rect(240, 138 - 1040, 598)
09-02 01:24:49.680 435-451/? I/ActivityManager: Displayed com.google.zxing.client.android/.CaptureActivity: +1s277ms
09-02 01:24:49.680 435-606/? W/InputMethodManagerService: Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy#42ac36f8 (uid=10069 pid=8312)
09-02 01:24:49.690 8312-8312/com.testrotary W/IInputConnectionWrapper: showStatusIcon on inactive InputConnection
09-02 01:24:49.700 122-159/? I/hwcomposer: Setting interactive mode: Off
09-02 01:24:49.740 435-451/? I/WindowManager: Screen frozen for +1s332ms due to Window{425238e0 u0 Starting com.google.zxing.client.android}
09-02 01:24:49.790 4263-4273/? D/dalvikvm: GC_FOR_ALLOC freed 173K, 12% free 8309K/9396K, paused 95ms, total 95ms
09-02 01:24:49.800 4263-4273/? I/dalvikvm-heap: Grow heap (frag case) to 9.491MB for 1382416-byte allocation
09-02 01:24:49.820 122-159/? I/hwcomposer: Setting interactive mode: On
09-02 01:24:49.840 4263-4263/? D/dalvikvm: GC_FOR_ALLOC freed 2K, 11% free 9656K/10748K, paused 38ms, total 38ms
09-02 01:24:49.890 4263-4267/? D/dalvikvm: GC_CONCURRENT freed 4K, 11% free 9654K/10748K, paused 3ms+2ms, total 51ms
09-02 01:24:49.940 8312-8312/com.testrotary W/ZZ: Cr_rr_qrreader:onStop (BASE CLASS)
09-02 01:24:50.100 4263-7700/? D/dalvikvm: GC_FOR_ALLOC freed 1791K, 23% free 8304K/10748K, paused 27ms, total 27ms
09-02 01:24:50.100 4263-7700/? I/dalvikvm-heap: Grow heap (frag case) to 9.486MB for 1382416-byte allocation
09-02 01:24:50.130 4263-4271/? D/dalvikvm: GC_FOR_ALLOC freed 0K, 11% free 9654K/10748K, paused 29ms, total 29ms
09-02 01:24:50.150 122-159/? I/hwcomposer: Setting interactive mode: Off
09-02 01:24:50.170 4263-4267/? D/dalvikvm: GC_CONCURRENT freed 4K, 11% free 9657K/10748K, paused 3ms+10ms, total 41ms
09-02 01:24:50.350 4263-4274/? D/dalvikvm: GC_FOR_ALLOC freed 1780K, 23% free 8304K/10748K, paused 28ms, total 28ms
09-02 01:24:50.350 4263-4274/? I/dalvikvm-heap: Grow heap (frag case) to 9.486MB for 1382416-byte allocation
09-02 01:24:50.380 4263-4271/? D/dalvikvm: GC_FOR_ALLOC freed 0K, 11% free 9654K/10748K, paused 23ms, total 23ms
09-02 01:24:50.410 4263-4267/? D/dalvikvm: GC_CONCURRENT freed 6K, 11% free 9656K/10748K, paused 3ms+4ms, total 29ms
09-02 01:24:50.600 4263-4273/? D/dalvikvm: GC_FOR_ALLOC freed 1780K, 23% free 8304K/10748K, paused 30ms, total 30ms
09-02 01:24:50.600 4263-4273/? I/dalvikvm-heap: Grow heap (frag case) to 9.486MB for 1382416-byte allocation
09-02 01:24:50.630 4263-4271/? D/dalvikvm: GC_FOR_ALLOC freed 0K, 11% free 9654K/10748K, paused 28ms, total 28ms
09-02 01:24:50.660 4263-4267/? D/dalvikvm: GC_CONCURRENT freed 7K, 11% free 9656K/10748K, paused 9ms+1ms, total 33ms
09-02 01:24:50.800 4263-4546/? D/dalvikvm: GC_FOR_ALLOC freed 1777K, 23% free 8304K/10748K, paused 26ms, total 26ms
09-02 01:24:50.800 4263-4546/? I/dalvikvm-heap: Grow heap (frag case) to 9.486MB for 1382416-byte allocation
09-02 01:24:50.820 4263-4271/? D/dalvikvm: GC_FOR_ALLOC freed 0K, 11% free 9654K/10748K, paused 18ms, total 18ms
09-02 01:24:50.850 4263-4267/? D/dalvikvm: GC_CONCURRENT freed 5K, 11% free 9657K/10748K, paused 5ms+3ms, total 28ms
09-02 01:24:50.960 4263-7700/? D/dalvikvm: GC_FOR_ALLOC freed 1781K, 23% free 8304K/10748K, paused 17ms, total 17ms
09-02 01:24:50.960 4263-7700/? I/dalvikvm-heap: Grow heap (frag case) to 9.486MB for 1382416-byte allocation
09-02 01:24:50.980 4263-4271/? D/dalvikvm: GC_FOR_ALLOC freed 0K, 11% free 9654K/10748K, paused 21ms, total 21ms
09-02 01:24:51.010 4263-4267/? D/dalvikvm: GC_CONCURRENT freed 6K, 11% free 9656K/10748K, paused 9ms+2ms, total 28ms
09-02 01:24:51.200 4263-4274/? D/dalvikvm: GC_FOR_ALLOC freed 1777K, 23% free 8304K/10748K, paused 25ms, total 25ms
09-02 01:24:51.200 4263-4274/? I/dalvikvm-heap: Grow heap (frag case) to 9.486MB for 1382416-byte allocation
09-02 01:24:51.220 4263-4271/? D/dalvikvm: GC_FOR_ALLOC freed 0K, 11% free 9654K/10748K, paused 19ms, total 19ms
09-02 01:24:51.260 4263-4267/? D/dalvikvm: GC_CONCURRENT freed 9K, 11% free 9656K/10748K, paused 9ms+5ms, total 34ms
09-02 01:24:51.410 4263-4273/? D/dalvikvm: GC_FOR_ALLOC freed 1775K, 23% free 8304K/10748K, paused 23ms, total 23ms
09-02 01:24:51.410 4263-4273/? I/dalvikvm-heap: Grow heap (frag case) to 9.486MB for 1382416-byte allocation
09-02 01:24:51.430 4263-4271/? D/dalvikvm: GC_FOR_ALLOC freed 0K, 11% free 9654K/10748K, paused 24ms, total 24ms
09-02 01:24:51.470 4263-4267/? D/dalvikvm: GC_CONCURRENT freed 1K, 11% free 9656K/10748K, paused 2ms+4ms, total 40ms
09-02 01:24:51.640 4263-4546/? D/dalvikvm: GC_FOR_ALLOC freed 1785K, 23% free 8304K/10748K, paused 16ms, total 16ms
09-02 01:24:51.640 4263-4546/? I/dalvikvm-heap: Grow heap (frag case) to 9.487MB for 1382416-byte allocation
09-02 01:24:51.660 4263-4271/? D/dalvikvm: GC_FOR_ALLOC freed 0K, 11% free 9654K/10748K, paused 25ms, total 25ms
09-02 01:24:51.690 4263-4267/? D/dalvikvm: GC_CONCURRENT freed 5K, 11% free 9656K/10748K, paused 2ms+3ms, total 30ms
09-02 01:24:51.870 4263-7700/? D/dalvikvm: GC_FOR_ALLOC freed 1779K, 23% free 8304K/10748K, paused 21ms, total 21ms
09-02 01:24:51.870 4263-7700/? I/dalvikvm-heap: Grow heap (frag case) to 9.486MB for 1382416-byte allocation
09-02 01:24:51.890 435-451/? D/dalvikvm: GC_EXPLICIT freed 1189K, 27% free 20885K/28352K, paused 13ms+10ms, total 135ms
09-02 01:24:51.890 4263-4271/? D/dalvikvm: GC_FOR_ALLOC freed 0K, 11% free 9654K/10748K, paused 25ms, total 25ms
09-02 01:24:51.920 4263-4267/? D/dalvikvm: GC_CONCURRENT freed 8K, 11% free 9656K/10748K, paused 3ms+3ms, total 27ms
09-02 01:24:52.100 4263-4546/? D/dalvikvm: GC_FOR_ALLOC freed 1778K, 23% free 8304K/10748K, paused 42ms, total 42ms
09-02 01:24:52.100 4263-4546/? I/dalvikvm-heap: Grow heap (frag case) to 9.486MB for 1382416-byte allocation
09-02 01:24:52.150 4263-4271/? D/dalvikvm: GC_FOR_ALLOC freed <1K, 11% free 9654K/10748K, paused 47ms, total 47ms
09-02 01:24:52.170 4263-4267/? D/dalvikvm: GC_CONCURRENT freed 5K, 11% free 9656K/10748K, paused 3ms+6ms, total 24ms
09-02 01:24:52.260 4263-8928/? D/DecodeHandler: Found barcode in 105 ms
09-02 01:24:52.300 4263-8928/? D/dalvikvm: GC_FOR_ALLOC freed 432K, 11% free 9655K/10748K, paused 45ms, total 45ms
09-02 01:24:52.350 4263-4267/? D/dalvikvm: GC_CONCURRENT freed 2K, 4% free 10369K/10748K, paused 8ms+3ms, total 33ms
09-02 01:24:52.350 4263-8928/? D/dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 7ms
09-02 01:24:52.350 4263-4263/? D/CaptureActivityHandler: Got decode succeeded message
09-02 01:24:52.380 4263-4263/? D/dalvikvm: GC_FOR_ALLOC freed 2077K, 22% free 8666K/11100K, paused 18ms, total 18ms
09-02 01:24:53.990 4263-4263/? D/CaptureActivityHandler: Got return scan result message
09-02 01:24:54.160 125-8922/? D/: Camera fd close (MI1040)
09-02 01:24:54.220 125-481/? E/NvOmxCamera: Already called release()
09-02 01:24:54.220 125-481/? I/CameraClient: Destroying camera 0
09-02 01:24:54.220 125-481/? W/NvOmxCamera: Already called release()
09-02 01:24:54.230 125-459/? W/AudioFlinger: session id 3092 not found for pid 125
09-02 01:24:54.230 125-459/? W/AudioFlinger: session id 3093 not found for pid 125
09-02 01:24:54.270 435-487/? I/InputReader: Reconfiguring input devices. changes=0x00000004
09-02 01:24:54.270 435-487/? I/InputReader: Device reconfigured: id=2, name='elan-touchscreen', size 800x1280, orientation 0, mode 1, display id 0
09-02 01:24:54.270 435-1814/? I/ActivityManager: Config changes=1480 {1.0 310mcc?mnc en_US ldltr sw600dp w600dp h880dp 213dpi lrg port finger -keyb/v/h -nav/h s.260}
09-02 01:24:54.310 8312-8312/com.testrotary W/ZZ: Cr_rr_qrreader:onStart (BASE CLASS)
09-02 01:24:54.310 8312-8312/com.testrotary W/ZZ: Cr_rr_qrreader: start GPS is set to NO in the applications configuration data, not starting GPS
09-02 01:24:54.310 8312-8312/com.testrotary W/ZZ: Cr_rr_qrreader:onResume (BASE CLASS)
09-02 01:24:54.330 122-159/? I/hwcomposer: Setting interactive mode: On
09-02 01:24:54.390 4263-4263/? W/IInputConnectionWrapper: showStatusIcon on inactive InputConnection
09-02 01:24:54.400 520-520/? D/PhoneStatusBar: mSettingsPanelGravity = 8388661
09-02 01:24:54.420 520-520/? V/PhoneStatusBar: setLightsOn(true)
09-02 01:24:54.450 14442-14445/? D/dalvikvm: GC_CONCURRENT freed 383K, 6% free 7613K/8068K, paused 1ms+3ms, total 147ms
09-02 01:24:54.540 435-451/? I/WindowManager: Screen frozen for +302ms due to Window{4237e0a8 u0 com.testrotary/com.testrotary.Cr_rr_qrreader}
09-02 01:24:56.650 435-451/? D/dalvikvm: GC_EXPLICIT freed 631K, 26% free 21049K/28352K, paused 15ms+9ms, total 111ms
09-02 01:30:01.270 14442-14442/? V/DigitalWidgetViewsFactory: DigitalWidget sets next alarm string to null
09-02 01:30:24.050 435-508/? I/ActivityManager: Start proc com.google.android.apps.currents for service com.google.android.apps.currents/com.google.apps.dots.android.app.service.SyncService: pid=9079 uid=10009 gids={50009, 3003, 1015, 1028}
09-02 01:30:24.450 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 266K, 5% free 7663K/7992K, paused 4ms+1ms, total 31ms
09-02 01:30:24.450 9079-9097/? D/ActivityThread: Loading provider com.google.android.apps.currents: com.google.apps.dots.android.currents.provider.CurrentsContentProvider
09-02 01:30:24.560 9079-9079/? W/GAV2: Thread[main,5,main]: Need to call initialize() and be in fallback mode to start dispatch.
09-02 01:30:24.740 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 341K, 5% free 7833K/8236K, paused 2ms+2ms, total 20ms
09-02 01:30:24.740 9079-9079/? D/dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 5ms
09-02 01:30:24.740 9079-9079/? I/DotsApplication: Starting up...
09-02 01:30:24.760 9079-9107/? I/SyncService: Starting background sync (01:30:24)
09-02 01:30:27.260 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 249K, 4% free 7985K/8296K, paused 6ms+3ms, total 23ms
09-02 01:30:27.890 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 337K, 5% free 8077K/8476K, paused 3ms+3ms, total 30ms
09-02 01:30:27.990 9079-9110/? D/dalvikvm: GC_FOR_ALLOC freed 111K, 4% free 8289K/8628K, paused 16ms, total 16ms
09-02 01:30:28.020 9079-9110/? D/dalvikvm: GC_FOR_ALLOC freed 348K, 7% free 8278K/8840K, paused 15ms, total 15ms
09-02 01:30:28.510 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 497K, 7% free 8285K/8848K, paused 2ms+3ms, total 23ms
09-02 01:30:28.620 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 258K, 4% free 8517K/8848K, paused 3ms+5ms, total 26ms
09-02 01:30:28.680 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 271K, 4% free 8750K/9088K, paused 2ms+2ms, total 20ms
09-02 01:30:28.680 9079-9110/? D/dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 7ms
09-02 01:30:28.730 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 285K, 4% free 8972K/9324K, paused 3ms+2ms, total 25ms
09-02 01:30:28.730 9079-9110/? D/dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 10ms
09-02 01:30:28.790 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 335K, 5% free 9136K/9540K, paused 3ms+2ms, total 26ms
09-02 01:30:28.790 9079-9110/? D/dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 4ms
09-02 01:30:28.840 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 403K, 5% free 9209K/9680K, paused 2ms+2ms, total 24ms
09-02 01:30:29.160 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 433K, 6% free 9275K/9776K, paused 5ms+2ms, total 35ms
09-02 01:30:29.620 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 488K, 6% free 9280K/9836K, paused 3ms+3ms, total 31ms
09-02 01:30:29.760 9079-9102/? I/GAV2: Thread[GAThread,5,main]: No campaign data found.
09-02 01:30:29.930 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 469K, 6% free 9405K/9940K, paused 2ms+3ms, total 26ms
09-02 01:30:30.000 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 542K, 7% free 9415K/10108K, paused 3ms+1ms, total 22ms
09-02 01:30:30.000 9079-9110/? D/dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 19ms
09-02 01:30:30.100 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 496K, 7% free 9479K/10108K, paused 3ms+2ms, total 26ms
09-02 01:30:30.340 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 712K, 8% free 9403K/10184K, paused 2ms+3ms, total 25ms
09-02 01:30:30.560 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 633K, 8% free 9415K/10184K, paused 2ms+2ms, total 28ms
09-02 01:30:30.560 9079-9110/? D/dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 7ms
09-02 01:30:30.770 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 505K, 7% free 9512K/10184K, paused 3ms+2ms, total 26ms
09-02 01:30:30.990 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 633K, 7% free 9529K/10232K, paused 3ms+3ms, total 30ms
09-02 01:30:31.090 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 627K, 7% free 9585K/10280K, paused 1ms+2ms, total 25ms
09-02 01:30:31.090 9079-9110/? D/dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 8ms
09-02 01:30:31.200 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 560K, 7% free 9625K/10280K, paused 1ms+2ms, total 24ms
09-02 01:30:31.490 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 696K, 8% free 9611K/10376K, paused 2ms+2ms, total 25ms
09-02 01:30:31.630 9079-9110/? D/dalvikvm: GC_FOR_ALLOC freed 344K, 7% free 9653K/10376K, paused 22ms, total 22ms
09-02 01:30:31.690 9079-9110/? D/dalvikvm: GC_FOR_ALLOC freed 481K, 8% free 9669K/10444K, paused 21ms, total 21ms
09-02 01:30:31.790 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 615K, 7% free 9780K/10464K, paused 3ms+2ms, total 27ms
09-02 01:30:31.790 9079-9110/? D/dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 6ms
09-02 01:30:32.020 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 752K, 8% free 9789K/10612K, paused 3ms+2ms, total 28ms
09-02 01:30:32.020 9079-9110/? D/dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 12ms
09-02 01:30:32.350 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 844K, 9% free 9710K/10624K, paused 3ms+2ms, total 27ms
09-02 01:30:32.350 9079-9110/? D/dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 11ms
09-02 01:30:32.570 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 708K, 9% free 9724K/10624K, paused 3ms+1ms, total 27ms
09-02 01:30:32.770 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 710K, 9% free 9764K/10624K, paused 4ms+2ms, total 30ms
09-02 01:30:32.770 9079-9110/? D/dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 13ms
09-02 01:30:33.140 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 826K, 9% free 9702K/10624K, paused 2ms+2ms, total 26ms
09-02 01:30:33.140 9079-9110/? D/dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 8ms
09-02 01:30:33.320 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 677K, 9% free 9757K/10624K, paused 3ms+2ms, total 27ms
09-02 01:30:33.630 435-705/? D/dalvikvm: GC_EXPLICIT freed 3092K, 26% free 21035K/28352K, paused 6ms+9ms, total 112ms
09-02 01:30:33.690 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 641K, 9% free 9770K/10624K, paused 2ms+2ms, total 26ms
09-02 01:30:33.980 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 1147K, 12% free 9389K/10624K, paused 3ms+2ms, total 27ms
09-02 01:30:33.980 9079-9110/? D/dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 10ms
09-02 01:30:34.230 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 634K, 12% free 9393K/10624K, paused 1ms+2ms, total 25ms
09-02 01:30:34.230 9079-9110/? D/dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 9ms
09-02 01:30:34.420 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 637K, 12% free 9398K/10624K, paused 3ms+2ms, total 26ms
09-02 01:30:34.420 9079-9110/? D/dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 8ms
09-02 01:30:34.620 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 597K, 12% free 9416K/10624K, paused 1ms+3ms, total 24ms
09-02 01:30:34.800 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 555K, 11% free 9510K/10624K, paused 1ms+2ms, total 24ms
09-02 01:30:34.800 9079-9110/? D/dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 8ms
09-02 01:30:37.270 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 492K, 9% free 9698K/10624K, paused 2ms+2ms, total 25ms
09-02 01:30:37.270 9079-9110/? D/dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 15ms
09-02 01:30:37.350 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 159K, 4% free 10282K/10624K, paused 1ms+2ms, total 27ms
09-02 01:30:37.350 9079-9110/? D/dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 14ms
09-02 01:30:37.480 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 1108K, 11% free 10104K/11280K, paused 1ms+4ms, total 39ms
09-02 01:30:37.480 9079-9110/? D/dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 26ms
09-02 01:30:37.580 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 1589K, 17% free 9393K/11280K, paused 3ms+2ms, total 29ms
09-02 01:30:37.580 9079-9110/? D/dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 10ms
09-02 01:30:37.650 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 612K, 17% free 9402K/11280K, paused 3ms+3ms, total 27ms
09-02 01:30:37.720 9079-9082/? D/dalvikvm: GC_CONCURRENT freed 613K, 17% free 9429K/11280K, paused 2ms+2ms, total 26ms
09-02 01:30:37.720 9079-9110/? D/dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 9ms
09-02 01:30:37.740 9079-9107/? I/SyncService: sync service finished (01:30:37)
09-02 01:32:50.500 435-474/? W/ActivityManager: Unable to start service Intent { flg=0x4 cmp=com.google.android.apps.maps/com.google.googlenav.prefetch.android.PrefetcherService (has extras) } U=0: not found
09-02 01:32:59.940 27449-9143/? W/l: [TiclService] Skipping unknown enum class name ah
09-02 01:32:59.940 27449-9143/? W/l: [TiclService] Skipping unknown enum class name ah
09-02 01:32:59.980 27449-27453/? D/dalvikvm: GC_CONCURRENT freed 478K, 7% free 7816K/8356K, paused 8ms+1ms, total 72ms
09-02 01:33:00.610 27449-9152/? W/MsgSenderSvc: IOException sending to the data center (https://clients4.google.com//invalidation/android/request/CHES6wESzAFBUEE5MWJHWHV3N21JUVBxQ0h2bWJubERVdXd4MUtkLVNob29MbG8xNWI5Q2x1WXVfZlliNHhwaVVJZUh3Ti02LTB0UmJiY2pyeEZjV3NQSG5GbVRKUGZjMDB6NXByZkZydFVxbV93ZmNob0tVbHpsNGVhUFJXMGExcjI0MjZSZGVCam1JcHF3emduTGVaYUNhUmZnS3hlZWNTNlJLUFd1TEVPOWdkaC1BN1FNemtIZjBSUl9iUWgzX2o4dHRBTlE2LXNYRTJ2cWZ4ZzgaACoECAAQADISY29tLmFuZHJvaWQuY2hyb21l?service=chromiumsync): java.io.EOFException
What's strange is that the QR Code Reader app briefly shows the text from the QR Code before exiting back to my app. So the code was scanned successfully. However, when my app is returned, the onActivityResult doesn't fire.
I'm guessing it's a problem with something (the IntentIntegrator maybe?) not being released from memory properly.
I'm testing this on a Google Nexus 7 (1st gen) device using the front camera.
I think I fixed it. Changed the calling method to:
public void performScan(){
IntentIntegrator scanIntegrator = new IntentIntegrator(this);
scanIntegrator.initiateScan();
}
("thisActivity") was previously being defined and must have been released along the way.

Categories

Resources