리스트 뷰 & 쓰레드 관련하여 문의 드립니다
보통 채팅같은경우 입력 버튼을 계속 누르면 해당 내용이 쓰레드로 서버에 계속 전달되는데 전달되는 내용을 리스트 뷰에 계속 추가 해서
해당 내용이 서버에 정상적으로 처리되면
해당 row에 대해 정상처리가 된었다고 표기 하고 아직 서버에 결과과 리터 되지 않았으면 계속 프로그레스 바가 돌고 있는 거 처럼 하고 시품은데 어떻게 해야 할지 몰라서요...
일반적으로 카카오툭 같은경우에도 계속 전송 버튼을 누르면 처리되기 전까지는 row별로 프로레스바가 돌고 있더라구요...
그래서 비슷하고 구현하려구 하는데 안되네요..
그럼 도움 부탁드립니다.
list_item.xml
=========================================
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/list_item"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="6dip"
android:orientation="horizontal">
<ProgressBar android:id="@+id/progress_small"
style="?android:attr/progressBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/txt_msg_date"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="6dip"
android:orientation="horizontal">
<TextView
android:id="@+id/txt_msg_ment"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
</LinearLayout>
</LinearLayout>
==========================================
아래 부분은 쓰레드 처리 부분
==========================================
public void InsertChatProc( final ChatInsMsgEntity mmChatInsMsgEntity ) {
final String outMsg1 = "";
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
String outMsg = mChatConnect2.ChatInsertProc(mmChatInsMsgEntity);
Message msg = handler2.obtainMessage();
Bundle b = new Bundle();
b.putString("outMsg", outMsg);
msg.setData(b);
handler2.sendMessage(msg);
}
});
thread.start();
}
Handler handler2 = new Handler() {
public void handleMessage(Message msg) {
String result = (String)msg.getData().get("outMsg");
Log.d("TMS","result=>"+result);
if(Util.isNotNull(result)){
}else{
}
}
};
==========================================




프로그레스바는 검색하면 많이 나오니 리스트뷰에 같이 뿌리시면 되고요.
리스트 내에서 돌리시고 싶으시면 notifyDataSetChanged()를 쓰시면 됩니다.
레이아웃에서 짜실거라면 visuable과 invisuable을 이용하시면 되고요.
이 부분에 대한것도 검색을 하시면 많이 나올거에요.
쓰레드 시작 부분에서 프로그레스바를 돌리시고 핸들러가 뿌려주는 부분에서 프로그레스바를 멈추시면 됩니다.
코딩해보지는 않았지만 이런 방법으로 진행하시다보면 금방 완성하실 수 있을 것 같네요.