title: How to open file with any exetension in Android?
body: <p>I have an app in which user can upload file with any exetention(<strong><em>.png</em></strong>,<strong><em>.mp3</em></strong>,<strong><em>.txt</em></strong>,<strong><em>.pdf</em></strong>,<strong><em>.bmp</em></strong>,<strong><em>.apk</em></strong>,...etc)</p>
  
  <p>In a nutshell-->** the file with any exe..!** </p>
  
  <p>These files r displayed in list-view.</p>
  
  <p>When user 'Tap' or 'click' on item from list-view intent will be called (<code>android.content.Intent.ACTION_VIEW</code>) and it should be open the respective application which installed in device.</p>
  
  <p><strong>For Example</strong></p>
  
  <p>If User Click on nature.png then intent will be called and suggest the applications like Gallery,PS Touch..etc(<strong>As shown in screen shot1</strong>)</p>
  
  <p>If User Click on book.pdf then intent will be called and suggest the applications like MuPdf,Polaris Office,apv..etc(<strong>As shown in screen shot2</strong>)</p>
  
  <p><strong>For .txt,.pdf,.png,.jpg</strong>-- I have solved the problem by set mime type <code>intent.setDataAndType(Uri.fromFile(file), mime);</code></p>
  
  <p><strong>and</strong> also <strong>for URL</strong></p>
  
  <pre><code>Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse(https://www.google.co.in/));
  </code></pre>
  
  <p>It is working perfectly but for rest of the file extension i m still confused-
  What to do? and how to do? </p>
  
  <p>I have already dig around,but couldn't get satisfactorily answer..!</p>
  
  <p><strong>My Questions:</strong></p>
  
  <ol>
  <li><strong>How can i write code for any file extensions so that it will call respective applications that installed in device??</strong></li>
  <li><strong>How to define custom file extensions in XML?</strong></li>
  </ol>