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

  • Home
  • SEARCH
  • 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 8550819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:02:51+00:00 2026-06-11T14:02:51+00:00

The application just crash every time I try to click from the list. ListMovingNames.java

  • 0

The application just crash every time I try to click from the list.

ListMovingNames.java

public class ListMovingNames extends Activity {
    ListView MoveList;
    SQLHandler SQLHandlerview;
    Cursor cursor;
    Button addMove;
    EditText etAddMove;
    TextView temp;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.selectorcreatemove);

        addMove = (Button) findViewById(R.id.bAddMove);
        etAddMove = (EditText) findViewById(R.id.etMoveName);
        temp = (TextView) findViewById(R.id.tvTemp);

        MoveList = (ListView) findViewById(R.id.lvMoveItems);
        SQLHandlerview = new SQLHandler(this);

        SQLHandlerview = new SQLHandler(ListMovingNames.this);
        SQLHandlerview.open();

        cursor = SQLHandlerview.getMove();
        startManagingCursor(cursor);

        String[] from = new String[]{SQLHandler.KEY_MOVENAME};
        int[] to = new int[]{R.id.text};

        SimpleCursorAdapter cursorAdapter = new SimpleCursorAdapter(this, R.layout.row, cursor, from, to);
        MoveList.setAdapter(cursorAdapter);
        SQLHandlerview.close();

        addMove.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {
                // TODO Auto-generated method stub
                    try {
                        String ssmoveName = etAddMove.getText().toString();
                        SQLHandler entry = new SQLHandler(ListMovingNames.this);
                        entry.open();
                        entry.createMove(ssmoveName);
                        entry.close();
                    } catch (SQLException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
            }
        });

        MoveList.setOnItemClickListener(new OnItemClickListener() {

            @SuppressLint("ShowToast")
            public void onItemClick(AdapterView<?> arg0, View view, int position,
                    long id) {
                // TODO Auto-generated method stub
//              String moveset = cursor.getString(position);
//              temp.setText(moveset);
                Toast.makeText(ListMovingNames.this, position, Toast.LENGTH_SHORT);
            }
        });
    }

}

and here’s my database handler. But I’m sure that there’s nothing wrong with it, its probably the cursor adapter.

SQLHandler.java

public class SQLHandler {
    public static final String KEY_ROOMMOVEHOLDER = "roommoveholder";
    public static final String KEY_ROOM = "room";

    public static final String KEY_ITEMMOVEHOLDER = "itemmoveholder";
    public static final String KEY_ITEMNAME = "itemname";
    public static final String KEY_ITEMVALUE = "itemvalue";
    public static final String KEY_ROOMHOLDER = "roomholder";

    public static final String KEY_MOVENAME = "movename";
    public static final String KEY_ID1 = "_id";
    public static final String KEY_ID2 = "_id";
    public static final String KEY_ID3 = "_id";
    public static final String KEY_ID4 = "_id";
    public static final String KEY_MOVEDATE = "movedate";

    private static final String DATABASE_NAME = "mymovingfriend";
    private static final int DATABASE_VERSION = 1;

    public static final String KEY_SORTANDPURGE = "sortandpurge";
    public static final String KEY_RESEARCH = "research";
    public static final String KEY_CREATEMOVINGBINDER = "createmovingbinder";
    public static final String KEY_ORDERSUPPLIES = "ordersupplies";
    public static final String KEY_USEITORLOSEIT = "useitorloseit";
    public static final String KEY_TAKEMEASUREMENTS = "takemeasurements";
    public static final String KEY_CHOOSEMOVER = "choosemover";
    public static final String KEY_BEGINPACKING = "beginpacking";
    public static final String KEY_LABEL = "label";
    public static final String KEY_SEPARATEVALUES = "separatevalues";
    public static final String KEY_DOACHANGEOFADDRESS = "doachangeofaddress";
    public static final String KEY_NOTIFYIMPORTANTPARTIES = "notifyimportantparties";

    private static final String DATABASE_TABLE1 = "movingname";
    private static final String DATABASE_TABLE2 = "movingrooms";
    private static final String DATABASE_TABLE3 = "movingitems";
    private static final String DATABASE_TABLE4 = "todolist";

