0

I read almost every answer obout this topi c but i cannot find a working solution for my case or maybe I'm missing somthing. I use eclipse as IDE and I would like to use an external library for example I'm trying to add this Library to my project but I don't understand what i'm doing wrong. I tried download the full project and import it into the workspace, mark it as library and then under my project and add it as reference. If everything is ok how should I call an activity from the linke library? I tried to defind the linked activity into my manifest file but without success.

Could you please point me in the right way?

Thank you

Pecana
  • 363
  • 5
  • 17

1 Answers1

0

You need to write code which will call the library activity inside onCreate() or any other method which you choose like

@Override
    protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
  setContentView(R.layout.activity);
//Here you need to call directory chooser activity.
    final Intent chooserIntent = new Intent(this, DirectoryChooserActivity.class);

    final DirectoryChooserConfig config = DirectoryChooserConfig.builder()
            .newDirectoryName("DirChooserSample")
            .allowReadOnlyDirectory(true)
            .allowNewDirectoryNameModification(true)
            .build();

    chooserIntent.putExtra(DirectoryChooserActivity.EXTRA_CONFIG, config);
    startActivityForResult(chooserIntent, REQUEST_DIRECTORY);
}

Import DirectoryChooserActivity and DirectoryChooserConfig class in your activity; If you are not able to import the mentioned class then you are not added library into the project correctly.

Madhukar Hebbar
  • 3,113
  • 5
  • 41
  • 69
  • Do I need to import the whole project or only the libs from the library? – Pecana Oct 26 '15 at 14:24
  • Try the demo project which is available in https://github.com/passy/Android-DirectoryChooser/tree/master/sample – Madhukar Hebbar Oct 26 '15 at 14:26
  • Library is enough. Follow the step which is described https://github.com/passy/Android-DirectoryChooser/blob/master/README.md – Madhukar Hebbar Oct 26 '15 at 14:27
  • thank you guys, I'm sorry but I guess I'm doing somehting wrong importing the library :-( If I try to import the library from github it cannot be reference as library – Pecana Oct 26 '15 at 14:33
  • Even if the library seems to be linked correctly I cannot import : import net.rdrei.android.dirchooser.DirectoryChooserActivity; import net.rdrei.android.dirchooser.DirectoryChooserConfig; – Pecana Oct 26 '15 at 14:53
  • Please check this : http://stackoverflow.com/questions/3642928/adding-a-library-jar-to-an-eclipse-android-project – Madhukar Hebbar Oct 26 '15 at 14:55
  • Still no luck :-( project inmported and marked as library, but import does not work , what Am I missing? – Pecana Oct 26 '15 at 15:23
  • Could someone just help me to import the library in the correct way? – Pecana Oct 26 '15 at 17:42
  • I guess I should give up after trying for a whole day :-( – Pecana Oct 27 '15 at 13:22