問題は、ハンドラを使用していないことです。これを行うだけで、
dialog = ProgressDialog.show(this, "Please wait",
"Gathering Information...", true);
Thread thread = new Thread()
{
@Override
public void run() {
if(Chapter_sync.size()>0){
storemodule();
c.open();
for(int i=0;i
そして、onCreate()ハンドラを作成すると、
Handler handler=null;
handler=new Handler()
{
public void handleMessage(Message msg)
{
progressDialog.cancel();
if(msg.what==0)
{
LinearLayout parentlayout=(LinearLayout)findViewById(R.id.chapterholder);
parentlayout.removeAllViews();
setUpViews();
};
バックグラウンドスレッドからUIを更新することはできません。 AsyncTaskを使用するか、バックグラウンドスレッドのハンドラを使用してメインスレッドにバックグラウンドアクションが完了したことを知らせる必要があります。