android.view.InflateException array - android

error line 21: line 21 is: android:entryValues="#array/listValues". This error only on android < 3. Any idea? Logcat is about when I start app and rotate emulator.
preferences.xml:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
android:title="sett"
android:summary="Sett">
<CheckBoxPreference
android:title="Notify"
android:defaultValue="true"
android:summary="on off"
android:key="checkboxPref" />
</PreferenceCategory>
<PreferenceCategory
android:title="Animation" >
<ListPreference
android:entries="#array/listOptions"
android:entryValues="#array/listValues"
android:key="listpref"
android:summary="time"
android:title="time" />
</PreferenceCategory>
</PreferenceScreen>
arrayfade.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<string-array name="listOptions">
<item>Mezzo secondo</item>
<item>Un secondo</item>
<item>Un secondo e mezzo</item>
<item>Due secondi</item>
</string-array>
<string-array name="listValues">
<item>500</item>
<item>1000</item>
<item>1500</item>
<item>2000</item>
</string-array>
</resources>
logcat:
I/ActivityManager( 52): Displayed activity com.example.app/.MainActivity: 2372 ms (total 2372 ms)
I/ActivityManager( 52): Config changed: { scale=1.0 imsi=310/260 loc=en_US touch=3 keys=2/1/2 nav=1/1 orien=2 layout=18}
I/UsageStats( 52): Unexpected resume of com.example.app while already resumed in com.example.app
W/SurfaceFlinger( 52): timeout expired mFreezeDisplay=1, mFreezeCount=0
I/WindowManager( 52): Setting rotation to 0, animFlags=0
I/ActivityManager( 52): Config changed: { scale=1.0 imsi=310/260 loc=en_US touch=3 keys=2/1/2 nav=1/1 orien=1 layout=18}
I/UsageStats( 52): Unexpected resume of com.example.app while already resumed in com.example.app
D/dalvikvm( 660): GC freed 3448 objects / 774776 bytes in 59ms
I/dalvikvm( 660): Stack overflow, expanding (0x41049200 to 0x41049000)
I/dalvikvm( 660): Shrank stack (to 0x41049200, curFrame is 0x41049488)
D/AndroidRuntime( 660): Shutting down VM
W/dalvikvm( 660): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
E/ACRA ( 660): ACRA caught a StackOverflowError exception for com.example.app. Building report.
I/NotificationService( 52): enqueueToast pkg=com.example.app callback=android.app.ITransientNotification$Stub$Proxy#43bf7008 duration=1
D/dalvikvm( 660): GC freed 6838 objects / 1236840 bytes in 65ms
D/dalvikvm( 660): GREF has increased to 201
D/dalvikvm( 52): GREF has increased to 501
D/dalvikvm( 52): GC freed 6591 objects / 308072 bytes in 96ms
D/dalvikvm( 660): GREF has increased to 301
D/dalvikvm( 660): GC freed 10418 objects / 650872 bytes in 78ms
D/dalvikvm( 52): GC freed 2244 objects / 129800 bytes in 103ms
D/dalvikvm( 660): GC freed 3169 objects / 152248 bytes in 75ms
I/ACRA ( 660): READ_LOGS granted! ACRA can include LogCat and DropBox data.
D/ACRA ( 660): Retrieving logcat output...
D/ACRA ( 660): Writing crash report file 1356895743000.stacktrace.
D/dalvikvm( 660): GC freed 8682 objects / 1094864 bytes in 72ms
D/ACRA ( 660): About to start ReportSenderWorker from #handleException
D/ACRA ( 660): Mark all pending reports as approved.
D/ACRA ( 660): Looking for error files in /data/data/com.example.app/files
D/ACRA ( 660): #checkAndSendReports - start
D/ACRA ( 660): Looking for error files in /data/data/com.example.app/files
I/ACRA ( 660): Sending file 1356895743000-approved.stacktrace
D/dalvikvm( 660): DestroyJavaVM waiting for non-daemon threads to exit
D/ACRA ( 660): Waiting for Toast + worker...
D/dalvikvm( 52): GC freed 3929 objects / 166424 bytes in 157ms
D/dalvikvm( 660): GREF has decreased to 199
D/dalvikvm( 660): GC freed 495 objects / 497968 bytes in 165ms
D/ACRA ( 660): Sending report 569291c5-64df-4491-91f9-f89f01f7f053
D/ACRA ( 660): Connect to https://docs.google.com/spreadsheet/formResponse?formkey=dFNyNHJJQ1ZvdVhlblg3aVl1LVNOSGc6MQ&ifq
W/WindowManager( 52): App freeze timeout expired.
W/WindowManager( 52): Force clearing freeze: AppWindowToken{43d7b688 token=HistoryRecord{43cf1898 com.example.app/.MainActivity}}
D/dalvikvm( 660): GC freed 11315 objects / 1068344 bytes in 59ms
D/dalvikvm( 660): GC freed 1302 objects / 353824 bytes in 48ms
D/ACRA ( 660): Sending request to https://docs.google.com/spreadsheet/formResponse?formkey=dFNyNHJJQ1ZvdVhlblg3aVl1LVNOSGc6MQ&ifq
D/dalvikvm( 52): GREF has decreased to 399
D/dalvikvm( 100): GC freed 1096 objects / 64416 bytes in 65ms
D/dalvikvm( 52): GC freed 3276 objects / 134560 bytes in 84ms
D/ACRA ( 660): #checkAndSendReports - finish
D/ACRA ( 660): Wait for Toast + worker ended. Kill Application ? true
E/AndroidRuntime( 660): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime( 660): java.lang.StackOverflowError
E/AndroidRuntime( 660): at java.nio.HeapByteBuffer.<init>(HeapByteBuffer.java:49)
E/AndroidRuntime( 660): at java.nio.HeapByteBuffer.<init>(HeapByteBuffer.java:41)
E/AndroidRuntime( 660): at java.nio.ReadWriteHeapByteBuffer.<init>(ReadWriteHeapByteBuffer.java:45)
E/AndroidRuntime( 660): at java.nio.BufferFactory.newByteBuffer(BufferFactory.java:40)
E/AndroidRuntime( 660): at java.nio.ByteBuffer.wrap(ByteBuffer.java:87)
E/AndroidRuntime( 660): at java.nio.charset.CharsetEncoder.isLegalReplacement(CharsetEncoder.java:692)
E/AndroidRuntime( 660): at java.nio.charset.CharsetEncoder.replaceWith(CharsetEncoder.java:804)
E/AndroidRuntime( 660): at java.nio.charset.CharsetEncoder.<init>(CharsetEncoder.java:205)
E/AndroidRuntime( 660): at com.ibm.icu4jni.charset.CharsetEncoderICU.<init>(CharsetEncoderICU.java:75)
E/AndroidRuntime( 660): at com.ibm.icu4jni.charset.CharsetICU.newEncoder(CharsetICU.java:74)
E/AndroidRuntime( 660): at com.android.internal.util.FastXmlSerializer.setOutput(FastXmlSerializer.java:292)
E/AndroidRuntime( 660): at com.android.internal.util.XmlUtils.writeMapXml(XmlUtils.java:180)
E/AndroidRuntime( 660): at android.app.ApplicationContext$SharedPreferencesImpl.writeFileLocked(ApplicationContext.java:2757)
E/AndroidRuntime( 660): at android.app.ApplicationContext$SharedPreferencesImpl.access$800(ApplicationContext.java:2510)
E/AndroidRuntime( 660): at android.app.ApplicationContext$SharedPreferencesImpl$EditorImpl.commit(ApplicationContext.java:2695)
E/AndroidRuntime( 660): at com.example.app.MainActivity.preferenze(MainActivity.java:3473)
E/AndroidRuntime( 660): at com.example.app.MainActivity.access$0(MainActivity.java:3439)
E/AndroidRuntime( 660): at com.example.app.MainActivity$1.onSharedPreferenceChanged(MainActivity.java:2302)
E/AndroidRuntime( 660): at android.app.ApplicationContext$SharedPreferencesImpl$EditorImpl.commit(ApplicationContext.java:2703)
E/AndroidRuntime( 660): at com.example.app.MainActivity.preferenze(MainActivity.java:3473)
E/AndroidRuntime( 660): at com.example.app.MainActivity.access$0(MainActivity.java:3439)
E/AndroidRuntime( 660): at com.example.app.MainActivity$1.onSharedPreferenceChanged(MainActivity.java:2302)
E/AndroidRuntime( 660): at android.app.ApplicationContext$SharedPreferencesImpl$EditorImpl.commit(ApplicationContext.java:2703)
E/AndroidRuntime( 660): at com.example.app.MainActivity.preferenze(MainActivity.java:3473)
E/AndroidRuntime( 660): at com.example.app.MainActivity.access$0(MainActivity.java:3439)
E/AndroidRuntime( 660): at com.example.app.MainActivity$1.onSharedPreferenceChanged(MainActivity.java:2302)
E/AndroidRuntime( 660): at android.app.ApplicationContext$SharedPreferencesImpl$EditorImpl.commit(ApplicationContext.java:2703)
E/AndroidRuntime( 660): at com.example.app.MainActivity.preferenze(MainActivity.java:3473)
E/AndroidRuntime( 660): at com.example.app.MainActivity.access$0(MainActivity.java:3439)
E/AndroidRuntime( 660): at com.example.app.MainActivity$1.onSharedPreferenceChanged(MainActivity.java:2302)
E/AndroidRuntime( 660): at android.app.ApplicationContext$SharedPreferencesImpl$EditorImpl.commit(ApplicationContext.java:2703)
E/AndroidRuntime( 660): at com.example.app.MainActivity.preferenze(MainActivity.java:3473)
E/AndroidRuntime( 660): at com.example.app.MainActivity.access$0(MainActivity.java:3439)
E/AndroidRuntime( 660): at com.example.app.MainActivity$1.onSharedPreferenceChanged(MainActivity.java:2302)
E/AndroidRuntime( 660): at android.app.ApplicationContext$SharedPreferencesImpl$EditorImpl.commit(ApplicationContext.java:2703)
E/AndroidRuntime( 660): at com.example.app.MainActivity.preferenze(MainActivity.java:3473)
E/AndroidRuntime( 660): at com.example.app.MainActivity.access$0(MainActivity.java:3439)
E/AndroidRuntime( 660): at com.example.app.MainActivity$1.onSharedPreferenceChanged(MainActivity.java:2302)
E/AndroidRuntime( 660): at android.app.ApplicationContext$SharedPreferencesImpl$EditorImpl.commit(ApplicationContext.java:2703)
E/AndroidRuntime( 660): at com.example.app.MainActivity.preferenze(MainActivity.java:3473)
E/AndroidRuntime( 660): at com.example.app.MainActivity.access$0(MainActivity.java:3439)
E/AndroidRuntime( 660): at com.example.app.MainActivity$1.onSharedPreferenceChanged(MainActivity.java:2302)
E/AndroidRuntime( 660): at android.app.ApplicationContext$SharedPreferencesImpl$EditorImpl.commit(ApplicationContext.java:2703)
E/AndroidRuntime( 660): at com.example.app.MainActivity.preferenze(MainActivity.java:3473)
E/AndroidRuntime( 660): at com.example.app.MainActivity.access$0(MainActivity.java:3439)
E/AndroidRuntime( 660): at com.example.app.MainActivity$1.onSharedPreferenceChanged(MainActivity.java:2302)
E/AndroidRuntime( 660): at android.app.ApplicationContext$SharedPreferencesImpl$EditorImp
D/dalvikvm( 660): GC freed 8661 objects / 994800 bytes in 65ms
D/dalvikvm( 660): threadid=31 wakeup: interrupted
I/Process ( 52): Sending signal. PID: 660 SIG: 3
I/dalvikvm( 660): threadid=7: reacting to signal 3
I/dalvikvm( 660): Wrote stack trace to '/data/anr/traces.txt'
I/Process ( 660): Sending signal. PID: 660 SIG: 9
I/ActivityManager( 52): Process com.example.app (pid 660) has died.
I/UsageStats( 52): Unexpected resume of com.android.launcher while already resumed in com.example.app
W/InputManagerService( 52): Got RemoteException sending setActive(false) notification to pid 660 uid 10028

