什么是MainActivity $ 1 $ 1

时间:2015-05-11 10:57:49

标签: java android exception

我正在开发Android应用程序并且我发现了日志错误:

05-11 12:45:29.623  27110-27110/focalys.avh_android W/System.err﹕ java.lang.reflect.InvocationTargetException
05-11 12:45:29.623  27110-27110/focalys.avh_android W/System.err﹕ at java.lang.reflect.Method.invokeNative(Native Method)
05-11 12:45:29.623  27110-27110/focalys.avh_android W/System.err﹕ at java.lang.reflect.Method.invoke(Method.java:515)
05-11 12:45:29.623  27110-27110/focalys.avh_android W/System.err﹕ at focalys.android_avh.connection.Connection.call(Connection.java:85)
05-11 12:45:29.623  27110-27110/focalys.avh_android W/System.err﹕ at focalys.android_avh.connection.Connection.onPostExecute(Connection.java:70)
05-11 12:45:29.623  27110-27110/focalys.avh_android W/System.err﹕ at focalys.android_avh.connection.Connection.onPostExecute(Connection.java:19)
05-11 12:45:29.623  27110-27110/focalys.avh_android W/System.err﹕ at android.os.AsyncTask.finish(AsyncTask.java:632)
05-11 12:45:29.623  27110-27110/focalys.avh_android W/System.err﹕ at android.os.AsyncTask.access$600(AsyncTask.java:177)
05-11 12:45:29.633  27110-27110/focalys.avh_android W/System.err﹕ at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645)
05-11 12:45:29.633  27110-27110/focalys.avh_android W/System.err﹕ at android.os.Handler.dispatchMessage(Handler.java:102)
05-11 12:45:29.633  27110-27110/focalys.avh_android W/System.err﹕ at android.os.Looper.loop(Looper.java:146)
05-11 12:45:29.633  27110-27110/focalys.avh_android W/System.err﹕ at android.app.ActivityThread.main(ActivityThread.java:5653)
05-11 12:45:29.633  27110-27110/focalys.avh_android W/System.err﹕ at java.lang.reflect.Method.invokeNative(Native Method)
05-11 12:45:29.633  27110-27110/focalys.avh_android W/System.err﹕ at java.lang.reflect.Method.invoke(Method.java:515)
05-11 12:45:29.633  27110-27110/focalys.avh_android W/System.err﹕ at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
05-11 12:45:29.633  27110-27110/focalys.avh_android W/System.err﹕ at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
05-11 12:45:29.633  27110-27110/focalys.avh_android W/System.err﹕ at dalvik.system.NativeStart.main(Native Method)
05-11 12:45:29.633  27110-27110/focalys.avh_android W/System.err﹕ Caused by: java.lang.IllegalArgumentException: expected receiver of type focalys.android_avh.connection.MainActivity$1$1, but got java.lang.Boolean
05-11 12:45:29.633  27110-27110/focalys.avh_android W/System.err﹕ at java.lang.reflect.Method.invokeNative(Native Method)
05-11 12:45:29.633  27110-27110/focalys.avh_android W/System.err﹕ at java.lang.reflect.Method.invoke(Method.java:515)
05-11 12:45:29.633  27110-27110/focalys.avh_android W/System.err﹕ at focalys.android_avh.connection.AvhWS$1.call(AvhWS.java:44)
05-11 12:45:29.633  27110-27110/focalys.avh_android W/System.err﹕ at focalys.android_avh.connection.AvhWS$1.auth(AvhWS.java:37)
05-11 12:45:29.633  27110-27110/focalys.avh_android W/System.err﹕ ... 16 more

我想专注于这一行: 05-11 12:45:29.633 27110-27110/focalys.avh_android W/System.err﹕ Caused by: java.lang.IllegalArgumentException: expected receiver of type focalys.android_avh.connection.MainActivity$1$1,但获得了java.lang.Boolean 因为我不明白什么是MainActivity$1$1。它应该代表什么?它是一个对象,一个方法吗?

感谢您的帮助!

1 个答案:

答案 0 :(得分:0)

好的,我发现了我的问题。我实际上是在尝试进行回调,但有一种更简单的方法可以通过使用和接口来实现它,如下例所示:

http://www.justinmccandless.com/blog/Setting+Up+a+Callback+Function+in+Android

希望它会有所帮助! 无论如何,谢谢你的回答。