When the statement is executed
android.database.sqlite.SQLiteOpenHelper.getReadableDatabase () , the
reported android.os.NetworkOnMainThreadException exception.
Great God seeking advice . . . .
------ Solution ---------------------------------------- ----
hello , this sentence does not perform right out of this exception , the exception is the network operating mainly in the main thread inside, you open another thread to perform a time-consuming operation on the line, I hope to help you
landlord to help poke http://vote.blog.csdn.net/blogstaritem/blogstar2013/xiaanming
------ eference --------------------------------------- < br> when
debug, the program went this sentence when he throws the exception . . .
------ eference --------------------------------------- < br> when
debug, the program went this sentence when he throws the exception . . .
it will be placed in the sub- code database operation thread to execute
------ eference ---------------------- ----------------- when
debug, the program went this sentence when he throws the exception . . .
it will be placed in the sub- code database operations to execute thread
issue has been resolved. .
plus entrance to the main thread
StrictMode.setThreadPolicy (new StrictMode.ThreadPolicy.Builder ()
. detectDiskReads ()
. detectDiskWrites ()
. detectNetwork ()
. penaltyLog ()
build ()).;
StrictMode.setVmPolicy (new StrictMode.VmPolicy.Builder ()
. detectLeakedSqlLiteObjects () / / detect SQLite database operations
. detectLeakedClosableObjects ()
. penaltyLog ()
. penaltyDeath ()
build ()).; Before adding
wrong place . . .
没有评论:
发表评论