With your update you now got a stack over flow error : onSharedPreferenceChanged calls a method name preferenze that calls commit than triggers onSharedPreferenceChanged. After a certain number of "recursive" calls like this, you get out of heap space. Don't call commit from there.

The problem comes from the layout of MainActivity, not the preference xml file.
Check your fragments are properly declared with a android:name attribute.

Tak a look at
Could not find class 'android.content.ClipboardManager', referenced from method com.example.app.MainActivity.Copia
android.content.ClipboardManager is available from API lvl 11 - Android 3.0.
I think it can be connected with your problem.

Related

MonkeyRunner causing Android Settings to Crash

I've been trying to turn on an Accessibility Service using Android's. I run an emulator using Android Studio (Nexus S API 19, armabi-v7). I'm able to open the accessibility settings when the emulator is running. (By clicking on the circled submenu)
Setting Screen with Accessibility Sub-Menu highlighted
Yet when I run try to attach monkeyrunner by opening an interactive monkeyrunner terminal and running:
>> from android.com.monkeyrunner import MonkeyRunner, MonkeyDevice
>> d = MonkeyRunner.waitForConnection()
I'm unable to get navigate to the accessibility settings screen and get the error message
Result of selecting accessibility sub-menu from settings when MonkeyDevice is attached
as soon as I detach the monkeyDevice, I'm able to get to the accessibility settings screen again. Any idea what could cause it?
snippet from the logs when there's an error:
##Logs from Failure ## I/ActivityManager( 357): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.settings/.Settings} from pid 519 ... I/ActivityManager( 357): START u0 {act=android.intent.action.MAIN cmp=com.android.settings/.SubSettings (has extras)} from pid 751
...
D/SubSettings( 751): Launching fragment com.android.settings.accessibility.AccessibilitySettings ... E/AndroidRuntime( 751): FATAL EXCEPTION: main
E/AndroidRuntime( 751): Process: com.android.settings, PID: 751
E/AndroidRuntime( 751): java.lang.RuntimeException: Unable to resume activity {com.android.settings/com.android.settings.SubSettings}: java.lang.NullPointerException
E/AndroidRuntime( 751): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2774)
E/AndroidRuntime( 751): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2803)
E/AndroidRuntime( 751): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2238)
E/AndroidRuntime( 751): at android.app.ActivityThread.access$800(ActivityThread.java:135)
E/AndroidRuntime( 751): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
E/AndroidRuntime( 751): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 751): at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime( 751): at android.app.ActivityThread.main(ActivityThread.java:5001)
E/AndroidRuntime( 751): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 751): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 751): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
E/AndroidRuntime( 751): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
E/AndroidRuntime( 751): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 751): Caused by: java.lang.NullPointerException
E/AndroidRuntime( 751): at com.android.settings.accessibility.AccessibilitySettings.loadInstalledServices(AccessibilitySettings.java:641)
E/AndroidRuntime( 751): at com.android.settings.accessibility.AccessibilitySettings.onResume(AccessibilitySettings.java:214)
E/AndroidRuntime( 751): at android.app.Fragment.performResume(Fragment.java:1743)
E/AndroidRuntime( 751): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:924)
E/AndroidRuntime( 751): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1062)
E/AndroidRuntime( 751): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1044)
E/AndroidRuntime( 751): at android.app.FragmentManagerImpl.dispatchResume(FragmentManager.java:1863)
E/AndroidRuntime( 751): at android.app.Activity.performResume(Activity.java:5320)
E/AndroidRuntime( 751): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2764)
E/AndroidRuntime( 751): ... 12 more
W/ActivityManager( 357): Force finishing activity com.android.settings/.SubSettings
W/ActivityManager( 357): Force finishing activity com.android.settings/.Settings ... W/ActivityManager( 357): Activity pause timeout for ActivityRecord{b3ea9e08 u0 com.android.settings/.SubSettings t2 f}
There seems to be a NullPointer exception, but I don't know what could cause that
##Log Snippet Without Failure I/ActivityManager( 357): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.settings/.Settings} from pid 519
I/ActivityManager( 357): Start proc com.android.settings for activity com.android.settings/.Settings: pid=1095 uid=1000 gids={41000, 1028, 1015, 3002, 3001, 3003}
D/dalvikvm( 59): GC_EXPLICIT freed 40K, 5% free 2777K/2900K, paused 15ms+3ms, total 96ms
D/dalvikvm( 59): GC_EXPLICIT freed <1K, 5% free 2777K/2900K, paused 3ms+14ms, total 67ms
D/dalvikvm( 59): GC_EXPLICIT freed <1K, 5% free 2777K/2900K, paused 7ms+14ms, total 76ms
D/dalvikvm( 1095): GC_FOR_ALLOC freed 118K, 7% free 2987K/3188K, paused 35ms, total 37ms
I/dalvikvm-heap( 1095): Grow heap (frag case) to 3.602MB for 635812-byte allocation
D/dalvikvm( 1095): GC_FOR_ALLOC freed 3K, 6% free 3605K/3812K, paused 44ms, total 44ms
D/dalvikvm( 1095): GC_CONCURRENT freed <1K, 6% free 3605K/3812K, paused 4ms+2ms, total 53ms
E/BluetoothAdapter( 1095): Bluetooth binder is null
D/dalvikvm( 1095): GC_CONCURRENT freed 209K, 8% free 3793K/4088K, paused 2ms+16ms, total 65ms
D/ ( 1095): HostConnection::get() New Host Connection established 0xb82ef4c0, tid 1095
W/EGL_emulation( 1095): eglSurfaceAttrib not implemented
D/OpenGLRenderer( 1095): Enabling debug mode 0
I/ActivityManager( 357): Displayed com.android.settings/.Settings:
+2s599ms
D/dalvikvm( 1095): GC_CONCURRENT freed 124K, 5% free 4057K/4268K, paused 15ms+5ms, total 101ms
I/ActivityManager( 357): START u0 {act=android.intent.action.MAIN cmp=com.android.settings/.SubSettings (has extras)} from pid 1095
D/SubSettings( 1095): Launching fragment com.android.settings.accessibility.AccessibilitySettings
W/EGL_emulation( 1095): eglSurfaceAttrib not implemented
D/dalvikvm( 1095): GC_CONCURRENT freed 223K, 7% free 4267K/4576K, paused 20ms+65ms, total 345ms
I/Choreographer( 1095): Skipped 120 frames! The application may be doing too much work on its main thread.
I/ActivityManager( 357): Displayed com.android.settings/.SubSettings:
+3s235ms

