title: How do I access a microSD card connected to my RFduino, via Bluetooth on my Android App?
body: <p>I am creating a device that will connect to my mobile app via BLE. My device is using a RFduino microcontroller with a microSD shield. My mobile app can connect to the RFduino via BLE. I can get the TX, RSSI, and send some value from the Phone app to the RFduino. Now I am having trouble accessing the microSD card root path through the mobile app. I would like to be able to display a file explorer. I already have the basics for the file explorer, but it is just displaying a dot on the screen. </p>
  
  <p>This is what I have so far. I know I need to point the path, but I'm not exactly sure how. </p>
  
  <pre><code>import android.app.AlertDialog;
  import android.app.ListActivity;
  import android.content.DialogInterface;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.ArrayAdapter;
  import android.widget.ListView;
  import android.widget.TextView;
  
  import java.io.File;
  import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.List;
  
  
  
  public class AndroidExplorer extends ListActivity {
  
      private List&lt;String&gt; item = null;
      private List&lt;String&gt; path = null;
      private String root="/";
      private TextView myPath;
  
      /** Called when the activity is first created. */
  
      @Override
  
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_view_files);
          myPath = (TextView)findViewById(R.id.path);
          getDir(root);
      }
  
      private void getDir(String dirPath)    {
          myPath.setText("Location: " + dirPath);
          item = new ArrayList&lt;String&gt;();
          path = new ArrayList&lt;String&gt;();
          File f = new File(dirPath);
          File[] files = f.listFiles();
          Arrays.sort(files);
  
          if(!dirPath.equals(root))  {
              item.add(root);
              path.add(root);
              item.add("../");
              path.add(f.getParent());
          }
  
          for(int i=0; i &lt; files.length; i++)  {
              File file = files[i];
              path.add(file.getPath());
              if(file.isDirectory())
                  item.add(file.getName() + "/");
              else
                  item.add(file.getName());
          }
  
          ArrayAdapter&lt;String&gt; fileList =
                  new ArrayAdapter&lt;String&gt;(this, R.layout.row, item);
          setListAdapter(fileList);
      }
  
      @Override
  
      protected void onListItemClick(ListView l, View v, int position, long id) {
          File file = new File(path.get(position));
  
          if (file.isDirectory())    {
              if(file.canRead())
                  getDir(path.get(position));
              else  {
                  new AlertDialog.Builder(this)
                          .setIcon(R.mipmap.ic_launcher)
                          .setTitle("[" + file.getName() + "] folder can't be read!")
                          .setPositiveButton("OK",
                                  new DialogInterface.OnClickListener() {
  
                                      @Override
  
                                      public void onClick(DialogInterface dialog, int which) {
                                          // TODO Auto-generated method stub
                                      }
                                  }).show();
              }
  
          } else {
              new AlertDialog.Builder(this)
                      .setIcon(R.mipmap.ic_launcher)
                      .setTitle("[" + file.getName() + "]")
                      .setPositiveButton("OK",
                              new DialogInterface.OnClickListener() {
  
                                  @Override
                                  public void onClick(DialogInterface dialog, int which) {
                                      // TODO Auto-generated method stub
                                  }
                              }).show();
          }
      }
  }
  </code></pre>