Application loading slow and how to use strict mode in android

767 views Asked by At

I am facing lots of message through strict mode in logcat. May be this reason if i click next buttton on ui, then it takes long time almost 1 min. How to occure this, data loading process is fast. but why got strict mode log? i don't know. and finally, how to use strict mode in my 4.1.6 . what is the meaning of DEVELOPER_MODE. , StrictMode details ,

sample of logcat:

11-27 13:08:14.220: D/StrictMode(11010): StrictMode policy violation; ~duration=1492 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=23 violation=2
11-27 13:08:14.220: D/StrictMode(11010):    at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1135)
11-27 13:08:14.220: D/StrictMode(11010):    at android.database.sqlite.SQLiteConnection.applyBlockGuardPolicy(SQLiteConnection.java:1041)
11-27 13:08:14.220: D/StrictMode(11010):    at android.database.sqlite.SQLiteConnection.executeForLong(SQLiteConnection.java:595)
11-27 13:08:14.220: D/StrictMode(11010):    at android.database.sqlite.SQLiteConnection.setForeignKeyModeFromConfiguration(SQLiteConnection.java:281)
11-27 13:08:14.220: D/StrictMode(11010):    at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:214)
11-27 13:08:14.220: D/StrictMode(11010):    at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:193)
11-27 13:08:14.220: D/StrictMode(11010):    at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463)
11-27 13:08:14.220: D/StrictMode(11010):    at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185)
11-27 13:08:14.220: D/StrictMode(11010):    at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177)
11-27 13:08:14.220: D/StrictMode(11010):    at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:804)
11-27 13:08:14.220: D/StrictMode(11010):    at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:789)
11-27 13:08:14.220: D/StrictMode(11010):    at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:694)
11-27 13:08:14.220: D/StrictMode(11010):    at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:952)
11-27 13:08:14.220: D/StrictMode(11010):    at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:256)
11-27 13:08:14.220: D/StrictMode(11010):    at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:224)
11-27 13:08:14.220: D/StrictMode(11010):    at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164)
11-27 13:08:14.220: D/StrictMode(11010):    at com.project.dc.databases.DBAdapter.open(DBAdapter.java:224)
11-27 13:08:14.220: D/StrictMode(11010):    at com.project.dc.activity.RunFormActivity.saveOnSwipe(RunFormActivity.java:10641)
11-27 13:08:14.220: D/StrictMode(11010):    at com.project.dc.activity.RunFormActivity$34.onClick(RunFormActivity.java:2575)
11-27 13:08:14.220: D/StrictMode(11010):    at android.view.View.performClick(View.java:4438)
11-27 13:08:14.220: D/StrictMode(11010):    at android.view.View$PerformClick.run(View.java:18422)
11-27 13:08:14.220: D/StrictMode(11010):    at android.os.Handler.handleCallback(Handler.java:733)
11-27 13:08:14.220: D/StrictMode(11010):    at android.os.Handler.dispatchMessage(Handler.java:95)
11-27 13:08:14.220: D/StrictMode(11010):    at android.os.Looper.loop(Looper.java:136)
11-27 13:08:14.220: D/StrictMode(11010):    at android.app.ActivityThread.main(ActivityThread.java:5001)
11-27 13:08:14.220: D/StrictMode(11010):    at java.lang.reflect.Method.invokeNative(Native Method)
11-27 13:08:14.220: D/StrictMode(11010):    at java.lang.reflect.Method.invoke(Method.java:515)
11-27 13:08:14.220: D/StrictMode(11010):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
11-27 13:08:14.220: D/StrictMode(11010):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
11-27 13:08:14.220: D/StrictMode(11010):    at dalvik.system.NativeStart.main(Native Method)

i have getting following strict mode(logcat): http://pastebin.com/jeDa0YNA

I have depress this by taking this problem: please could you give some idea how to fix this.

1

There are 1 answers

0
nandeesh On

Your application is performing database operations on main Thread. So you are getting this error.

Move the saveonswipe call in OnClick to an AsyncTask