ListView not getting displayed?

I have a activity which uses a listview element as follows
public class List1 extends Activity
{
Context context=this;
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.listview);
try{
//DB
final SQLiteDatabase db;
db = openOrCreateDatabase(
"Secret.db"
, SQLiteDatabase.CREATE_IF_NECESSARY
, null
);
db.setVersion(1);
db.setLocale(Locale.getDefault());
db.setLockingEnabled(true);
Cursor cur = db.query("tbl_user",null,null,null,null,null,null);
//DB Over
ListView listView = (ListView) findViewById(R.id.mylist);
listView.setTextFilterEnabled(true);
final String[] values = new String[50];
int i=0;
while(cur.moveToNext())
{
values[i]=Integer.toString(cur.getInt(0))+":"+cur.getString(1)+":"+cur.getString(2);
i++;
}
cur.close();
ArrayAdapter<String> adapter = new ArrayAdapter<String>(context,R.layout.list_item,values);
listView.setAdapter(adapter);
listView.setVisibility(0);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, int position,long id)
//public void onItemClick(ListView<?> listview, View view, int position,long id)
{
try
{
Intent i=new Intent(List1.this,Form1.class);
i.putExtra("uid","85");
startActivity(i);
finish();
}
catch(Exception e)
{
String insert2="insert into login values("+"\""+e.toString()+"\""+");";
db.execSQL(insert2);
}
}
});
db.close();
//required
}
catch(Exception e)
{
Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_LONG).show();}
}
}
This is my listview.xml file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ListView
android:id="#+id/mylist"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
</ListView>
</RelativeLayout>
This is my list_item.xml file which has the required textview
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/tv1"
android:padding="10dp"
android:background="#drawable/textview1"
style="#style/textview_text"
android:textSize="16dp">
</TextView>
But the ListView is not working. I mean after coming to this activity the app is showing error showing "APP_NAME is stopped unexpectedly". The same code works for one or two times and then shows the above error continuously after that. May I kno why is it happening?
EDIT
This is logcat file
W/dalvikvm( 2694): threadid=3: thread exiting with uncaught exception (group=0x4
001b188)
E/AndroidRuntime( 2694): Uncaught handler: thread main exiting due to uncaught e
xception
E/AndroidRuntime( 2694): java.lang.NullPointerException
E/AndroidRuntime( 2694): at android.widget.ArrayAdapter.createViewFromRes
ource(ArrayAdapter.java:355)
E/AndroidRuntime( 2694): at android.widget.ArrayAdapter.getView(ArrayAdap
ter.java:323)
E/AndroidRuntime( 2694): at android.widget.AbsListView.obtainView(AbsList
View.java:1274)
E/AndroidRuntime( 2694): at android.widget.ListView.makeAndAddView(ListVi
ew.java:1668)
E/AndroidRuntime( 2694): at android.widget.ListView.fillDown(ListView.jav
a:637)
E/AndroidRuntime( 2694): at android.widget.ListView.fillFromTop(ListView.
java:694)
E/AndroidRuntime( 2694): at android.widget.ListView.layoutChildren(ListVi
ew.java:1521)
E/AndroidRuntime( 2694): at android.widget.AbsListView.onLayout(AbsListVi
ew.java:1113)
E/AndroidRuntime( 2694): at android.view.View.layout(View.java:6830)
E/AndroidRuntime( 2694): at android.widget.RelativeLayout.onLayout(Relati
veLayout.java:900)
E/AndroidRuntime( 2694): at android.view.View.layout(View.java:6830)
E/AndroidRuntime( 2694): at android.widget.FrameLayout.onLayout(FrameLayo
ut.java:333)
E/AndroidRuntime( 2694): at android.view.View.layout(View.java:6830)
E/AndroidRuntime( 2694): at android.widget.LinearLayout.setChildFrame(Lin
earLayout.java:1119)
E/AndroidRuntime( 2694): at android.widget.LinearLayout.layoutVertical(Li
nearLayout.java:998)
E/AndroidRuntime( 2694): at android.widget.LinearLayout.onLayout(LinearLa
yout.java:918)
E/AndroidRuntime( 2694): at android.view.View.layout(View.java:6830)
E/AndroidRuntime( 2694): at android.widget.FrameLayout.onLayout(FrameLayo
ut.java:333)
E/AndroidRuntime( 2694): at android.view.View.layout(View.java:6830)
E/AndroidRuntime( 2694): at android.view.ViewRoot.performTraversals(ViewR
oot.java:996)
E/AndroidRuntime( 2694): at android.view.ViewRoot.handleMessage(ViewRoot.
java:1633)
E/AndroidRuntime( 2694): at android.os.Handler.dispatchMessage(Handler.ja
va:99)
E/AndroidRuntime( 2694): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 2694): at android.app.ActivityThread.main(ActivityThrea
d.java:4363)
E/AndroidRuntime( 2694): at java.lang.reflect.Method.invokeNative(Native
Method)
E/AndroidRuntime( 2694): at java.lang.reflect.Method.invoke(Method.java:5
21)
E/AndroidRuntime( 2694): at com.android.internal.os.ZygoteInit$MethodAndA
rgsCaller.run(ZygoteInit.java:860)
E/AndroidRuntime( 2694): at com.android.internal.os.ZygoteInit.main(Zygot
eInit.java:618)
E/AndroidRuntime( 2694): at dalvik.system.NativeStart.main(Native Method)
D/dalvikvm( 2694): GC freed 6621 objects / 343272 bytes in 126ms
I/dalvikvm( 2694): Uncaught exception thrown by finalizer (will be discarded):
I/dalvikvm( 2694): Ljava/lang/IllegalStateException;: Finalizing cursor android.
database.sqlite.SQLiteCursor#44c60cd0 on login that has not been deactivated or
closed
I/dalvikvm( 2694): at android.database.sqlite.SQLiteCursor.finalize(SQLiteC
ursor.java:596)
I/dalvikvm( 2694): at dalvik.system.NativeStart.run(Native Method)
I/dalvikvm( 2694): Uncaught exception thrown by finalizer (will be discarded):
I/dalvikvm( 2694): Ljava/lang/IllegalStateException;: Finalizing cursor android.
database.sqlite.SQLiteCursor#44c58028 on login that has not been deactivated or
closed
I/dalvikvm( 2694): at android.database.sqlite.SQLiteCursor.finalize(SQLiteC
ursor.java:596)
I/dalvikvm( 2694): at dalvik.system.NativeStart.run(Native Method)
I/dalvikvm( 2694): Uncaught exception thrown by finalizer (will be discarded):
I/dalvikvm( 2694): Ljava/lang/IllegalStateException;: Finalizing cursor android.
database.sqlite.SQLiteCursor#44c37fa0 on login that has not been deactivated or
closed
I/dalvikvm( 2694): at android.database.sqlite.SQLiteCursor.finalize(SQLiteC
ursor.java:596)
I/dalvikvm( 2694): at dalvik.system.NativeStart.run(Native Method)
I/Process ( 52): Sending signal. PID: 2694 SIG: 3
I/dalvikvm( 2694): threadid=7: reacting to signal 3
I/dalvikvm( 2694): Wrote stack trace to '/data/anr/traces.txt'
I/Process ( 2694): Sending signal. PID: 2694 SIG: 9
I/ActivityManager( 52): Process com.notification (pid 2694) has died.
I/WindowManager( 52): WIN DEATH: Window{44d90538 com.notification/com.notifica
tion.List1 paused=false}
I/UsageStats( 52): Unexpected resume of com.android.launcher while already res
umed in com.notification
W/InputManagerService( 52): Window already focused, ignoring focus gain of: co
m.android.internal.view.IInputMethodClient$Stub$Proxy#44d933c8
I/ActivityManager( 52): Start proc com.notification for broadcast com.notifica
tion/.AlarmReceiver: pid=2706 uid=10034 gids={3003}
D/ddm-heap( 2706): Got feature list request
D/dalvikvm( 1152): GC freed 194 objects / 8728 bytes in 88ms
I/ActivityManager( 52): Starting activity: Intent { act=android.intent.action.
MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.notification/
.NotificationActivity }
I/ActivityManager( 52): Starting activity: Intent { cmp=com.notification/.Back
ground }
I/ActivityManager( 52): Displayed activity com.notification/.Background: 262 m
s (total 8081 ms)
D/dalvikvm( 234): GC freed 44 objects / 2064 bytes in 134ms
D/AndroidRuntime( 2718):
D/AndroidRuntime( 2718): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
D/AndroidRuntime( 2718): CheckJNI is ON
D/AndroidRuntime( 2718): --- registering native functions ---
D/ddm-heap( 2718): Got feature list request
D/PackageParser( 52): Scanning package: /data/app/vmdl67950.tmp
I/PackageManager( 52): Removing non-system package:com.notification
D/PackageManager( 52): Removing package com.notification
D/PackageManager( 52): Services: com.notification.BackService
D/PackageManager( 52): Receivers: com.notification.AlarmReceiver
D/PackageManager( 52): Activities: com.notification.NotificationActivity com
.notification.Form1 com.notification.Background com.notification.Bg com.notifica
tion.List1
W/InputManagerService( 52): Window already focused, ignoring focus gain of: co
m.android.internal.view.IInputMethodClient$Stub$Proxy#44eb1868
D/PackageManager( 52): Scanning package com.notification
I/PackageManager( 52): /data/app/vmdl67950.tmp changed; unpacking
D/installd( 32): DexInv: --- BEGIN '/data/app/vmdl67950.tmp' ---
D/dalvikvm( 2724): DexOpt: load 40ms, verify 159ms, opt 2ms
D/installd( 32): DexInv: --- END '/data/app/vmdl67950.tmp' (success) ---
D/PackageManager( 52): Services: com.notification.BackService
D/PackageManager( 52): Receivers: com.notification.AlarmReceiver
D/PackageManager( 52): Activities: com.notification.NotificationActivity com
.notification.Form1 com.notification.Background com.notification.Bg com.notifica
tion.List1
D/ActivityManager( 52): Uninstalling process com.notification
D/ActivityManager( 52): Force removing process ProcessRecord{44e9eb48 2706:com
.notification/10034} (com.notification/10034)
I/Process ( 52): Sending signal. PID: 2706 SIG: 9
D/ActivityManager( 52): Received spurious death notification for thread androi
d.os.BinderProxy#44eec8b8
I/installd( 32): move /data/dalvik-cache/data#app#vmdl67950.tmp#classes.dex ->
/data/dalvik-cache/data#app#com.notification.apk#classes.dex
D/PackageManager( 52): New package installed in /data/app/com.notification.apk
D/AndroidRuntime( 2718): Shutting down VM
D/dalvikvm( 2718): DestroyJavaVM waiting for non-daemon threads to exit
D/dalvikvm( 2718): DestroyJavaVM shutting VM down
D/dalvikvm( 2718): HeapWorker thread shutting down
D/dalvikvm( 2718): HeapWorker thread has shut down
D/jdwp ( 2718): JDWP shutting down net...
I/dalvikvm( 2718): Debugger has detached; object registry had 1 entries
D/dalvikvm( 2718): VM cleaning up
D/dalvikvm( 2718): LinearAlloc 0x0 used 623916 of 5242880 (11%)
D/ActivityManager( 52): Uninstalling process com.notification
I/dalvikvm( 2718): JNI: AttachCurrentThread (from ???.???)
E/AndroidRuntime( 2718): ERROR: thread attach failed
W/ResourceType( 52): Resources don't contain package for resource number 0x7f0
700e5
W/ResourceType( 52): Resources don't contain package for resource number 0x7f0
20031
W/ResourceType( 52): Resources don't contain package for resource number 0x7f0
20030
W/ResourceType( 52): Resources don't contain package for resource number 0x7f0
50000
W/ResourceType( 52): Resources don't contain package for resource number 0x7f0
60000
W/ResourceType( 52): Resources don't contain package for resource number 0x7f0
60001
D/dalvikvm( 1152): GC freed 139 objects / 5928 bytes in 230ms
D/dalvikvm( 52): GC freed 14606 objects / 863536 bytes in 259ms
W/ResourceType( 52): Resources don't contain package for resource number 0x7f0
700e5
W/ResourceType( 52): Resources don't contain package for resource number 0x7f0
20031
W/ResourceType( 52): Resources don't contain package for resource number 0x7f0
20030
W/ResourceType( 52): Resources don't contain package for resource number 0x7f0
50000
D/dalvikvm( 52): GC freed 425 objects / 17320 bytes in 275ms
W/ResourceType( 52): Resources don't contain package for resource number 0x7f0
60000
W/ResourceType( 52): Resources don't contain package for resource number 0x7f0
60001
D/AndroidRuntime( 2729):
D/AndroidRuntime( 2729): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
D/AndroidRuntime( 2729): CheckJNI is ON
D/AndroidRuntime( 2729): --- registering native functions ---
D/ddm-heap( 2729): Got feature list request
I/ActivityManager( 52): Starting activity: Intent { act=android.intent.action.
MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.notification/
.NotificationActivity }
I/ActivityManager( 52): Start proc com.notification for activity com.notificat
ion/.NotificationActivity: pid=2735 uid=10034 gids={3003}
D/AndroidRuntime( 2729): Shutting down VM
D/dalvikvm( 2729): DestroyJavaVM waiting for non-daemon threads to exit
D/dalvikvm( 2729): DestroyJavaVM shutting VM down
D/dalvikvm( 2729): HeapWorker thread shutting down
D/dalvikvm( 2729): HeapWorker thread has shut down
D/jdwp ( 2729): JDWP shutting down net...
I/dalvikvm( 2729): Debugger has detached; object registry had 1 entries
D/dalvikvm( 2729): VM cleaning up
E/AndroidRuntime( 2729): ERROR: thread attach failed
D/dalvikvm( 2729): LinearAlloc 0x0 used 639500 of 5242880 (12%)
D/dalvikvm( 30): GC freed 299 objects / 11576 bytes in 264ms
D/ddm-heap( 2735): Got feature list request
D/dalvikvm( 30): GC freed 57 objects / 2432 bytes in 160ms
D/dalvikvm( 30): GC freed 2 objects / 48 bytes in 360ms
I/ActivityManager( 52): Displayed activity com.notification/.NotificationActiv
ity: 1204 ms (total 1204 ms)
W/KeyCharacterMap( 2735): No keyboard for id 0
W/KeyCharacterMap( 2735): Using default keymap: /system/usr/keychars/qwerty.kcm.
bin
I/ActivityManager( 52): Starting activity: Intent { cmp=com.notification/.Bg (
has extras) }
I/ActivityManager( 52): Displayed activity com.notification/.Bg: 329 ms (total
329 ms)
D/dalvikvm( 1152): GC freed 2454 objects / 141000 bytes in 600ms
I/ActivityManager( 52): Starting activity: Intent { cmp=com.notification/.List
1 bnds=[0,152][480,248] }
W/ActivityManager( 52): startActivity called from non-Activity context; forcin
g Intent.FLAG_ACTIVITY_NEW_TASK for: Intent { cmp=com.notification/.List1 bnds=[
0,152][480,248] }
D/AndroidRuntime( 2735): Shutting down VM
W/dalvikvm( 2735): threadid=3: thread exiting with uncaught exception (group=0x4
001b188)
E/AndroidRuntime( 2735): Uncaught handler: thread main exiting due to uncaught e
xception
E/AndroidRuntime( 2735): java.lang.NullPointerException
E/AndroidRuntime( 2735): at android.widget.ArrayAdapter.createViewFromRes
ource(ArrayAdapter.java:355)
E/AndroidRuntime( 2735): at android.widget.ArrayAdapter.getView(ArrayAdap
ter.java:323)
E/AndroidRuntime( 2735): at android.widget.AbsListView.obtainView(AbsList
View.java:1256)
E/AndroidRuntime( 2735): at android.widget.ListView.measureHeightOfChildr
en(ListView.java:1147)
E/AndroidRuntime( 2735): at android.widget.ListView.onMeasure(ListView.ja
va:1060)
E/AndroidRuntime( 2735): at android.view.View.measure(View.java:7964)
E/AndroidRuntime( 2735): at android.widget.RelativeLayout.measureChild(Re
lativeLayout.java:554)
E/AndroidRuntime( 2735): at android.widget.RelativeLayout.onMeasure(Relat
iveLayout.java:377)
E/AndroidRuntime( 2735): at android.view.View.measure(View.java:7964)
E/AndroidRuntime( 2735): at android.view.ViewGroup.measureChildWithMargin
s(ViewGroup.java:3023)
E/AndroidRuntime( 2735): at android.widget.FrameLayout.onMeasure(FrameLay
out.java:245)
E/AndroidRuntime( 2735): at android.view.View.measure(View.java:7964)
E/AndroidRuntime( 2735): at android.widget.LinearLayout.measureVertical(L
inearLayout.java:464)
E/AndroidRuntime( 2735): at android.widget.LinearLayout.onMeasure(LinearL
ayout.java:278)
E/AndroidRuntime( 2735): at android.view.View.measure(View.java:7964)
E/AndroidRuntime( 2735): at android.view.ViewGroup.measureChildWithMargin
s(ViewGroup.java:3023)
E/AndroidRuntime( 2735): at android.widget.FrameLayout.onMeasure(FrameLay
out.java:245)
E/AndroidRuntime( 2735): at android.view.View.measure(View.java:7964)
E/AndroidRuntime( 2735): at android.view.ViewRoot.performTraversals(ViewR
oot.java:763)
E/AndroidRuntime( 2735): at android.view.ViewRoot.handleMessage(ViewRoot.
java:1633)
E/AndroidRuntime( 2735): at android.os.Handler.dispatchMessage(Handler.ja
va:99)
E/AndroidRuntime( 2735): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 2735): at android.app.ActivityThread.main(ActivityThrea
d.java:4363)
E/AndroidRuntime( 2735): at java.lang.reflect.Method.invokeNative(Native
Method)
E/AndroidRuntime( 2735): at java.lang.reflect.Method.invoke(Method.java:5
21)
E/AndroidRuntime( 2735): at com.android.internal.os.ZygoteInit$MethodAndA
rgsCaller.run(ZygoteInit.java:860)
E/AndroidRuntime( 2735): at com.android.internal.os.ZygoteInit.main(Zygot
eInit.java:618)
E/AndroidRuntime( 2735): at dalvik.system.NativeStart.main(Native Method)
I/Process ( 52): Sending signal. PID: 2735 SIG: 3
I/dalvikvm( 2735): threadid=7: reacting to signal 3
I/dalvikvm( 2735): Wrote stack trace to '/data/anr/traces.txt'
W/ActivityManager( 52): Launch timeout has expired, giving up wake lock!
W/ActivityManager( 52): Activity idle timeout for HistoryRecord{44dcace0 com.n
otification/.List1}
I/Process ( 2735): Sending signal. PID: 2735 SIG: 9
I/ActivityManager( 52): Process com.notification (pid 2735) has died.
I/WindowManager( 52): WIN DEATH: Window{44d8db78 com.notification/com.notifica
tion.List1 paused=false}
I/UsageStats( 52): Unexpected resume of com.android.launcher while already res
umed in com.notification
I/ActivityManager( 52): Start proc com.notification for broadcast com.notifica
tion/.AlarmReceiver: pid=2745 uid=10034 gids={3003}
W/InputManagerService( 52): Window already focused, ignoring focus gain of: co
m.android.internal.view.IInputMethodClient$Stub$Proxy#44f2e3d8
E/gralloc ( 52): [unregister] handle 0x423290 still locked (state=40000001)
D/ddm-heap( 2745): Got feature list request
D/dalvikvm( 1152): GC freed 212 objects / 9560 bytes in 82ms
I/ActivityManager( 52): Starting activity: Intent { act=android.intent.action.
MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.notification/
.NotificationActivity }
I/ActivityManager( 52): Starting activity: Intent { cmp=com.notification/.Back
ground }
I/ActivityManager( 52): Displayed activity com.notification/.Background: 240 m
s (total 16387 ms)
D/dalvikvm( 234): GC freed 43 objects / 2024 bytes in 152ms
i think your adapter should know which textViewResourceId it should use.
So try this out: ArrayAdapter<String> adapter = new ArrayAdapter<String>(context,R.layout.list_item, R.id.tv1,values);
Change this to
<ListView
android:id="#+id/mylist"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
this
<ListView
android:id="#+id/mylist"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
And why do you need listView.setVisibility(0)?
final String[] values = new String[50];
int i=0;
while(cur.moveToNext())
{
values[i]=Integer.toString(cur.getInt(0))+":"+cur.getString(1)+":"+cur.getString(2);
i++;
}
cur.close();
Starting from the this spinet of code.
When the db.query returns you should rewind the cursor before starting to use it in the while loop. What if the query returns more the 50 results? Your app will crash with ArrayOutBoundException