    public static final String CREATE_TABLE_1 = "CREATE TABLE " + DATABASE_TABLE1 + " (" + 
            KEY_ID1 + " INTEGER PRIMARY KEY AUTOINCREMENT," + 
            KEY_MOVEDATE + " TEXT NOT NULL, " + 
            KEY_MOVENAME + " TEXT NOT NULL);";

    public static final String CREATE_TABLE_2 = "CREATE TABLE " + DATABASE_TABLE2 + " (" + 
            KEY_ID2 + " INTEGER PRIMARY KEY AUTOINCREMENT," + 
            KEY_ROOMMOVEHOLDER + " TEXT NOT NULL, " + 
            KEY_ROOM + " TEXT NOT NULL);";

    public static final String CREATE_TABLE_3 = "CREATE TABLE " + DATABASE_TABLE3 + " (" + 
            KEY_ID3 + " INTEGER PRIMARY KEY AUTOINCREMENT," + 
            KEY_ITEMNAME + " TEXT NOT NULL, " + 
            KEY_ITEMVALUE + " TEXT NOT NULL, " +
            KEY_ROOMHOLDER + " TEXT NOT NULL, " +   
            KEY_ITEMMOVEHOLDER + " TEXT NOT NULL);";

    public static final String CREATE_TABLE_4 = "CREATE TABLE " + DATABASE_TABLE4 + " (" + 
            KEY_ID4 + " INTEGER PRIMARY KEY AUTOINCREMENT," + 
            KEY_SORTANDPURGE + " TEXT NOT NULL, " + 
            KEY_RESEARCH + " INTEGER NOT NULL, " +
            KEY_CREATEMOVINGBINDER + " TEXT NOT NULL, " + 
            KEY_ORDERSUPPLIES + " TEXT NOT NULL, " +
            KEY_USEITORLOSEIT + " TEXT NOT NULL, " + 
            KEY_TAKEMEASUREMENTS + " TEXT NOT NULL, " +
            KEY_CHOOSEMOVER + " TEXT NOT NULL, " + 
            KEY_BEGINPACKING + " TEXT NOT NULL, " +
            KEY_LABEL + " TEXT NOT NULL, " + 
            KEY_SEPARATEVALUES + " TEXT NOT NULL, " +
            KEY_DOACHANGEOFADDRESS + " TEXT NOT NULL, " + 
            KEY_NOTIFYIMPORTANTPARTIES + " TEXT NOT NULL);";

    private DbHelper ourHelper;
    private final Context ourContext;
    private SQLiteDatabase ourDatabase;

    private static class DbHelper extends SQLiteOpenHelper{

        public DbHelper(Context context) {
            super(context, DATABASE_NAME, null, DATABASE_VERSION);
            // TODO Auto-generated constructor stub
        }

        @Override
        public void onCreate(SQLiteDatabase db) {
            // TODO Auto-generated method stub
            db.execSQL(CREATE_TABLE_1);
            db.execSQL(CREATE_TABLE_2);
            db.execSQL(CREATE_TABLE_3);
            db.execSQL(CREATE_TABLE_4);
        }

        @Override
        public void onUpgrade(SQLiteDatabase db, int oldversion, int newversion) {
            // TODO Auto-generated method stub
            db.execSQL("DROP TABLE IF EXISTS " + DATABASE_TABLE1);
            db.execSQL("DROP TABLE IF EXISTS " + DATABASE_TABLE2);
            db.execSQL("DROP TABLE IF EXISTS " + DATABASE_TABLE3);
            db.execSQL("DROP TABLE IF EXISTS " + DATABASE_TABLE4);
            onCreate(db);
        }
    }

    public SQLHandler(Context c){
        ourContext = c;
    }

    public SQLHandler open() throws SQLException{
        ourHelper = new DbHelper(ourContext);
        ourDatabase = ourHelper.getWritableDatabase();
        return this;
    }

    public void close(){
        ourHelper.close();
    }

    public long createMove(String smovename){
        ContentValues cv = new ContentValues();
        cv.put(KEY_MOVENAME, smovename);
        cv.put(KEY_MOVEDATE, "Not yet set");
        return ourDatabase.insert(DATABASE_TABLE1, null, cv);
    }

    public long addRooms(String sroommoveholder, String sroom){
        ContentValues cv = new ContentValues();
        cv.put(KEY_ROOMMOVEHOLDER, sroommoveholder);
        cv.put(KEY_ROOM, sroom);
        return ourDatabase.insert(DATABASE_TABLE2, null, cv);
    }

