title: Fragments - Tabs - Progress Dialog
body: <p>Good evening,
  I have implemented an application which has 3 tabs (fragments) using TabsListener.
  I am trying to display a progress dialog while I press a specific button on the first Tab-fragment. The problem is that the progress dialog never shows up and everything else works fine.
  I am quite new to android and I am sure that the answer is quite easy but I have spent many hours on this trying to figure out the solution.
  Below is my code</p>
  
  <p><pre></p>
  
  <code>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!!!!!!!!!!!!
  </code></pre>