Android NDK hellojni example fails

I'm trying to run the example from NDK package on a AT91SAM9M10-EKES board running Android 2.1
The activity fails.
This is what I get in the logcat, Can someone please guide me with this ?
D/AndroidRuntime( 1153): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
D/AndroidRuntime( 1153): CheckJNI is ON
D/AndroidRuntime( 1153): --- registering native functions ---
D/ddm-heap( 1153): Got feature list request
D/AndroidRuntime( 1153): Shutting down VM
D/dalvikvm( 1153): DestroyJavaVM waiting for non-daemon threads to exit
D/dalvikvm( 1153): DestroyJavaVM shutting VM down
D/dalvikvm( 1153): HeapWorker thread shutting down
D/dalvikvm( 1153): HeapWorker thread has shut down
D/jdwp ( 1153): JDWP shutting down net...
I/dalvikvm( 1153): Debugger has detached; object registry had 1 entries
D/dalvikvm( 1153): VM cleaning up
E/AndroidRuntime( 1153): ERROR: thread attach failed
D/dalvikvm( 1153): LinearAlloc 0x0 used 629532 of 5242880 (12%)
D/AndroidRuntime( 1161):
D/AndroidRuntime( 1161): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
D/AndroidRuntime( 1161): CheckJNI is ON
D/AndroidRuntime( 1161): --- registering native functions ---
D/ddm-heap( 1161): Got feature list request
I/ActivityManager( 767): Starting activity: Intent { act=android.intent.action.MAIN cat=android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.hellojni/.HelloJni }
D/AndroidRuntime( 1161): Shutting down VM
D/dalvikvm( 1161): DestroyJavaVM waiting for non-daemon threads to exit
D/dalvikvm( 1161): DestroyJavaVM shutting VM down
D/dalvikvm( 1161): HeapWorker thread shutting down
D/dalvikvm( 1161): HeapWorker thread has shut down
D/jdwp ( 1161): JDWP shutting down net...
I/dalvikvm( 1161): Debugger has detached; object registry had 1 entries
D/dalvikvm( 1161): VM cleaning up
E/AndroidRuntime( 1161): ERROR: thread attach failed
D/dalvikvm( 1161): LinearAlloc 0x0 used 639500 of 5242880 (12%)
I/ActivityManager( 767): Start proc com.example.hellojni for activity com.example.hellojni/.HelloJni: pid=1168 uid=10018 gids={1015}
D/ddm-heap( 1168): Got feature list request
W/dalvikvm( 1168): Exception Ljava/lang/UnsatisfiedLinkError; thrown during Lcom/example/hellojni/HelloJni;.<clinit>
W/dalvikvm( 1168): Class init failed in newInstance call (Lcom/example/hellojni/HelloJni;)
D/AndroidRuntime( 1168): Shutting down VM
W/dalvikvm( 1168): threadid=3: thread exiting with uncaught exception (group=0x4001b168)
E/AndroidRuntime( 1168): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime( 1168): java.lang.ExceptionInInitializerError
E/AndroidRuntime( 1168): at java.lang.Class.newInstanceImpl(Native Method)
E/AndroidRuntime( 1168): at java.lang.Class.newInstance(Class.java:1479)
E/AndroidRuntime( 1168): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
E/AndroidRuntime( 1168): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2409)
E/AndroidRuntime( 1168): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
E/AndroidRuntime( 1168): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
E/AndroidRuntime( 1168): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
E/AndroidRuntime( 1168): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 1168): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 1168): at android.app.ActivityThread.main(ActivityThread.java:4363)
E/AndroidRuntime( 1168): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1168): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 1168): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
E/AndroidRuntime( 1168): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
E/AndroidRuntime( 1168): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 1168): Caused by: java.lang.UnsatisfiedLinkError: Library hello-jni not found
E/AndroidRuntime( 1168): at java.lang.Runtime.loadLibrary(Runtime.java:489)
E/AndroidRuntime( 1168): at java.lang.System.loadLibrary(System.java:557)
E/AndroidRuntime( 1168): at com.example.hellojni.HelloJni.<clinit>(HelloJni.java:64)
E/AndroidRuntime( 1168): ... 15 more
I/Process ( 767): Sending signal. PID: 1168 SIG: 3
I/dalvikvm( 1168): threadid=7: reacting to signal 3
E/dalvikvm( 1168): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
W/ActivityManager( 767): Launch timeout has expired, giving up wake lock!
W/ActivityManager( 767): Activity idle timeout for HistoryRecord{43d5c310 com.example.hellojni/.HelloJni}
D/dalvikvm( 813): GC freed 301 objects / 14832 bytes in 91ms
I/power ( 767): *** set_screen_state 0
E/power ( 767): Failed setting last user activity: g_error=0
W/ActivityManager( 767): Activity pause timeout for HistoryRecord{43d5c310 com.example.hellojni/.HelloJni}
D/dalvikvm( 873): GC freed 165 objects / 6624 bytes in 81ms
you hadnt built the library(.so) file of the project thats why you are getting this error, try to build the project with help of android-ndk http://developer.android.com/sdk/ndk/index.html and cygwin http://www.cygwin.com/

