title: Getting error: Cannot resolve method 'makeText' in Android
body: <p>I am a newbie.
  Getting error:</p>
  
  <blockquote>
    <p>Cannot resolve method 'makeText'</p>
  </blockquote>
  
  <p>I am using navigation drawer and My class name is <code>MainFragment.java</code>.
  Actually I was to trying to use File and Folder Explorer, only this error.</p>
  
  <p>What I have tried: Tried using <code>MainFragment.getContext()</code> and <code>getActivity()</code> and <code>context</code> and <code>this</code>, in-place of <code>MainFragment.this</code> but none is working.</p>
  
  <p>MainFragment.java</p>
  
  <pre><code>public class MainFragment extends Fragment
  {
      //Defined for file edittext.
      EditText editText2;
  
      public MainFragment() {
          // Required empty public constructor
      }
  
      /*  @Override
          public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                   Bundle savedInstanceState) {
  
              // Inflate the layout for this fragment
              return inflater.inflate(R.layout.fragment_main, container, false);
          }
      */
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
      {
          View view = inflater.inflate(R.layout.fragment_main, container, false);
  
          Button dirChooserButton = (Button) view.findViewById(R.id.skipButton);       //Browse Button
          dirChooserButton.setOnClickListener(new OnClickListener()
          {
              private String m_chosenDir = "";
              private boolean m_newFolderEnabled = true;
  
              @Override
              public void onClick(View v)
              {
                  // Create DirectoryChooserDialog and register a callback
                  DirectoryChooserDialog directoryChooserDialog =
                          new DirectoryChooserDialog(MainFragment.this,
                                  new DirectoryChooserDialog.ChosenDirectoryListener()
                                  {
                                      @Override
                                     public void onChosenDir(String chosenDir)
                                      {
                                          m_chosenDir = chosenDir;
                                          Toast.makeText(
                                                  getActivity(), "Chosen directory: " +
                                                          chosenDir, Toast.LENGTH_LONG).show();
                                      }
                                  });
                  // Toggle new folder button enabling
                  directoryChooserDialog.setNewFolderEnabled(m_newFolderEnabled);
                  // Load directory chooser dialog for initial 'm_chosenDir' directory.
                  // The registered callback will be called upon final directory selection.
                  directoryChooserDialog.chooseDirectory(m_chosenDir);
                  m_newFolderEnabled = ! m_newFolderEnabled;
              }
          });
  
          @Override
          public void onChosenDir(String chosenDir)
          {
              m_chosenDir = chosenDir;
              Toast.makeText(MainFragment.this, "Chosen  directory: " +chosenDir,Toast.LENGTH_LONG).show();
          }
      }   
  }                                                
  </code></pre>
  
  <p><a href="https://drive.google.com/open?id=0B2x72D21rB9dUGpSRUlfZFBoV2c" rel="nofollow noreferrer">DirectoryChooserDialog.java</a></p>
  
  <p>Actually I tried this link for making File and Folder Chooser: <a href="http://www.codeproject.com/Articles/547636/Android-Ready-to-use-simple-directory-chooser-dial" rel="nofollow noreferrer">link to the webpage</a></p>