AndroidDev 板


LINE

MainActivity.java: http://pastie.org/private/ug3fro2yrh9lukiyxelwww activity_main.xml: http://pastie.org/private/iuck0z7owdnbgudvla13tq strings.xml: http://pastie.org/private/4zibxnwupplfimtqjashsw 这是小弟写的计算机程式 内容大概是有两条 TextView, 一行是 expression,使用者输入按键就会显示在上面 另一行是 result,使用者按下 '=' 就会把结果显示出来 我只有写完按下按钮可以出现 expression 就先测试,结果一 run 就停止了..... 原本还有在提示 ErrorLog 提示 NullPointerException 我把 expression = ""; expressionPrevious = ""; 改成 expression = new String(""); expressionPrevious = new String(""); 以後似乎就好了?!我想说可能是 "" 是常数不能修改,需要先 new 物件 但实际原因还是不太清楚 orz... (我是 Java 新手,比较常写 C++... ) 因为最後还是不能跑... 以下截录自 Console [2013-11-18 00:39:03 - Calculator] ------------------------------ [2013-11-18 00:39:03 - Calculator] Android Launch! [2013-11-18 00:39:03 - Calculator] adb is running normally. [2013-11-18 00:39:03 - Calculator] Performing com.example.calculator87.MainActivity activity launch [2013-11-18 00:39:03 - Calculator] Automatic Target Mode: Unable to detect device compatibility. Please select a target device. [2013-11-18 00:39:08 - Calculator] Application already deployed. No need to reinstall. [2013-11-18 00:39:08 - Calculator] Starting activity com.example.calculator87.MainActivity on device TCFY9SFY59V4UKSG [2013-11-18 00:39:08 - Calculator] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.calculator/.MainActivity } 好像没有什麽跟错误有关的讯息?!看起来应该正常才对 然後看 LogCat 狂洗画面也不知道在写些什麽 以下节录自一些 all message 的 LogCat 讯息 (com.example.calculate (Session Filter) 倒是没东西... ) 11-18 00:32:46.356: I/PowerManagerService(507): setBrightness mButtonLight 0. 11-18 00:32:46.356: D/PowerManagerService(507): updateScreenStateLocked: mDisplayReady=true, newScreenState=2, mWakefulness=1, mWakeLockSummary=0x0, mUserActivitySummary=0x1, mBootCompleted=true 11-18 00:32:46.356: D/IPCThreadState(507): [DN #5] BR_CLEAR_DEATH_NOTIFICATION_DONE cookie 0x616c0e18 11-18 00:32:46.357: D/PowerManagerService(507): handleSandman: canDream=true, mWakefulness=Awake 11-18 00:32:46.360: D/dalvikvm(27092): threadid=34: exiting 11-18 00:32:46.361: D/dalvikvm(27092): threadid=34: bye! 11-18 00:32:46.498: I/SurfaceTextureClient(598): [STC::queueBuffer] (this:0x5e756fb0) fps:2.97, dur:1009.41, max:511.73, min:109.83 11-18 00:32:46.498: I/BufferQueue(133): [StatusBar](this:0x41b6f6f8,api:1) [queue] fps:2.97, dur:1009.41, max:511.57, min:110.01 11-18 00:32:46.531: I/SurfaceFlinger(133): [SurfaceFlinger] fps:2.973932,dur:1008.77,max:511.88,min:100.85 11-18 00:32:46.535: V/Provider/Settings(651): from settings cache , name = pdp_watchdog_poll_interval_ms , value = null 11-18 00:32:46.536: D/ADB_SERVICES(18953): adb fdevent_process list (15) (17) 11-18 00:32:46.536: D/ADB_SERVICES(18953): adb socket read list (17) 11-18 00:32:46.536: D/ADB_SERVICES(18953): read_data=45712 11-18 00:32:46.536: D/ADB_SERVICES(18953): max_read_time=0.000138 max_send_time=0.000081 11-18 00:32:46.537: D/ADB_SERVICES(18953): adb local_socket_ready list (17) 11-18 00:32:46.667: D/PowerManagerDisplayController(507): updateAmbientLux: Possibly brightened, waiting for 300 ms: brighteningLuxThreshold=181.96902, mRecentShortTermAverageLux=217.93811, mRecentLongTermAverageLux=201.8294, mAmbientLux=165.42638 11-18 00:32:46.907: D/PowerManagerDisplayController(507): updateAmbientLux: Canceled debounce: brighteningLuxThreshold=181.96902, darkeningLuxThreshold=132.34111, mRecentShortTermAverageLux=177.04062, mRecentLongTermAverageLux=188.2631, mAmbientLux=165.42638 11-18 00:32:47.316: V/AlarmManager(507): Native set alarm :Alarm{4272c690 type 2 com.google.android.gms} 11-18 00:32:47.316: I/AlarmManager(507): reset poweroff alarm none 11-18 00:32:47.317: V/ActivityManager(507): Broadcast: Intent { act=com.android.internal.telephony.gprs-data-stall flg=0x14 (has extras) } ordered=true userid=0 11-18 00:32:47.322: D/PowerManagerService(507): acquireWakeLockInternal: lock=1107100528, flags=0x1, tag="AlarmManager", ws={WorkSource: uids=[1001]}, uid=1000, pid=507 11-18 00:32:47.323: D/PowerManagerService(507): updateWakeLockSummaryLocked: mWakefulness=Awake, mWakeLockSummary=0x1 11-18 00:32:47.332: D/PowerManagerService(507): newScreenState = 2 11-18 00:32:47.333: D/PowerManagerDisplayController(507): requestPowerState: screenState=2, useProximitySensor=false, screenBrightness=102, screenAutoBrightnessAdjustment=0.0, useAutoBrightness=true, useEcoBrightness=false, blockScreenOn=false, waitForNegativeProximity=false 11-18 00:32:47.334: D/Provider/Settings(651): put string name = radio.data.stall.recovery.action , value = 0 userHandle = 0 11-18 00:32:47.335: I/PowerManagerService(507): setBrightness mButtonLight 0. 11-18 00:32:47.335: D/PowerManagerService(507): updateScreenStateLocked: mDisplayReady=true, newScreenState=2, mWakefulness=1, mWakeLockSummary=0x1, mUserActivitySummary=0x1, mBootCompleted=true 11-18 00:32:47.336: D/PowerManagerService(507): handleSandman: canDream=true, mWakefulness=Awake 11-18 00:32:47.337: D/SettingsProvider(507): call request for 0 11-18 00:32:47.338: V/SettingsProvider(507): call_put(system:radio.data.stall.recovery.action=0) for 0 11-18 00:32:47.338: V/SettingsProvider(507): insert(content://settings/system) for user 0 by 0 11-18 00:32:47.338: D/SettingsProvider(507): insert(content://settings/system) for user 0 by 0 11-18 00:32:47.339: D/SettingsProvider(507): redundant, old Value: 0 new value: 0 想破头想不出为什麽会这样! 请大家给我指点一下吧!!!谢谢!!! --



