saravanan-vdg / openintents

Automatically exported from code.google.com/p/openintents
0 stars 0 forks source link

File Manager: Call to Intent.ACTION_GET_CONTENT does not return content type in Uri #239

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.
    Intent i = new Intent(Intent.ACTION_GET_CONTENT);
    i.addCategory(Intent.CATEGORY_OPENABLE);
    i.setType("*/*");
    startActivityForResult(Intent.createChooser(i, null), 
ACTIVITY_REQUEST_PICK_ATTACHMENT);

2.
    protected void onActivityResult(int requestCode, int resultCode, 
Intent data) {
        if(resultCode == RESULT_OK) {
            Uri uri = data.getData());
            String contentType = contentResolver.getType(uri);
        }
    }

3. contentType is null

What is the expected output? What do you see instead?
contentType should be populated with using file type. If not possible, 
default to "application/octet-stream"

What version of the product are you using? On what operating system?
1.1.0 Android 1.6

Please provide any additional information below.
This for K-9 Mail to be able to attach any file to emails

Original issue reported on code.google.com by baolongnt@gmail.com on 13 Nov 2009 at 8:23

GoogleCodeExporter commented 9 years ago

Original comment by peli0...@googlemail.com on 23 Dec 2009 at 1:13

GoogleCodeExporter commented 9 years ago
could you please let me know how to test it, which menu will get the functions 
invoked? thanks.

Original comment by jzs...@gmail.com on 28 Dec 2011 at 2:34

GoogleCodeExporter commented 9 years ago
The best is to use or modify FileManagerDemo in order to launch the intent as 
specified.

Original comment by peli0...@googlemail.com on 29 Dec 2011 at 9:22

GoogleCodeExporter commented 9 years ago
I'm not able to reproduce this; the intent seems to be working fine, and i'm 
able to get the content type for the uri without any problems. I'm not entirely 
sure what number they're using for as the request code, but that shouldn't 
affect the result as it's not taken into account in the onActivityResult().

Original comment by philipha...@gmail.com on 2 Jan 2012 at 10:26

GoogleCodeExporter commented 9 years ago
Apparently, this has been fixed in the meantime.

The task remaining is to write a test case in FileManagerTest. Test a few 
common file types by first creating dummy files and then picking them (best is 
to do this in a loop).

(Writing the test case would be considered a "medium" task for Google Code-in).

Original comment by peli0...@googlemail.com on 3 Jan 2012 at 10:03

GoogleCodeExporter commented 9 years ago
http://www.google-melange.com/gci/task/view/google/gci2011/7136282

Original comment by peli0...@googlemail.com on 7 Jan 2012 at 10:05

GoogleCodeExporter commented 9 years ago
Comment by Matěj Konečný:
"I tried lots of different possibilities, but it seems that the activity result 
is really not testable :(."

So let's close this issue for now.

Original comment by peli0...@googlemail.com on 8 Jan 2012 at 11:29