Embedding Google MapView crashes android app

model : zt180
firmware : android 2.1-update1-20101030
kernel : 2.6.32.9 usbandroid #1608
build number zt180-eng 2.1-update1 20101030
google maps : 4.5.1
Various crashes occur when embedding the google maps component into an android application. I'm connecting to a router via Wi-Fi for internet access. The stand-alone google maps app seems to work fine. To re-produce, start the maps app and begin scrolling around.
Will fail within a couple of minutes, occasionally on start-up (in setContentView). Most of the errors are when drawing tiles in google code. Sometimes just an Android SEGV.
NOTE : I've tested the same app on the Android developer phone 2 (os 1.6), and it works fine.
My android app is as follows:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.google.android.maps.MapView
android:id="#+id/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="043yBg1m9IiFNKXIhN5LsdeNndw2k7yrw4Ja3xQ"/>
</RelativeLayout>
import com.google.android.maps.MapActivity;
import android.os.Bundle;
public class Maps extends MapActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
protected boolean isRouteDisplayed() { return false; }
}
=========================
W/MapActivity( 2745): Recycling dispatcher com.google.googlenav.datarequest.DataRequestDispatcher#45ebcd30
V/MapActivity( 2745): Recycling map object.
I/ActivityManager( 2010): Displayed activity com.brta.android.lite/.Maps: 720 ms (total 720 ms)
I/MapActivity( 2745): Handling network change notification:CONNECTED
E/MapActivity( 2745): Couldn't get connection factory client
D/AndroidRuntime( 2745): Shutting down VM
W/dalvikvm( 2745): threadid=3: thread exiting with uncaught exception (group=0x4001b168)
E/AndroidRuntime( 2745): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime( 2745): java.lang.IncompatibleClassChangeError: interface not implemented
E/AndroidRuntime( 2745): at com.google.googlenav.map.Map.checkPaintTimeExceeded(Unknown Source)
E/AndroidRuntime( 2745): at com.google.googlenav.map.Map.drawMapBackground(Unknown Source)
E/AndroidRuntime( 2745): at com.google.googlenav.map.Map.drawMap(Unknown Source)
E/AndroidRuntime( 2745): at com.google.android.maps.MapView.drawMap(MapView.java:1048)
E/AndroidRuntime( 2745): at com.google.android.maps.MapView.onDraw(MapView.java:486)
<snip>
I/Process ( 2745): Sending signal. PID: 2745 SIG: 9
I/ActivityManager( 2010): Process com.brta.android.lite (pid 2745) has died.
I/WindowManager( 2010): WIN DEATH: Window{46112878 com.brta.android.lite/com.brta.android.lite.Maps paused=false}
I/UsageStats( 2010): Unexpected resume of org.adw.launcher while already resumed in com.brta.android.lite`
======================================================================
I/MapActivity( 2863): Handling network change notification:CONNECTED
E/MapActivity( 2863): Couldn't get connection factory client
D/dalvikvm( 2863): GC freed 8114 objects / 577376 bytes in 86ms
D/dalvikvm( 2863): GC freed 685 objects / 444384 bytes in 85ms
D/dalvikvm( 2863): GC freed 3458 objects / 259456 bytes in 79ms
I/ActivityManager( 2010): Displayed activity com.brta.android.lite/.Maps: 4407 ms (total 4407 ms)
D/AndroidRuntime( 2863): Shutting down VM
W/dalvikvm( 2863): threadid=3: thread exiting with uncaught exception (group=0x4001b168)
E/AndroidRuntime( 2863): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime( 2863): java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 0
E/AndroidRuntime( 2863): at java.util.Vector.elementAt(Vector.java:331)
E/AndroidRuntime( 2863): at com.google.googlenav.map.Map.drawTile(Unknown Source)
E/AndroidRuntime( 2863): at com.google.googlenav.map.Map.drawMapBackground(Unknown Source)
E/AndroidRuntime( 2863): at com.google.googlenav.map.Map.drawMap(Unknown Source)
E/AndroidRuntime( 2863): at com.google.android.maps.MapView.drawMap(MapView.java:1048)
E/AndroidRuntime( 2863): at com.google.android.maps.MapView.onDraw(MapView.java:486)
E/AndroidRuntime( 2863): at android.view.View.draw(View.java:6535)
E/AndroidRuntime( 2863): at android.view.ViewGroup.drawChild(ViewGroup.java:1531)
E/AndroidRuntime( 2863): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
<snip>
E/AndroidRuntime( 2863): at dalvik.system.NativeStart.main(Native Method)
I/Process ( 2010): Sending signal. PID: 2863 SIG: 3
I/dalvikvm( 2863): threadid=7: reacting to signal 3
I/dalvikvm( 2863): Wrote stack trace to '/data/anr/traces.txt'
I/Process ( 2863): Sending signal. PID: 2863 SIG: 9
I/WindowManager( 2010): WIN DEATH: Window{460ac708 com.brta.android.lite/com.brta.android.lite.Maps paused=false}
I/ActivityManager( 2010): Process com.brta.android.lite (pid 2863) has died.
I/UsageStats( 2010): Unexpected resume of org.adw.launcher while already resumed in com.brta.android.lite
W/InputManagerService( 2010): Got RemoteException sending setActive(false) notification to pid 2863 uid 10046
Basically, lots of bad things start happening...
The ZT-180 does not have Google Maps, AFAIK.

Exception on ListPreferences

This is my first Android app and I've encountered an exception when trying to use the ListPreference. The application loads along with the preferences... but when i touch the ListPreference entry the applications "stops unexpectedly".
Settings.java
public class Settings extends PreferenceActivity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.addPreferencesFromResource(R.layout.settings);
}
}
settings.xml
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android">
<CheckBoxPreference
android:key="chk_enabled"
android:summary="SMS response based on settings"
android:title="Enable"
/>
<ListPreference
android:title="Contacts"
android:summary="Contacs that will be sent SMSs"
android:key="list_contacts"
android:defaultValue="0"
android:entries="#array/list_entries"
android:entryValues="#array/list_values"
/>
</PreferenceScreen>
arrays.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="list_entries">
<item>All</item>
<item>WhiteList</item>
<item>BlackList</item>
</string-array>
<integer-array name="list_values">
<item>0</item>
<item>1</item>
<item>2</item>
</integer-array>
</resources>
This is the logcat output:
D/AndroidRuntime( 3187): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
D/AndroidRuntime( 3187): CheckJNI is OFF
D/AndroidRuntime( 3187): --- registering native functions ---
I/jdwp ( 3187): received file descriptor 16 from ADB
/ddm-heap( 3187): Got feature list request
I/ActivityManager( 86): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=tml.UI.main/.MainActivity }
D/AndroidRuntime( 3187): Shutting down VM
D/dalvikvm( 3187): DestroyJavaVM waiting for non-daemon threads to exit
I/ActivityManager( 86): Start proc tml.UI.main for activity tml.UI.main/.MainActivity: pid=3194 uid=10039 gids={1015}
D/dalvikvm( 3187): DestroyJavaVM shutting VM down
D/dalvikvm( 3187): HeapWorker thread shutting down
D/dalvikvm( 3187): HeapWorker thread has shut down
D/jdwp ( 3187): JDWP shutting down net...
D/jdwp ( 3187): +++ peer disconnected
I/dalvikvm( 3187): Debugger has detached; object registry had 1 entries
D/dalvikvm( 3187): VM cleaning up
D/dalvikvm( 3187): LinearAlloc 0x0 used 676380 of 4194304 (16%)
I/jdwp ( 3194): received file descriptor 10 from ADB
D/ddm-heap( 3194): Got feature list request
W/Resources( 3194): Converting to string: TypedValue{t=0x10/d=0x0 a=-1}
I/ActivityManager( 86): Displayed activity tml.UI.main/.MainActivity: 977 ms (total 977 ms)
D/AndroidRuntime( 3194): Shutting down VM
W/dalvikvm( 3194): threadid=3: thread exiting with uncaught exception (group=0x4001da28)
E/AndroidRuntime( 3194): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime( 3194): java.lang.NullPointerException
E/AndroidRuntime( 3194): at android.preference.ListPreference.findIndexOfValue(ListPreference.java:169)
E/AndroidRuntime( 3194): at android.preference.ListPreference.getValueIndex(ListPreference.java:178)
E/AndroidRuntime( 3194): at android.preference.ListPreference.onPrepareDialogBuilder(ListPreference.java:190)
E/AndroidRuntime( 3194): at android.preference.DialogPreference.showDialog(DialogPreference.java:291)
E/AndroidRuntime( 3194): at android.preference.DialogPreference.onClick(DialogPreference.java:262)
E/AndroidRuntime( 3194): at android.preference.Preference.performClick(Preference.java:811)
E/AndroidRuntime( 3194): at android.preference.PreferenceScreen.onItemClick(PreferenceScreen.java:190)
E/AndroidRuntime( 3194): at android.widget.AdapterView.performItemClick(AdapterView.java:284)
E/AndroidRuntime( 3194): at android.widget.ListView.performItemClick(ListView.java:3246)
E/AndroidRuntime( 3194): at android.widget.AbsListView$PerformClick.run(AbsListView.java:1635)
E/AndroidRuntime( 3194): at android.os.Handler.handleCallback(Handler.java:587)
E/AndroidRuntime( 3194): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 3194): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 3194): at android.app.ActivityThread.main(ActivityThread.java:4203)
E/AndroidRuntime( 3194): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 3194): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 3194): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
E/AndroidRuntime( 3194): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
E/AndroidRuntime( 3194): at dalvik.system.NativeStart.main(Native Method)
I/Process ( 86): Sending signal. PID: 3194 SIG: 3
I/dalvikvm( 3194): threadid=7: reacting to signal 3
I/dalvikvm( 3194): Wrote stack trace to '/data/anr/traces.txt'
I/Process ( 3194): Sending signal. PID: 3194 SIG: 9
I/ActivityManager( 86): Process tml.UI.main (pid 3194) has died.
I/WindowManager( 86): WIN DEATH: Window{4341fd00 tml.UI.main/tml.UI.main.MainActivity paused=false}
W/UsageStats( 86): Unexpected resume of com.android.launcher while already resumed in tml.UI.main
W/InputManagerService( 86): Got RemoteException sending setActive(false) notification to pid 3194 uid 10039
I fixed it... I kept on trying and, at the end, it turns out that I cannot use an integer-array as the entryValues Source. I just changed that integer-array to a string-array and got it working.
If there's a way to use integer-array as the source for entryValues please comment.
I've been searching for a similar solution to what you are looking for, agreeing that you should be able to use an Integer array to read from and store an integer result.
A solution to this problem I found was at http://kvance.livejournal.com/1039349.html, which I found to be useful.
It doesn't quite solve the problem the way I was thinking or that way I think you want it to, instead you still specify your initial / selection values with a String array although when the ListPreference saves it back to the SharedPreferences it saves as an Integer instead of a String (doing the conversion when the user selects it), removing the need to have to convert it possibly many times throughout your application when accessing the preference value.

Categories

Resources