경험하고 구현하는 방법 :ProgresDialog은 [안드로이드] 내가 다음 코드 한 문제를
public void onCreate(Bundle savedInstanceState) {
MyDialog = ProgressDialog.show(this, "Nalagam kanale" , "Prosimo počakaj ... ", true);
MyDialog.show();
... }
어느 실제로 그는 대화 ...하지만 문제는 모든로드 될 때 대화 상자가 표시됩니다 있다는 것입니다 시작합니다 ..
어떻게 해결할 수 있습니까?
실제 코드
package com.TVSpored;
import java.util.ArrayList;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.Activity;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ListView;
public class Currently extends Activity{
static final int PROGRESS_DIALOG = 0;
private ArrayList<CurrentlyItem> currentItems;
private CurrentAdapter aa;
private ListView currentListView;
private JSONArray CurrentShows;
private Communicator CommunicatorEPG;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.layout_currently);
CommunicatorEPG = new Communicator();
currentItems = new ArrayList<CurrentlyItem>();
if(currentItems == null)
int resID = R.layout.current_item;
aa = new CurrentAdapter(this, resID, currentItems);
currentListView = (ListView)findViewById(R.id.currentListView);
try {
currentListView.setAdapter(aa);
} catch (Exception e) {
Log.d(" * Napaka", e.toString());
}
try {
populateCurrent();
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void populateCurrent() throws JSONException
{
CurrentShows = CommunicatorEPG.getCurrentShows(0);
for (int i = 0; i < CurrentShows.length(); i++)
{
JSONObject jsonObject = CurrentShows.getJSONObject(i);
String start = jsonObject.getString("1");
Integer duration = jsonObject.getInt("2");
String title = jsonObject.getString("3");
String epg_channel = jsonObject.getString("4");
String channel_name = jsonObject.getString("5");
CurrentlyItem newItem = new CurrentlyItem(1, 2, 3, 4, 5);
currentItems.add(i, newItem);
}
}
}
이 몇 위해 노력 해왔다 ... 실제 코드는 ... 내가 AsyncTask
에서 populateCurrent();
을 할 싶습니다 표시하는 한편 나는 로딩 화면을 좋아하는 것입니다 시간은 있지만 실제 성공은 없습니다 ... 성공적으로 화면을로드하고 웬 물결을 JSONArray
표시했지만 목록보기를 업데이트 할 수 없습니다 ...
Thanks for support!
'super.onCreate (savedInstanceState);가 누락 된 것 같아요 –
어떤 행동을 기대합니까? 부모 활동이 표시되기 전에 대화 상자가 표시됩니까? – rajath
그래 부모 작업 전에 표시되고 싶습니다 ... –