看板 AndroidDev 關於我們 聯絡資訊
private Camera.PictureCallback jpegCallback = new Camera.PictureCallback(){ public void onPictureTaken (byte[] data, Camera camera) { ((TextView)findViewById( R.id.save_file)).setText("a"); ((TextView)findViewById( R.id.save_file)).requestLayout(); try { Thread.sleep(1000); } catch (InterruptedException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } String path = "/sdcard/DCIM/xxxx.jpg"; File file = new File(path); try{ file.createNewFile(); OutputStream os2 = new BufferedOutputStream(new FileOutputStream(file),8192); os2.write(data); os2.close(); ((TextView)findViewById( R.id.save_file)).setText("b"); } catch ( IOException e ){ } synchronized(semaphore) { semaphore.notify(); } } }; 簡單來說問題就是 永遠只看得到 .setText("b"); 的顯示 .setText("a"); 永遠看不到 已經使用過一些看起來像是強制刷新UI的方法來更新 結果似乎永遠只會顯示最後檔案寫入完畢後的 .setText("b"); 請問這個該怎麼處理呢? -- ※ 編輯: erspicu 來自: 111.184.195.252 (06/03 23:49)
motors55:setText("a")寫在函數外? 06/07 01:00