Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8836595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:31:56+00:00 2026-06-14T09:31:56+00:00

Since , I am new in android world so , please help me. When

  • 0

Since , I am new in android world so , please help me. When i am working with Android SQLite for retrieving data from data-base by these codes-

Cursor cursor;
DatabaseConnector dbConnector = new DatabaseConnector(this);
private ListAdapter conAdapter;
String[] from_for_text_in_list = {"name"};
int[] to_for_text_in_list = {R.id.title_info_txt_v}
cursor = dbConnector.getAllContacts();
conAdapter = new SimpleCursorAdapter(Infoclass.this, R.layout.listview_layout, null, from_for_text_in_list, to_for_text_in_list);
setListAdapter(conAdapter);

Now i declare getAllmethod() as-

public Cursor getAllContacts()
{
    return database.rawQuery("SELECT _id, name FROM tcc_info_table ", new String[]{"_id", "name"});
}

“name” is just a column name of database in my App.

While I am running my App it shows NULL POINTER Exception in getAllContact() method . Even i check my database through SQLite Browser and i found that data insertion going on successfully . But data not retrieve from database to list view . My logCat error is as below-

            11-14 12:01:21.694: E/Trace(30607): error opening trace file: No such file or directory (2)

11-14 12:01:22.475: D/AndroidRuntime(30607): Shutting down VM
11-14 12:01:22.475: W/dalvikvm(30607): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
11-14 12:01:22.495: E/AndroidRuntime(30607): FATAL EXCEPTION: main
11-14 12:01:22.495: E/AndroidRuntime(30607): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.kt.narendramodi/com.kt.narendramodi.ModiForIndia}: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.kt.narendramodi/com.kt.narendramodi.InfoNarendraModi}: java.lang.IllegalArgumentException: Cannot bind argument at index 2 because the index is out of range.  The statement has 0 parameters.
11-14 12:01:22.495: E/AndroidRuntime(30607):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
11-14 12:01:22.495: E/AndroidRuntime(30607):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
11-14 12:01:22.495: E/AndroidRuntime(30607):    at android.app.ActivityThread.access$600(ActivityThread.java:130)
11-14 12:01:22.495: E/AndroidRuntime(30607):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
11-14 12:01:22.495: E/AndroidRuntime(30607):    at android.os.Handler.dispatchMessage(Handler.java:99)
11-14 12:01:22.495: E/AndroidRuntime(30607):    at android.os.Looper.loop(Looper.java:137)
11-14 12:01:22.495: E/AndroidRuntime(30607):    at android.app.ActivityThread.main(ActivityThread.java:4745)
11-14 12:01:22.495: E/AndroidRuntime(30607):    at java.lang.reflect.Method.invokeNative(Native Method)
11-14 12:01:22.495: E/AndroidRuntime(30607):    at java.lang.reflect.Method.invoke(Method.java:511)
11-14 12:01:22.495: E/AndroidRuntime(30607):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
11-14 12:01:22.495: E/AndroidRuntime(30607):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
11-14 12:01:22.495: E/AndroidRuntime(30607):    at dalvik.system.NativeStart.main(Native Method)
11-14 12:01:22.495: E/AndroidRuntime(30607): Caused by: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.kt.narendramodi/com.kt.narendramodi.InfoNarendraModi}: java.lang.IllegalArgumentException: Cannot bind argument at index 2 because the index is out of range.  The statement has 0 parameters.
11-14 12:01:22.495: E/AndroidRuntime(30607):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
11-14 12:01:22.495: E/AndroidRuntime(30607):    at android.app.ActivityThread.startActivityNow(ActivityThread.java:1900)
11-14 12:01:22.495: E/AndroidRuntime(30607):    at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:135)
11-14 12:01:22.495: E/AndroidRuntime(30607):    at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:347)
11-14 12:01:22.495: E/AndroidRuntime(30607):    at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:694)
11-14 12:01:22.495: E/AndroidRuntime(30607):    at android.widget.TabHost.setCurrentTab(TabHost.java:358)
11-14 12:01:22.495: E/AndroidRuntime(30607):    at android.widget.TabHost.addTab(TabHost.java:236)
11-14 12:01:22.495: E/AndroidRuntime(30607):    at com.kt.narendramodi.ModiForIndia.onCreate(ModiForIndia.java:41)
11-14 12:01:22.495: E/AndroidRuntime(30607):    at android.app.Activity.performCreate(Activity.java:5008)
11-14 12:01:22.495: E/AndroidRuntime(30607):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
11-14 12:01:22.495: E/AndroidRuntime(30607):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
11-14 12:01:22.495: E/AndroidRuntime(30607):    ... 11 more
11-14 12:01:22.495: E/AndroidRuntime(30607): Caused by: java.lang.IllegalArgumentException: Cannot bind argument at index 2 because the index is out of range.  The statement has 0 parameters.
11-14 12:01:22.495: E/AndroidRuntime(30607):    at android.database.sqlite.SQLiteProgram.bind(SQLiteProgram.java:212)
11-14 12:01:22.495: E/AndroidRuntime(30607):    at android.database.sqlite.SQLiteProgram.bindString(SQLiteProgram.java:166)
11-14 12:01:22.495: E/AndroidRuntime(30607):    at android.database.sqlite.SQLiteProgram.bindAllArgsAsStrings(SQLiteProgram.java:200)
11-14 12:01:22.495: E/AndroidRuntime(30607):    at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:47)
11-14 12:01:22.495: E/AndroidRuntime(30607):    at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1314)
11-14 12:01:22.495: E/AndroidRuntime(30607):    at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1253)
11-14 12:01:22.495: E/AndroidRuntime(30607):    at com.kt.nanrendramodi.databasehelper.DatabaseConnector.getAllContacts(DatabaseConnector.java:60)
11-14 12:01:22.495: E/AndroidRuntime(30607):    at com.kt.narendramodi.InfoNarendraModi.onCreate(InfoNarendraModi.java:94)
11-14 12:01:22.495: E/AndroidRuntime(30607):    at android.app.Activity.performCreate(Activity.java:5008)
11-14 12:01:22.495: E/AndroidRuntime(30607):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
11-14 12:01:22.495: E/AndroidRuntime(30607):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
11-14 12:01:22.495: E/AndroidRuntime(30607):    ... 21 more
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T09:31:57+00:00Added an answer on June 14, 2026 at 9:31 am

    You’ll have to check 2 things:

    1. Your database should be initialized to a read/write-able database.

      database = yourDbHelper.getReadableDatabase();

    2. You don’t need those selection arguments if you’ve filled the SQL query fully.

      database.rawQuery("SELECT _id, name FROM tcc_info_table ", null);

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ever since I added a new Class to my Android app (specifically, a sqlite
i am pretty new to the iOS world and since I'm coming from the
since the new Auth Dialog from Facebook (for my App & homepage), I cannot
I am working on a small MFC application..since am new to MFC I am
I am new to android app development so please any answers would be great
I'm new to Android development and it's been a long time since I've done
I'm using osmdroid on my new Android project (since I want to be able
Working as an .NET developer since I know myself and just bought an Android
Quite new to Android development and Java in general, so please excuse any amateur
I'm new to java/android and trying to help out with an open source project.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.