0
안녕하세요, AysncTask를 가지고있어 화면을 숨길 때 실행되는 로딩 뷰를 부풀려하고 싶습니다. 아무도 이것을하는 방법을 아는가? 순간에로드보기가 표시되지 않습니다. 안드로이드 AsyncTask의보기 표시 및 숨기기
이
내가 시도 무엇@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
loadingView = LayoutInflater.from(getBaseContext()).inflate(R.layout.loadingcell,
null);
//Check Preferences which sets UI
checkPreferences();
PostTask posttask;
posttask = new PostTask();
posttask.execute();
}
@Override
protected Boolean doInBackground(Void... params) {
boolean result = false;
loadFixtures();
publishProgress("progress");
loadResultsFeed();
publishProgress("progress");
loadNewsFeed();
publishProgress("progress");
return result;
}
protected void onProgressUpdate(String... progress) {
StringBuilder str = new StringBuilder();
for (int i = 1; i < progress.length; i++) {
str.append(progress[i] + " ");
}
}
@Override
protected void onPostExecute(Boolean result) {
super.onPostExecute(result);
Log.v("BGThread", "begin fillin data");
FillData();
loadingView.setVisibility(View.GONE);
}
}
loadingcell.xml
당신은Activity
에 대한 내용이 필요
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/white"
android:id="@+id/loadingcell">
<include
layout="@layout/header" />
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="87dp" />
<TextView
android:id="@+id/textView1"
android:layout_width="115dp"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/progressBar1"
android:gravity="center"
android:text="Loading..."
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/blue" />
</RelativeLayout>
(http://samir-mangroliya.blogspot.in/p/android-asynctask-example.html) –
통해 UR Que..duplicate를 반복하지 않습니다 [이 참조]. http://stackoverflow.com/q/11013505/1289716 – MAC
@SamirMangroliya 안녕하세요 Samir은 대화 상자를 사용하지 않고이 작업을 수행 할 수있는 방법이 있습니다. 그냥 로딩 및 회 전자라고하는 텍스트보기가있는 페이지를 원한다면 postexecute 그것을 숨기십시오 –