title: How to record audio and upload to server in android?How to restrict the particular file extensions using documents attachments?
body: <p>Am working with android attachments same like whatsapp.I can able to take picture through camera,gallery options,location,record video.I have stucked with two options,</p>
  
  <ol>
  <li>How to record audio?</li>
  </ol>
  
  <p>while clicking on audio button,the following code i have been used,</p>
  
  <pre><code>        audioIB.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              Intent intent = new Intent(MediaStore.Audio.Media.RECORD_SOUND_ACTION);
              startActivityForResult(intent, 6);
  
          }
      });
  </code></pre>
  
  <p>and which is redirecting to recording audio but after file save it is not redirecting to the activity.what is the code in onActivityResult .</p>
  
  <ol start="2">
  <li><p>How can i restrict the particular file extensions while attaching files,I need to select doc,txt,pdf,audio files.Rest i don't want to attach.I tried so many but i cant able to do.Please help me asp.This is my code after you mentioned link using,
  The following code i have been used,</p>
  
  <pre><code>private void showFileChooser() 
  {
  
   Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
   //        intent.setType("application/*");
  
    intent.setType("application/pdf|application/doc|appl‌​ication/docm|applica‌​tion/docx|applicatio‌​n/dot|application/mc‌​w|application/rtf" + "|application/pages|application/odt|application/ott");
    intent.addCategory(Intent.CATEGORY_OPENABLE);
  
      try 
      {
       startActivityForResult(
               Intent.createChooser(intent, "Select a File to Upload"),
               4);
       } 
       catch (android.content.ActivityNotFoundException ex) {
        Toast.makeText(getActivity(), "Please install a File Manager.",
              Toast.LENGTH_SHORT).show();
      }
  }
  </code></pre></li>
  </ol>