Note that there are some explanatory texts on larger screens.

plurals
  1. POError displaying database within a ListView
    primarykey
    data
    text
    <p>I am displaying my database in a <code>ListView</code>. I used a <code>Button</code> named <code>find geopoint</code> for displaying the database. when I click on it, the application crashes. Here is the stack trace:</p> <pre><code>08-25 17:03:11.308: ERROR/AndroidRuntime(8373): Uncaught handler: thread main exiting due to uncaught exception 08-25 17:03:11.338: ERROR/AndroidRuntime(8373): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.cortes/com.cortes.Display}: java.lang.IllegalStateException: get field slot from row 1 col -1 failed 08-25 17:03:11.338: ERROR/AndroidRuntime(8373): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496) 08-25 17:03:11.338: ERROR/AndroidRuntime(8373): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512) 08-25 17:03:11.338: ERROR/AndroidRuntime(8373): at android.app.ActivityThread.access$2200(ActivityThread.java:119) 08-25 17:03:11.338: ERROR/AndroidRuntime(8373): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863) 08-25 17:03:11.338: ERROR/AndroidRuntime(8373): at android.os.Handler.dispatchMessage(Handler.java:99) 08-25 17:03:11.338: ERROR/AndroidRuntime(8373): at android.os.Looper.loop(Looper.java:123) 08-25 17:03:11.338: ERROR/AndroidRuntime(8373): at android.app.ActivityThread.main(ActivityThread.java:4363) 08-25 17:03:11.338: ERROR/AndroidRuntime(8373): at java.lang.reflect.Method.invokeNative(Native Method) 08-25 17:03:11.338: ERROR/AndroidRuntime(8373): at java.lang.reflect.Method.invoke(Method.java:521) 08-25 17:03:11.338: ERROR/AndroidRuntime(8373): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:862) 08-25 17:03:11.338: ERROR/AndroidRuntime(8373): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620) 08-25 17:03:11.338: ERROR/AndroidRuntime(8373): at dalvik.system.NativeStart.main(Native Method) 08-25 17:03:11.338: ERROR/AndroidRuntime(8373): Caused by: java.lang.IllegalStateException: get field slot from row 1 col -1 failed 08-25 17:03:11.338: ERROR/AndroidRuntime(8373): at android.database.CursorWindow.getString_native(Native Method) 08-25 17:03:11.338: ERROR/AndroidRuntime(8373): at android.database.CursorWindow.getString(CursorWindow.java:363) 08-25 17:03:11.338: ERROR/AndroidRuntime(8373): at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:49) 08-25 17:03:11.338: ERROR/AndroidRuntime(8373): at com.cortes.Display.onCreate(Display.java:116) 08-25 17:03:11.338: ERROR/AndroidRuntime(8373): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 08-25 17:03:11.338: ERROR/AndroidRuntime(8373): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459) 08-25 17:03:11.338: ERROR/AndroidRuntime(8373): ... 11 more </code></pre> <p>Here is my code:</p> <pre><code>c = db.query(Geo_Create_Table, new String[ {"_id","latitude","longitude","address"}, null,null, null, null, null); x1 = c.getColumnIndex("_id"); y1 = c.getColumnIndex("latitude"); z1 = c.getColumnIndex("longiitude"); w1 = c.getColumnIndex("address"); while(c.moveToNext()) { a = c.getInt(x1); b1 = c.getString(y1); c1 = c.getString(z1); e = c.getString(w1); results.add(a+"" + " " + b1 + " " + c1 + " " + e); } ArrayAdapter&lt;String&gt; a11=new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, results); lv.setAdapter(a11); </code></pre> <p>Here is my <code>AndroidManifest.xml</code> file:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.cortes" android:versionCode="1" android:versionName="1.0"&gt; &lt;uses-sdk android:minSdkVersion="7" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /&gt; &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt; &lt;uses-library android:required="true" android:name="com.google.android.maps"/&gt; &lt;activity android:name=".Cortes" android:label="@string/app_name"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name=".Display" android:label="@string/app_name" android:launchMode="singleTask"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.VIEW" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;/application&gt; &lt;/manifest&gt; </code></pre> <p>Any suggestions on how to solve this problem?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload