asmackフレームワーク、openfireサーバでandroidチャットウィジェットを実現

1338 ワード

1,注意:TApplication.connection.login(username,password)は必ずTApplication.connection.isConnected()=trueの後に実行します.サーバと長い接続を確立する必要があるためです.
解決コード:
 

new Thread(){ run(){
int count=0;
while(count<3000&&TApplication.connection.isConnected()==false){
   count++;
this.sleep(20);
}
}}
2, :android UI ,   , (main thread)。

   UI ( ), , Android UI (components from the Android UI toolkit (components from the android.widget and android.view packages)) 。

   main thread UI thread UI 。



   , UI UI , UI 。

   , ( onKeyDown() ) UI 。



   App (intensive) , , performance poor。

   , UI , , UI , ( )。 , , , UI blocked ( 5 ), ANR(application not responding) 。

   ,Andoid UI toolkit , UI UI 。 UI UI , Android :

  1. UI 。

  2. UI Android UI toolkit( :android.widget and android.view)。