1

I found the link to the source code of OI File manager. I want to integrate this with my app that I'm creating so that when the intent

org.openintents.action.PICK_DIRECTORY

is called, it should result in showing the OI file manager and ask the user to pick a folder. Right now I'm able to do this by installing OI file manager as a separate app on my phone. But I don't want this two-app installing process before my app could be used. Hence tell me how do I link OI file manager code with my app?

so that both the OI file manager and my new app can be combined into one .apk file.

user838522
  • 3,821
  • 3
  • 23
  • 24
  • Maybe it's a rough solution...But I've just included it in my project as a [library](http://developer.android.com/tools/projects/projects-eclipse.html#SettingUpLibraryProject ). – janot Dec 05 '12 at 18:53

2 Answers2

0
This is my own Filemanager so will have problems ., try this its very simple
keeping a listview for files 

public class Bview extends Activity{
    private ListView l;
    private int i;
    private static int stringcounter=0;
    public  static File path;
    public  static String current;
    private static File f;
    private static String  str;
    private static String string=Environment.getExternalStorageDirectory()+"";;
    private static String[] stringpart;
    ArrayList<String> appointment;
    ArrayAdapter<String> aa;
    protected void onCreate(Bundle savedInstanceState) {

        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_view);
        l=(ListView)findViewById(R.id.listView1);
        appointment = new ArrayList<String>();
        stringpart=new String[10];
        aa = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,appointment);
        l.setAdapter(aa);
        List<File> files = getListFiles(new File(string)); 

        l.setOnItemClickListener(new OnItemClickListener() {
                public void onItemClick(AdapterView<?> parent, View view,
                      int position, long id) {
                    if(position==0)
                    {
                        stringcounter--;
                        string=string.replaceAll(stringpart[stringcounter],"");
                        aa.clear();
                        List<File> files = getListFiles(new File(string));
                    }
                    else
                        {
                      Object o = l.getItemAtPosition(position);                         
                      str=(String)o;
                      string=string+"/"+str;
                      System.out.println("str"+str);
                      System.out.println(".value.."+string);
                      f=new File(string);
                      if(f.isDirectory())
                      {  
                          stringpart[stringcounter]="/"+str;
                          stringcounter++;
                          aa.clear();
                          List<File> files = getListFiles(new File(string));  
                      }
                      else
                      {

                      Toast.makeText(getBaseContext(),str,Toast.LENGTH_SHORT).show();
                      }
                        }                 
                }
            });

    }
     @Override
    public void onBackPressed() {
        // TODO Auto-generated method stub
        super.onBackPressed();
        System.exit(0);
    }
    private List<File> getListFiles(File parentDir) {
            ArrayList<File> inFiles = new ArrayList<File>();
            File[] files = parentDir.listFiles();
            this.aa.add("Go Back");
            for(i=0;i<files.length;i++)
            {

            String filename=files[i].getName();
            this.aa.add(filename);        
            }

            return inFiles;
        }
    }
Viswanath Lekshmanan
  • 9,945
  • 1
  • 40
  • 64
0

Initially I said you cant do it which was based on my inability to do the same thing last year. Now that I see there is the source code, I assume you should simply include it in your project and build the project with the OI Manager source code inside it. Then you could use the intents provided in the same way.

Petar
  • 2,241
  • 1
  • 24
  • 38
  • http://code.google.com/p/openintents/downloads/detail?name=FileManager-source-1.1.6.zip&can=2&q= but the OIfile manager source code is available. I don't understand why it cant be done. – user838522 Dec 01 '11 at 11:59
  • Good point :) I was looking for the same thing last year when I was building an android application that had to open files from the SDcard, I could not find how to integrate it and the only way was to use the intents. Having the code, why dont you simply copy it in your project ? You should be able to use the intents anyway. – Petar Dec 01 '11 at 12:04