Android EditText追加for循环

时间:2014-03-17 21:31:22

标签: java android android-asynctask broadcast

这是我的'edittext append'void:

public static void consolePrint(String message, String color,Activity c){
    SimpleDateFormat konsoltarihbase = new SimpleDateFormat("HH:mm:ss");


    String konsoltarih = konsoltarihbase.format(new Date());
    final EditText konsol = (EditText) c.findViewById(R.id.konsol);
    final ScrollView scroll = (ScrollView) c.findViewById(R.id.scroll);
    konsol.append("["+konsoltarih+"] ");
    konsol.append(Html.fromHtml("<font color='"+color+"'>"+"<b>"+message+ "</b>" , null, null));
    konsol.append("\n");        
    scroll.post(new Runnable() { 
        public void run() { 
            scroll.smoothScrollTo(0, konsol.getBottom());
        } 
    }); 
}

这是我的任务:

   public void runTask() {

     Query query = new Query("followback");
     QueryResult result = null;
     boolean skip;
        ConfigurationBuilder cb = new ConfigurationBuilder();
        cb.setDebugEnabled(true)
          .setOAuthConsumerKey("key")
          .setOAuthConsumerSecret("keyx")
          // set.Auth(response);
          .setOAuthAccessToken("token")
          .setOAuthAccessTokenSecret("tokenx");
        TwitterFactory tf = new TwitterFactory(cb.build());
        final Twitter twitter_for_dump = tf.getInstance();
         consolePrint("[M] MiDoSFollowTagsDumpBot dump edildi", "green", this);
        try {
            result = twitter_for_dump.search(query);
        } catch (TwitterException e2) {
             myData = "[ERR]";  
            e2.printStackTrace();
        }

            for (twitter4j.Status status : result.getTweets()) {
             try {
                 if (twitter_for_dump.showFriendship( twitter_for_dump.getScreenName(),status.getUser()
                         .getScreenName()).isSourceFollowingTarget()){
                                 consolePrint("[ERR] "+(status.getUser().getScreenName()+" zaten takip ediliyor!"),"red", this);

                        skip=true;
                 } else{
                     twitter_for_dump.createFriendship(status.getUser().getScreenName());
                                 consolePrint("[OK] "+(status.getUser().getScreenName()+" takip edildi!"),"green", this);

                    skip=false;
                    }
            } catch (TwitterException e) {
                skip=true;
                 try {
                    if (twitter_for_dump.getScreenName().equals
                             (status.getUser().getScreenName())){
                                 consolePrint("[OK] YOURSELF!","yellow", this);
                     } else {
                                 consolePrint("[FATAL ERROR]"+(status.getUser().getScreenName()+" takip edilemedi!"),"red", this);
                        }
                } catch (TwitterException e1) {

                }}  }
    }   

}   

但是,我的任务在运行时,应用程序没有响应。任务完成后,所有consolePrints同时写入。 当需要立即打印屏幕时,我该怎么办?

http://i.hizliresim.com/eN71EN.png

对不起我的英文。感谢

0 个答案:

没有答案