※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 210.66.250.37
1F:→ mamaya3:随便看了一下 你的TextView的取得跟setText时机好像反了 11/18 01:08
2F:→ awwseed:先取得物件(findViewById) 再 setText看看? 11/18 02:12
3F:→ AnyaAlstreim:我把 initialize() 和 setObject() 对调就过了 11/18 02:26
4F:→ AnyaAlstreim:一开始是写对的说,忘记为什麽要把这两个对调... 11/18 02:27
5F:→ AnyaAlstreim:非常感谢一、二楼!!!!!!!! 天阿 T___T 竟然是这种... 11/18 02:28
6F:→ KeySabre:炸exception应该找AndroidRuntime吐的log啊 11/19 03:01







like.gif 您可能会有兴趣的文章
icon.png[问题/行为] 猫晚上进房间会不会有憋尿问题
icon.pngRe: [闲聊] 选了错误的女孩成为魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一张
icon.png[心得] EMS高领长版毛衣.墨小楼MC1002
icon.png[分享] 丹龙隔热纸GE55+33+22
icon.png[问题] 清洗洗衣机
icon.png[寻物] 窗台下的空间
icon.png[闲聊] 双极の女神1 木魔爵
icon.png[售车] 新竹 1997 march 1297cc 白色 四门
icon.png[讨论] 能从照片感受到摄影者心情吗
icon.png[狂贺] 贺贺贺贺 贺!岛村卯月!总选举NO.1
icon.png[难过] 羡慕白皮肤的女生
icon.png阅读文章
icon.png[黑特]
icon.png[问题] SBK S1安装於安全帽位置
icon.png[分享] 旧woo100绝版开箱!!
icon.pngRe: [无言] 关於小包卫生纸
icon.png[开箱] E5-2683V3 RX480Strix 快睿C1 简单测试
icon.png[心得] 苍の海贼龙 地狱 执行者16PT
icon.png[售车] 1999年Virage iO 1.8EXi
icon.png[心得] 挑战33 LV10 狮子座pt solo
icon.png[闲聊] 手把手教你不被桶之新手主购教学
icon.png[分享] Civic Type R 量产版官方照无预警流出
icon.png[售车] Golf 4 2.0 银色 自排
icon.png[出售] Graco提篮汽座(有底座)2000元诚可议
icon.png[问题] 请问补牙材质掉了还能再补吗?(台中半年内
icon.png[问题] 44th 单曲 生写竟然都给重复的啊啊!
icon.png[心得] 华南红卡/icash 核卡
icon.png[问题] 拔牙矫正这样正常吗
icon.png[赠送] 老莫高业 初业 102年版
icon.png[情报] 三大行动支付 本季掀战火
icon.png[宝宝] 博客来Amos水蜡笔5/1特价五折
icon.pngRe: [心得] 新鲜人一些面试分享
icon.png[心得] 苍の海贼龙 地狱 麒麟25PT
icon.pngRe: [闲聊] (君の名は。雷慎入) 君名二创漫画翻译
icon.pngRe: [闲聊] OGN中场影片:失踪人口局 (英文字幕)
icon.png[问题] 台湾大哥大4G讯号差
icon.png[出售] [全国]全新千寻侘草LED灯, 水草

请输入看板名称,例如:iOS站内搜寻

TOP