    public long addItems(String sitemmoveholder, String sroomholder, String sitemname, String sitemvalue){
        ContentValues cv = new ContentValues();
        cv.put(KEY_ITEMMOVEHOLDER, sitemmoveholder);
        cv.put(KEY_ROOMHOLDER, sroomholder);
        cv.put(KEY_ITEMNAME, sitemname);
        cv.put(KEY_ITEMVALUE, sitemvalue);
        return ourDatabase.insert(DATABASE_TABLE3, null, cv);
    }

    public long todoList(String todoitem){
        ContentValues cv = new ContentValues();
        cv.put(todoitem, "Done");
        return ourDatabase.insert(DATABASE_TABLE4, null, cv);
    }

    public Cursor getMove(){
        String[] columns = new String[]{KEY_ID1, KEY_MOVENAME};
        Cursor cursor = ourDatabase.query(DATABASE_TABLE1, columns, null, null, null, null, null);
        return cursor;
    }

}

can anyone point out what I’m doing wrong?

here’s the log

09-19 03:22:36.596: E/AndroidRuntime(679): FATAL EXCEPTION: main
09-19 03:22:36.596: E/AndroidRuntime(679): android.content.res.Resources$NotFoundException: String resource ID #0x0
09-19 03:22:36.596: E/AndroidRuntime(679):  at android.content.res.Resources.getText(Resources.java:201)
09-19 03:22:36.596: E/AndroidRuntime(679):  at android.widget.Toast.makeText(Toast.java:258)
09-19 03:22:36.596: E/AndroidRuntime(679):  at standard.internet.marketing.mymovingfriend.ListMovingNames$2.onItemClick(ListMovingNames.java:78)
09-19 03:22:36.596: E/AndroidRuntime(679):  at android.widget.AdapterView.performItemClick(AdapterView.java:284)
09-19 03:22:36.596: E/AndroidRuntime(679):  at android.widget.ListView.performItemClick(ListView.java:3382)
09-19 03:22:36.596: E/AndroidRuntime(679):  at android.widget.AbsListView$PerformClick.run(AbsListView.java:1696)
09-19 03:22:36.596: E/AndroidRuntime(679):  at android.os.Handler.handleCallback(Handler.java:587)
09-19 03:22:36.596: E/AndroidRuntime(679):  at android.os.Handler.dispatchMessage(Handler.java:92)
09-19 03:22:36.596: E/AndroidRuntime(679):  at android.os.Looper.loop(Looper.java:123)
09-19 03:22:36.596: E/AndroidRuntime(679):  at android.app.ActivityThread.main(ActivityThread.java:4627)
09-19 03:22:36.596: E/AndroidRuntime(679):  at java.lang.reflect.Method.invokeNative(Native Method)
09-19 03:22:36.596: E/AndroidRuntime(679):  at java.lang.reflect.Method.invoke(Method.java:521)
09-19 03:22:36.596: E/AndroidRuntime(679):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
09-19 03:22:36.596: E/AndroidRuntime(679):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
09-19 03:22:36.596: E/AndroidRuntime(679):  at dalvik.system.NativeStart.main(Native Method)
  • 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-11T14:02:52+00:00Added an answer on June 11, 2026 at 2:02 pm
    Toast.makeText(ListMovingNames.this, position, Toast.LENGTH_SHORT);
    

    the second parameter is resource ID.

    Toast.makeText(ListMovingNames.this, String.valueOf(position), Toast.LENGTH_SHORT);
    

    use this method replace up.

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

Sidebar

Related Questions

All UITextViews on my application just won't hide the keyboard when i click the
My Java application has started to crash regularly with a SIGSEGV and a dump
What are your tricks on getting the caching part of web application just right?
Can I deploy SQL Server Express with my desktop application just like builtin database?
I created a fresh project (Xcode 4, Master-Detail application) just to see if I'm
I have a simple MVC 4 (Beta) Application and just observed something that I
I've got application settings working just fine. However, I'd like to be able to
I have created application where i just need to access data form assets folder.
I am running a Grails application and it just gets stuck in the Configuring
I currently have a UINavigationController based application that works just fine. I'd like to

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.