有人知道为什么当我点击带有onclick()方法的按钮时,会调用广播接收器连接。这种广播是在连接切换为开启或反向时使用的。但我已经上网了,它被召唤了!
有错误:
09-04 22:35:25.285: E/SqliteDatabaseCpp(8057): CREATE TABLE android_metadata failed
09-04 22:35:25.285: E/SQLiteDatabase(8057): Failed to open the database. closing it.
09-04 22:35:25.285: E/SQLiteDatabase(8057): android.database.sqlite.SQLiteDatabaseLockedException: database is locked
09-04 22:35:25.285: E/SQLiteDatabase(8057): at android.database.sqlite.SQLiteDatabase.native_setLocale(Native Method)
09-04 22:35:25.285: E/SQLiteDatabase(8057): at android.database.sqlite.SQLiteDatabase.setLocale_(SQLiteDatabase.java:2211)
09-04 22:35:25.285: E/SQLiteDatabase(8057): at android.database.sqlite.SQLiteDatabase.setLocale(SQLiteDatabase.java:2199)
09-04 22:35:25.285: E/SQLiteDatabase(8057): at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1130)
09-04 22:35:25.285: E/SQLiteDatabase(8057): at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1081)
09-04 22:35:25.285: E/SQLiteDatabase(8057): at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:1167)
09-04 22:35:25.285: E/SQLiteDatabase(8057): at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:833)
09-04 22:35:25.285: E/SQLiteDatabase(8057): at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:221)
09-04 22:35:25.285: E/SQLiteDatabase(8057): at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:157)
09-04 22:35:25.285: E/SQLiteDatabase(8057): at com.background.Database.open(Database.java:135)
09-04 22:35:25.285: E/SQLiteDatabase(8057): at com.background.Broadcast_Reciver.onReceive(BroadcastService.java:100)
09-04 22:35:25.285: E/SQLiteDatabase(8057): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:728)
09-04 22:35:25.285: E/SQLiteDatabase(8057): at android.os.Handler.handleCallback(Handler.java:605)
09-04 22:35:25.285: E/SQLiteDatabase(8057): at android.os.Handler.dispatchMessage(Handler.java:92)
09-04 22:35:25.285: E/SQLiteDatabase(8057): at android.os.Looper.loop(Looper.java:137)
09-04 22:35:25.285: E/SQLiteDatabase(8057): at android.app.ActivityThread.main(ActivityThread.java:4507)
09-04 22:35:25.285: E/SQLiteDatabase(8057): at java.lang.reflect.Method.invokeNative(Native Method)
09-04 22:35:25.285: E/SQLiteDatabase(8057): at java.lang.reflect.Method.invoke(Method.java:511)
09-04 22:35:25.285: E/SQLiteDatabase(8057): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
09-04 22:35:25.285: E/SQLiteDatabase(8057): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
09-04 22:35:25.285: E/SQLiteDatabase(8057): at dalvik.system.NativeStart.main(Native Method)
09-04 22:35:25.285: D/AndroidRuntime(8057): Shutting down VM
09-04 22:35:25.285: W/dalvikvm(8057): threadid=1: thread exiting with uncaught exception (group=0x40c341f8)
09-04 22:35:25.300: E/AndroidRuntime(8057): FATAL EXCEPTION: main
09-04 22:35:25.300: E/AndroidRuntime(8057): java.lang.RuntimeException: Error receiving broadcast Intent { act=android.net.conn.CONNECTIVITY_CHANGE flg=0x10000010 (has extras) } in com.background.Broadcast_Reciver@41724178
09-04 22:35:25.300: E/AndroidRuntime(8057): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:737)
09-04 22:35:25.300: E/AndroidRuntime(8057): at android.os.Handler.handleCallback(Handler.java:605)
09-04 22:35:25.300: E/AndroidRuntime(8057): at android.os.Handler.dispatchMessage(Handler.java:92)
09-04 22:35:25.300: E/AndroidRuntime(8057): at android.os.Looper.loop(Looper.java:137)
09-04 22:35:25.300: E/AndroidRuntime(8057): at android.app.ActivityThread.main(ActivityThread.java:4507)
09-04 22:35:25.300: E/AndroidRuntime(8057): at java.lang.reflect.Method.invokeNative(Native Method)
09-04 22:35:25.300: E/AndroidRuntime(8057): at java.lang.reflect.Method.invoke(Method.java:511)
09-04 22:35:25.300: E/AndroidRuntime(8057): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
09-04 22:35:25.300: E/AndroidRuntime(8057): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
09-04 22:35:25.300: E/AndroidRuntime(8057): at dalvik.system.NativeStart.main(Native Method)
09-04 22:35:25.300: E/AndroidRuntime(8057): Caused by: android.database.sqlite.SQLiteDatabaseLockedException: database is locked
09-04 22:35:25.300: E/AndroidRuntime(8057): at android.database.sqlite.SQLiteDatabase.native_setLocale(Native Method)
09-04 22:35:25.300: E/AndroidRuntime(8057): at android.database.sqlite.SQLiteDatabase.setLocale_(SQLiteDatabase.java:2211)
09-04 22:35:25.300: E/AndroidRuntime(8057): at android.database.sqlite.SQLiteDatabase.setLocale(SQLiteDatabase.java:2199)
09-04 22:35:25.300: E/AndroidRuntime(8057): at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1130)
09-04 22:35:25.300: E/AndroidRuntime(8057): at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1081)
09-04 22:35:25.300: E/AndroidRuntime(8057): at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:1167)
09-04 22:35:25.300: E/AndroidRuntime(8057): at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:833)
09-04 22:35:25.300: E/AndroidRuntime(8057): at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:221)
09-04 22:35:25.300: E/AndroidRuntime(8057): at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:157)
09-04 22:35:25.300: E/AndroidRuntime(8057): at com.background.Database.open(Database.java:135)
09-04 22:35:25.300: E/AndroidRuntime(8057): at com.background.Broadcast_Reciver.onReceive(BroadcastService.java:100)
09-04 22:35:25.300: E/AndroidRuntime(8057): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:728)
09-04 22:35:25.300: E/AndroidRuntime(8057): ... 9 more
请看一下这个错误:
java.lang.RuntimeException: Error receiving broadcast Intent { act=android.net.conn.CONNECTIVITY_CHANGE flg=0x10000010 (has extras) } in com.background.Broadcast_Reciver@41724178