You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
valBuilder="android.app.AlertDialog${'$'}Builder"valOnClickListener="android.content.DialogInterface${'$'}OnClickListener"Log.e("Reflect","11111")
Builder<Context>(this) // Like AlertDialog.Builder(context)
.calls("setTitle")("Hello World") // Call matched specific named function
.calls("setPositiveButton")("OK",
OnClickListener.createInners {
// Like object: DialogInterface.OnClickListener/*** * Like: * override fun onClick(dialog: Any, which: Int){ * * }*/override<Any, Int>("onClick") { dialog, which ->
}
})
.calls("create").calls("show")() // Like builder.create().show()Log.e("Reflect","22222")
2020-05-19 14:25:59.881 11753-11753/com.cc.test E/Reflect: 11111
2020-05-19 14:26:03.056 11753-11764/com.cc.test I/iesupportsampl: Background concurrent copying GC freed 95320(4MB) AllocSpace objects, 2(40KB) LOS objects, 65% free, 3MB/9MB, paused 493us total 126.728ms
2020-05-19 14:26:05.403 11753-11753/com.cc.test E/Reflect: 22222
2020-05-19 14:26:05.407 11753-11753/com.cc.test I/Choreographer: Skipped 331 frames! The application may be doing too much work on its main thread.
通过运行日志发现,执行这段代码产生了掉帧,主线程卡顿的问题。
使用例子:
2020-05-19 14:25:59.881 11753-11753/com.cc.test E/Reflect: 11111
2020-05-19 14:26:03.056 11753-11764/com.cc.test I/iesupportsampl: Background concurrent copying GC freed 95320(4MB) AllocSpace objects, 2(40KB) LOS objects, 65% free, 3MB/9MB, paused 493us total 126.728ms
2020-05-19 14:26:05.403 11753-11753/com.cc.test E/Reflect: 22222
2020-05-19 14:26:05.407 11753-11753/com.cc.test I/Choreographer: Skipped 331 frames! The application may be doing too much work on its main thread.
通过运行日志发现,执行这段代码产生了掉帧,主线程卡顿的问题。
如果是正常的创建Dialog,耗时很小。
2020-05-19 14:25:56.320 11753-11753/com.cc.test E/Reflect: 33333
2020-05-19 14:25:56.465 11753-11753/com.cc.test E/Reflect: 44444
The text was updated successfully, but these errors were encountered: