Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android fragments 片段-选项卡-进度对话框_Android Fragments_Progressdialog_Android Tabs - Fatal编程技术网

Android fragments 片段-选项卡-进度对话框

Android fragments 片段-选项卡-进度对话框,android-fragments,progressdialog,android-tabs,Android Fragments,Progressdialog,Android Tabs,晚上好,, 我使用TabsListener实现了一个有3个选项卡(片段)的应用程序。 当我按下第一个选项卡片段上的特定按钮时,我试图显示一个进度对话框。问题是“进度”对话框永远不会出现,其他一切都正常工作。 我是android新手,我相信答案很简单,但我花了很多时间试图找出解决方案。 下面是我的代码 public class AFragment extends DialogFragment { static TextView tx; Button bt; OnCli

晚上好,, 我使用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!!!!!!!!!!!!