I am working on saving PDF from internet. The class I am using, to download pdf is a normal class “FileChooser.java”, not an activity class. Now, I want to open a Activity to browse through the SDCard and return the selected folder path to the “FileChooser” class
I have planned to use the following code
private void getFolder() {
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("*/*");
intent.addCategory(Intent.CATEGORY_OPENABLE);
try {
startActivityForResult(
Intent.createChooser(intent, "Please select the folder"),0);
} catch (Exception e) {
e.printStackTrace();
}
}
but i want the result to be in “FileChooser” (Normal Java)class
What should i do, to get the result in “FileChooser” class?
Please guide me.
You can pass the data using setresult() and get the result by using onactivity result().
The tutorial here helps you.