データの読み込み中にこの例外が発生したときに回転リフレッシュを表示したい。処理に非同期タスクを使用しています。進行状況ダイアログを適切に追加して回転効果を与える方法を教えてください。どんな助けでも大歓迎です。
私のウィジェット プロバイダーの class-onUpdate() メソッド
public void onUpdate(Context context, AppWidgetManager appWidgetManager,
int[] appWidgetIds) {
//---
mProgressDialog = new ProgressDialog(context);
mProgressDialog.setIndeterminate(false);
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
try {
fetchTask.execute().get();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ExecutionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
mContext = context;
}
protected void onPreExecute(){
mProgressDialog.show();
//updateViews.setViewVisibility(R.id.refresh, View.GONE);
//updateViews.setViewVisibility(R.id.progress, View.VISIBLE);
}
protected Store doInBackground(URL... arg0) {
//my stuff
}
protected void onPostExecute(Store storeObj) {
mProgressDialog.dismiss();
//updateViews.setViewVisibility(R.id.progress, View.GONE);
//updateViews.setViewVisibility(R.id.refresh, View.VISIBLE);
pushWidgetUpdate(mContext,updateViews);
}
私のxml
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent">
<ImageButton
android:id="@+id/refresh"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_marginLeft="25dp"
android:layout_marginRight="20dp"
android:background="#0079C1"
android:src="@drawable/navigation_refresh"
android:visibility="visible" />
<ProgressBar
android:id="@+id/progress"
android:indeterminate="true"
style="?android:attr/progressBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:visibility="gone" />
</RelativeLayout>