dimanche 3 janvier 2016

Android Java table has no column named

I keep getting the following error after I tried to add another column to my database.

table xxx has no column named _xxx

I googled and people said to delete the app and the data that did not solve my issue. Thus people said to update database version number, but did not solve it neither.

Inside my MainActivity I call it like this:

public class MainActivity extends AppCompatActivity
        implements NavigationDrawerFragment.NavigationDrawerCallbacks {
    /**
     * Fragment managing the behaviors, interactions and presentation of the navigation drawer.
     */
    private NavigationDrawerFragment mNavigationDrawerFragment;

    /**
     * Used to store the last screen title. For use in {@link #restoreActionBar()}.
     */
    private CharSequence mTitle;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // Inserting Contacts
        DatabaseHandler db = new DatabaseHandler(this);
        // delete
        db.deleteDatabase(db.DATABASE_NAME);
        //
        db.addContact(new Contact("cat 1\n", "cat 2z\n", "cat 3 z\n", "cat 4 \n", "cat 5 \n", "cat 6 \n", "cat 7 \n", "cat 8 \n", "cat 9 \n"));
        db.addContact(new Contact("cat 1 2.\n", "cat 2 2.\n", "cat 3 2.\n", "cat 4 2.\n" , "cat 5 2.\n", "cat 6 2.", "catt 7 2.\n", "cat 8 2.\n", "cat 9 2."));

...

Strange is that I added this column just similiar to the other 8 ones, if I delete the code for this column the app works just fine, but I want to add columns, but again I get that error.

Please need some help

Aucun commentaire:

Enregistrer un commentaire