discrepancy in using AsyncTask, code is executed in weird order
Posted
by Pentium10
on Stack Overflow
See other posts from Stack Overflow
or by Pentium10
Published on 2010-04-17T09:55:30Z
Indexed on
2010/04/17
10:03 UTC
Read the original article
Hit count: 220
Hello,
In onCreate method I hav the following order of code
objItem = new DbClass(this);//the onCreate event creates the database
new PrepareAdapter1().execute();//this task uses the tables, but SQLException occures, tables doesn't exists
As you see in my short code, I get a new instance of the SQLiteOpenHelper class, which does create the tables in onCreate. And after that I start an AsyncTask instance where I use the created table. But I get SQLiteException as table doesn't not exists.
I am using this code in wrong way? I expect the table to be created when I launch the thread.
© Stack Overflow or respective owner