Java Android EditText在for循环中追加

Java Android EditText在for循环中追加,java,android,android-asynctask,broadcast,Java,Android,Android Asynctask,Broadcast,这是我的“edittext追加”无效: 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 k

这是我的“edittext追加”无效:

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) {

                }}  }
    }   

}