0

I'am doing File upload task in my application. For that I have used FileChooserActivity Library.

From the docs I have written this code.

Intent intent = new Intent(_context, FileChooserActivity.class); Toast.makeText(_context, "inside attachment", Toast.LENGTH_SHORT).show(); ((Activity) _context).startActivityForResult(intent, FILE_CHOOSER); public void onActivityResult(int requestCode, int resultCode, Intent data) { if ((requestCode == FILE_CHOOSER) && (resultCode == RESULT_OK)) { String fileSelected = data.getStringExtra(Constants.KEY_FILE_SELECTED); Toast.makeText(this, "file selected "+fileSelected, Toast.LENGTH_SHORT).show(); } } 

Actually Here I'am getting the file path in fileSelected. But I want to store the selected file in a file object. What I should do for that? Can I convert this path to file? Please help me with some example.

1 Answer 1

2

File file = new File(filePath)

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.