title: Android java : classify Uri text and image
body: <p>The problem is how to classify when I select text file / image file it show me open text file apps or open image apps. This is actually similar like File Explorer. I don't know to classify it so I put two together. Unfortunately, the result is not I want. So I asking here for help =) </p>
  
  <p>The following is the coding:</p>
  
  <pre><code>@Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
  
      super.onListItemClick(l, v, position, id);
      FileInfo fileDescriptor = fileArrayListAdapter.getItem(position);
      if (fileDescriptor.isFolder() || fileDescriptor.isParent()) {
          currentFolder = new File(fileDescriptor.getPath());
          fill(currentFolder);
      } else {
  
          fileSelected = new File(fileDescriptor.getPath());
          Intent intent = new Intent();
          intent.putExtra(Constants.KEY_FILE_SELECTED,
                  fileSelected.getAbsolutePath());
          setResult(Activity.RESULT_OK, intent);
          Log.i("FILE CHOOSER", "result ok");
          //finish();
          intent.setAction(android.content.Intent.ACTION_VIEW);
          intent.setDataAndType(Uri.fromFile(fileSelected), "text/*");
          intent.setAction(android.content.Intent.ACTION_VIEW);
          intent.setDataAndType(Uri.fromFile(fileSelected), "image/*");
          startActivity(intent); 
      //  Intent intent = new Intent();
  
  
  
      }
  </code></pre>