2

こんばんは、TabsListener を使用して 3 つのタブ (フラグメント) を持つアプリケーションを実装しました。最初のタブフラグメントで特定のボタンを押している間、進行状況ダイアログを表示しようとしています。問題は、進行状況ダイアログが表示されず、他のすべてが正常に機能することです。私はAndroidを初めて使用し、答えは非常に簡単だと確信していますが、解決策を見つけようとしてこれに何時間も費やしました。以下は私のコードです

public class AFragment extends DialogFragment { static TextView tx; Button bt; OnClickListener handler1; OnClickListener handler2; SQLiteDatabase mydb; int counter=0; private Button mStartActivityButton; public final static String ProgressInsert = "Please wait while data is being inserted..."; public final static String ProgressSelect = "Please wait while your query is being executed ..."; /**/ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View view; view=inflater.inflate(R.layout.afragment, container, false); final ProgressDialog pd = new ProgressDialog(view.getContext()); pd.setCancelable(false); pd.setMessage("Working..."); pd.isIndeterminate(); //pd.setContentView(view); pd.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); tx = (TextView) view.findViewById(R.id.textView2); bt = (Button) view.findViewById(R.id.button1); mStartActivityButton = (Button)view.findViewById(R.id.start_file_picker_button); mStartActivityButton.setOnClickListener(handler2 = new View.OnClickListener() { public void onClick(View v) { ((MainActivity) getActivity()).Browse_Button(view.getContext()); } }); bt.setOnClickListener(handler1 = new View.OnClickListener() {/////////This is the button i press and i want the progress dialog to appear! public void onClick(View v) { pd.show(); tx.setText(((MainActivity) getActivity()).ShowRecs()); pd.hide(); } }); return view; }//////End of onCreateView!!!!! protected static void settxt(StringBuilder textt) { //mFilePathTextView.setText(textt); tx.setText(textt); } }//////////End of Afragment Class!!!!!!!!!!!!
4

0 に答える 0