JavaWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JavaWorld@TW » Java ME、Google Android 平台與 JavaCard 討論區 » Android  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友    訂閱主題
reply to topicthreaded modego to previous topicgo to next topic
本主題所含的標籤
作者 圖片連續切換
lynn12386





發文: 6
積分: 0
於 2010-03-11 22:32 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我想讓圖片按一下按鈕,之後連續切換

一剛開始以為說是速度跑太快的問題

但是現再發現顯示出的結果會直接跳到最後一個

(因為加回圈下去跑也沒有出現第一張圖的情形)

想請問各位大大,

這種問題該如何解決?

目前出問題的程式碼如下(.JAVA部分)
1
2
3
4
5
6
7
8
9
10
11
12
13
    XXX.setOnClickListener(new Button.OnClickListener()
      {
    @Override
    public void onClick(View v) {
      // TODO Auto-generated method stub
        
      mpicture02.setImageDrawable(getResources()
          .getDrawable(R.drawable.01));
      for(int i = 1000000; i >0; i--){}
      mpicture02.setImageDrawable(getResources()
          .getDrawable(R.drawable.02));
    }
    });


vote up 0 vote down
reply to postreply to post
作者 Re:圖片連續切換 [Re:lynn12386]
Duncan

街友 JaJa

版主

發文: 7594
積分: 39
於 2010-03-11 22:40 user profilesend a private message to usersend email to Duncanreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
http://www.javaworld.com.tw/jute/post/view?bid=5&id=69411&tpg=1&ppg=1&sty=1&age=0#69411
雖然是不同的 Java runtime、不同的 UI subsystem,但原理是相同的。


vote up 0 vote down
reply to postreply to post

給我
貓咪 其餘免談

我要效法葛屁老師,我承認了,我是蘿莉控。
作者 Re:圖片連續切換 [Re:Duncan]
lynn12386





發文: 6
積分: 0
於 2010-03-12 12:03 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
恩,我研究看看

vote up 0 vote down
reply to postreply to post
作者 Re:圖片連續切換 [Re:Duncan]
lynn12386





發文: 6
積分: 0
於 2010-03-12 18:23 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
實驗結果是......

我還是不懂ORZ

請問大大還有沒有其他方法~


vote up 0 vote down
reply to postreply to post
作者 Re:圖片連續切換 [Re:lynn12386]
falous





發文: 2
積分: 0
於 2010-03-16 16:13 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
之前遇到同樣問題,這是我的解決方案,給你參考吧
private Handler mHandler;

class ArrowsTask extends TimerTask {
int count = 0 ;
public void run() {
mHandler.post(new Runnable() {
public void run() {
  ...
...
  count ++;

  最後判斷離開的寫法
timer.cancel();
}
});
}
}

@Override
public void onClick(View v) {
  ArrowsTask arrowTask = new ArrowsTask();
  timer = new Timer();
  timer.schedule(arrowTask, 1, 500);
}


vote up 0 vote down
reply to postreply to post

» JavaWorld@TW »  Java ME、Google Android 平台與 JavaCard 討論區 » Android

reply to topicthreaded modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JavaWorld@TW


Powered by Powerful JuteForum® Version Jute 1.5.8
Copyright© 2002-2003 Rainman Zhu,Zua,Netboy,Scott. All Rights Reserved.