- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想在将一些模式匹配到 url 后让我的按钮可见
一切正常,但它没有将我的按钮的可见性设置为 true我正在尝试这个
try {
sleep((int)(Math.random() * 1000));
btn = (Button) findViewById(R.id.My_btn);
btn.requestFocus();
btn.setVisibility(0);
//here btn.setvisibility(View.VISIBLE) also not working
}
这是我的按钮日志
05-04 10:30:12.212: WARN/InputManagerService(52): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@437da3e8
05-04 10:30:13.673: WARN/InputManagerService(52): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@4379d170
05-04 10:30:16.054: INFO/NotificationService(52): enqueueToast pkg=android.com.MobiintheMorning callback=android.app.ITransientNotification$Stub$Proxy@4376ae30 duration=0
05-04 10:30:16.064: INFO/System.out(677): button founded
05-04 10:30:16.629: WARN/dalvikvm(677): threadid=31: thread exiting with uncaught exception (group=0x4001aa28)
05-04 10:30:16.629: ERROR/AndroidRuntime(677): Uncaught handler: thread Thread-17 exiting due to uncaught exception
05-04 10:30:16.634: ERROR/AndroidRuntime(677): android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
05-04 10:30:16.634: ERROR/AndroidRuntime(677): at android.view.ViewRoot.checkThread(ViewRoot.java:2629)
05-04 10:30:16.634: ERROR/AndroidRuntime(677): at android.view.ViewRoot.focusableViewAvailable(ViewRoot.java:1519)
05-04 10:30:16.634: ERROR/AndroidRuntime(677): at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:448)
05-04 10:30:16.634: ERROR/AndroidRuntime(677): at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:448)
05-04 10:30:16.634: ERROR/AndroidRuntime(677): at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:448)
05-04 10:30:16.634: ERROR/AndroidRuntime(677): at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:448)
05-04 10:30:16.634: ERROR/AndroidRuntime(677): at android.view.View.setFlags(View.java:4270)
05-04 10:30:16.634: ERROR/AndroidRuntime(677): at android.view.View.setVisibility(View.java:2964)
05-04 10:30:16.634: ERROR/AndroidRuntime(677): at android.com.MobiintheMorning.MobiintheMorningActivity.btnvisibility(MobiintheMorningActivity.java:307)
05-04 10:30:16.634: ERROR/AndroidRuntime(677): at android.com.MobiintheMorning.MobiintheMorningActivity$temp.run(MobiintheMorningActivity.java:277)
05-04 10:30:16.644: INFO/Process(52): Sending signal. PID: 677 SIG: 3
05-04 10:30:16.644: INFO/dalvikvm(677): threadid=7: reacting to signal 3
05-04 10:30:16.644: ERROR/dalvikvm(677): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
05-04 10:33:50.293: DEBUG/AndroidRuntime(893): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
05-04 10:33:50.293: DEBUG/AndroidRuntime(893): CheckJNI is ON
05-04 10:33:50.494: DEBUG/AndroidRuntime(893): --- registering native functions ---
05-04 10:33:50.494: INFO/jdwp(893): received file descriptor 20 from ADB
05-04 10:33:50.693: DEBUG/ddm-heap(893): Got feature list request
05-04 10:33:51.133: DEBUG/PackageParser(52): Scanning package: /data/app/vmdl65231.tmp
05-04 10:33:51.314: INFO/PackageManager(52): Removing non-system package:android.com.MobiintheMorning
05-04 10:33:51.314: DEBUG/PackageManager(52): Removing package android.com.MobiintheMorning
05-04 10:33:51.314: DEBUG/PackageManager(52): Activities: android.com.MobiintheMorning.MobiintheMorningActivity android.com.MobiintheMorning.FindFilesByType android.com.MobiintheMorning.EmailAct android.com.MobiintheMorning.DisplaySong
05-04 10:33:51.373: DEBUG/PackageManager(52): Scanning package android.com.MobiintheMorning
05-04 10:33:51.373: INFO/PackageManager(52): /data/app/vmdl65231.tmp changed; unpacking
05-04 10:33:51.383: DEBUG/installd(32): DexInv: --- BEGIN '/data/app/vmdl65231.tmp' ---
05-04 10:33:51.744: DEBUG/dalvikvm(900): DexOpt: load 36ms, verify 187ms, opt 2ms
05-04 10:33:51.774: DEBUG/installd(32): DexInv: --- END '/data/app/vmdl65231.tmp' (success) ---
05-04 10:33:51.774: DEBUG/PackageManager(52): Activities: android.com.MobiintheMorning.MobiintheMorningActivity android.com.MobiintheMorning.FindFilesByType android.com.MobiintheMorning.EmailAct android.com.MobiintheMorning.DisplaySong
05-04 10:33:51.793: DEBUG/ActivityManager(52): Uninstalling process android.com.MobiintheMorning
05-04 10:33:51.793: DEBUG/ActivityManager(52): Force removing process ProcessRecord{438e6a48 677:android.com.MobiintheMorning/10022} (android.com.MobiintheMorning/10022)
05-04 10:33:51.803: INFO/Process(52): Sending signal. PID: 677 SIG: 9
05-04 10:33:51.892: WARN/UsageStats(52): Unexpected resume of com.android.launcher while already resumed in android.com.MobiintheMorning
05-04 10:33:51.934: INFO/WindowManager(52): WIN DEATH: Window{438462b8 android.com.MobiintheMorning/android.com.MobiintheMorning.MobiintheMorningActivity paused=false}
05-04 10:33:51.943: DEBUG/ActivityManager(52): Received spurious death notification for thread android.os.BinderProxy@43845d50
05-04 10:33:51.963: WARN/InputManagerService(52): Got RemoteException sending setActive(false) notification to pid 677 uid 10022
05-04 10:33:52.194: INFO/installd(32): move /data/dalvik-cache/data@app@vmdl65231.tmp@classes.dex -> /data/dalvik-cache/data@app@android.com.MobiintheMorning.apk@classes.dex
05-04 10:33:52.204: DEBUG/PackageManager(52): New package installed in /data/app/android.com.MobiintheMorning.apk
05-04 10:33:52.284: DEBUG/AndroidRuntime(893): Shutting down VM
05-04 10:33:52.284: DEBUG/dalvikvm(893): DestroyJavaVM waiting for non-daemon threads to exit
05-04 10:33:52.294: DEBUG/ActivityManager(52): Uninstalling process android.com.MobiintheMorning
05-04 10:33:52.303: DEBUG/dalvikvm(893): DestroyJavaVM shutting VM down
05-04 10:33:52.303: DEBUG/dalvikvm(893): HeapWorker thread shutting down
05-04 10:33:52.303: DEBUG/dalvikvm(893): HeapWorker thread has shut down
05-04 10:33:52.303: DEBUG/jdwp(893): JDWP shutting down net...
05-04 10:33:52.303: DEBUG/jdwp(893): Got wake-up signal, bailing out of select
05-04 10:33:52.303: INFO/dalvikvm(893): Debugger has detached; object registry had 1 entries
05-04 10:33:52.313: DEBUG/dalvikvm(893): VM cleaning up
05-04 10:33:52.354: DEBUG/dalvikvm(893): LinearAlloc 0x0 used 665236 of 4194304 (15%)
05-04 10:33:52.454: WARN/ResourceType(52): No package identifier when getting value for resource number 0x7f060000
05-04 10:33:52.464: WARN/ResourceType(52): No package identifier when getting value for resource number 0x7f060001
05-04 10:33:52.643: DEBUG/dalvikvm(95): GC freed 131 objects / 5400 bytes in 231ms
05-04 10:33:52.643: DEBUG/HomeLoaders(95): application intent received: android.intent.action.PACKAGE_REMOVED, replacing=true
05-04 10:33:52.643: DEBUG/HomeLoaders(95): --> package:android.com.MobiintheMorning
05-04 10:33:52.653: DEBUG/HomeLoaders(95): application intent received: android.intent.action.PACKAGE_ADDED, replacing=true
05-04 10:33:52.653: DEBUG/HomeLoaders(95): --> package:android.com.MobiintheMorning
05-04 10:33:52.653: DEBUG/HomeLoaders(95): --> update package android.com.MobiintheMorning
05-04 10:33:52.813: DEBUG/dalvikvm(52): GC freed 10887 objects / 620232 bytes in 335ms
05-04 10:33:52.983: WARN/ResourceType(52): No package identifier when getting value for resource number 0x7f060000
05-04 10:33:53.012: WARN/ResourceType(52): No package identifier when getting value for resource number 0x7f060001
05-04 10:33:53.363: DEBUG/AndroidRuntime(907): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
05-04 10:33:53.363: DEBUG/AndroidRuntime(907): CheckJNI is ON
05-04 10:33:53.543: DEBUG/AndroidRuntime(907): --- registering native functions ---
05-04 10:33:53.543: INFO/jdwp(907): received file descriptor 20 from ADB
05-04 10:33:53.734: DEBUG/ddm-heap(907): Got feature list request
05-04 10:33:54.154: INFO/ActivityManager(52): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=android.com.MobiintheMorning/.MobiintheMorningActivity }
05-04 10:33:54.183: DEBUG/AndroidRuntime(907): Shutting down VM
05-04 10:33:54.183: DEBUG/dalvikvm(907): DestroyJavaVM waiting for non-daemon threads to exit
05-04 10:33:54.223: DEBUG/dalvikvm(907): DestroyJavaVM shutting VM down
05-04 10:33:54.223: DEBUG/dalvikvm(907): HeapWorker thread shutting down
05-04 10:33:54.223: DEBUG/dalvikvm(907): HeapWorker thread has shut down
05-04 10:33:54.233: DEBUG/jdwp(907): JDWP shutting down net...
05-04 10:33:54.233: DEBUG/jdwp(907): +++ peer disconnected
05-04 10:33:54.233: INFO/dalvikvm(907): Debugger has detached; object registry had 1 entries
05-04 10:33:54.243: DEBUG/dalvikvm(907): VM cleaning up
05-04 10:33:54.253: INFO/ActivityManager(52): Start proc android.com.MobiintheMorning for activity android.com.MobiintheMorning/.MobiintheMorningActivity: pid=915 uid=10022 gids={3003, 1015}
05-04 10:33:54.313: DEBUG/dalvikvm(907): LinearAlloc 0x0 used 676828 of 4194304 (16%)
05-04 10:33:54.423: INFO/jdwp(915): received file descriptor 20 from ADB
05-04 10:33:54.473: DEBUG/ddm-heap(915): Got feature list request
05-04 10:33:55.513: INFO/ActivityManager(52): Displayed activity android.com.MobiintheMorning/.MobiintheMorningActivity: 1312 ms (total 1312 ms)
05-04 10:34:05.163: DEBUG/dalvikvm(237): GC freed 43 objects / 2088 bytes in 54ms
05-04 10:34:10.253: DEBUG/dalvikvm(95): GC freed 2943 objects / 167248 bytes in 96ms
05-04 10:34:14.213: DEBUG/dalvikvm(915): GC freed 2995 objects / 320496 bytes in 79ms
05-04 10:34:16.112: WARN/InputManagerService(52): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@4394c950
05-04 10:34:17.414: WARN/InputManagerService(52): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@4394d7b8
05-04 10:34:19.334: INFO/NotificationService(52): enqueueToast pkg=android.com.MobiintheMorning callback=android.app.ITransientNotification$Stub$Proxy@4394d9f0 duration=0
05-04 10:34:19.344: INFO/System.out(915): button founded
05-04 10:34:19.778: WARN/dalvikvm(915): threadid=31: thread exiting with uncaught exception (group=0x4001aa28)
05-04 10:34:19.778: ERROR/AndroidRuntime(915): Uncaught handler: thread Thread-17 exiting due to uncaught exception
05-04 10:34:19.783: ERROR/AndroidRuntime(915): android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
05-04 10:34:19.783: ERROR/AndroidRuntime(915): at android.view.ViewRoot.checkThread(ViewRoot.java:2629)
05-04 10:34:19.783: ERROR/AndroidRuntime(915): at android.view.ViewRoot.focusableViewAvailable(ViewRoot.java:1519)
05-04 10:34:19.783: ERROR/AndroidRuntime(915): at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:448)
05-04 10:34:19.783: ERROR/AndroidRuntime(915): at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:448)
05-04 10:34:19.783: ERROR/AndroidRuntime(915): at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:448)
05-04 10:34:19.783: ERROR/AndroidRuntime(915): at android.view.ViewGroup.focusableViewAvailable(ViewGroup.java:448)
05-04 10:34:19.783: ERROR/AndroidRuntime(915): at android.view.View.setFlags(View.java:4270)
05-04 10:34:19.783: ERROR/AndroidRuntime(915): at android.view.View.setVisibility(View.java:2964)
05-04 10:34:19.783: ERROR/AndroidRuntime(915): at android.com.MobiintheMorning.MobiintheMorningActivity$temp.run(MobiintheMorningActivity.java:277)
05-04 10:34:19.793: INFO/Process(52): Sending signal. PID: 915 SIG: 3
05-04 10:34:19.793: INFO/dalvikvm(915): threadid=7: reacting to signal 3
05-04 10:34:19.793: ERROR/dalvikvm(915): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
最佳答案
您遇到错误:
05-04 10:34:19.783: ERROR/AndroidRuntime(915): android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.05
这表明您正在尝试使按钮在非 ui 线程中可见。如果是这样,那么你需要做这样的事情,让 UI 线程改变按钮的可见性:
try{
btn.post(new Runnable() {
public void run() {
btn.requestFocus();
btn.setVisibility(0); // Or: btn.setVisibility(View.VISIBLE)
}});
}catch (Exception e) {
Log.d("test", e.toString());
}
关于android - 需要帮助使 android 按钮可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5878844/
我正在尝试用 C 语言编写一个使用 gstreamer 的 GTK+ 应用程序。 GTK+ 需要 gtk_main() 来执行。 gstreamer 需要 g_main_loop_run() 来执行。
我已经使用 apt-get 安装了 opencv。我得到了以下版本的opencv2,它工作正常: rover@rover_pi:/usr/lib/arm-linux-gnueabihf $ pytho
我有一个看起来像这样的 View 层次结构(基于其他答案和 Apple 的使用 UIScrollView 的高级 AutoLayout 指南): ScrollView 所需的2 个步骤是: 为 Scr
我尝试安装 udev。 udev 在 ./configure 期间给我一个错误 --exists: command not found configure: error: pkg-config and
我正在使用 SQLite 3。我有一个表,forums,有 150 行,还有一个表,posts,有大约 440 万行。每个帖子都属于一个论坛。 我想从每个论坛中选择最新帖子的时间戳。如果我使用 SEL
使用 go 和以下包: github.com/julienschmidt/httprouter github.com/shwoodard/jsonapi gopkg.in/mgo.v2/bson
The database仅包含 2 个表: 钱包(100 万行) 事务(1500 万行) CockroachDB 19.2.6 在 3 台 Ubuntu 机器上运行 每个 2vCPU 每个 8GB R
我很难理解为什么在下面的代码中直接调用 std::swap() 会导致编译错误,而使用 std::iter_swap 编译却没有任何错误. 来自 iter_swap() versus swap() -
我有一个非常简单的 SELECT *用 WHERE NOT EXISTS 查询条款。 SELECT * FROM "BMAN_TP3"."TT_SPLDR_55E63A28_59358" SELECT
我试图按部分组织我的 .css 文件,我需要从任何文件访问文件组中的任何类。在 Less 中,我可以毫无问题地创建一个包含所有文件导入的主文件,并且每个文件都导入主文件,但在 Sass 中,我收到一个
Microsoft.AspNet.SignalR.Redis 和 StackExchange.Redis.Extensions.Core 在同一个项目中使用。前者需要StackExchange.Red
这个问题在这里已经有了答案: Updating from Rails 4.0 to 4.1 gives sass-rails railties version conflicts (4 个答案) 关
我们有一些使用 Azure DevOps 发布管道部署到的现场服务器。我们已经使用这些发布管道几个月了,没有出现任何问题。今天,我们在下载该项目的工件时开始出现身份验证错误。 部署组中的节点显示在线,
Tip: instead of creating indexes here, run queries in your code – if you're missing any indexes, you
你能解释一下 Elm 下一个声明中的意思吗? (=>) = (,) 我在 Elm architecture tutorial 的例子中找到了它 最佳答案 这是中缀符号。实际上,这定义了一个函数 (=>
我需要一个 .NET 程序集查看器,它可以显示低级详细信息,例如元数据表内容等。 最佳答案 ildasm 是 IL 反汇编程序,具有低级托管元数据 token 信息。安装 Visual Studio
我有两个列表要在 Excel 中进行比较。这是一个很长的列表,我需要一个 excel 函数或 vba 代码来执行此操作。我已经没有想法了,因此转向你: **Old List** A
Closed. This question does not meet Stack Overflow guidelines。它当前不接受答案。 想要改善这个问题吗?更新问题,以便将其作为on-topi
我正在学习 xml 和 xml 处理。我无法很好地理解命名空间的存在。 我了解到命名空间帮助我们在 xml 中分离相同命名的元素。我们不能通过具有相同名称的属性来区分元素吗?为什么命名空间很重要或需要
我搜索了 Azure 文档、各种社区论坛和 google,但没有找到关于需要在公司防火墙上打开哪些端口以允许 Azure 所有组件(blob、sql、compute、bus、publish)的简洁声明
我是一名优秀的程序员,十分优秀!