Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - open file in byte array representation with Intents

open file in byte array representation with Intents

All your problems with Audio, Video and Images.

open file in byte array representation with Intents

Postby bloddY » Fri Aug 06, 2010 11:45 am

Hi guys,

I'm a litte bit desperate to open a file with intent so that android can decide which application should handle this file. My Problem is that i have only the file as an Base64 representation which i decode to an byte Array

Now i want to send an intent and open that file. I try to do save it in the internal storage and open the file with the uri given by getFilesDir(). Here is my Code
Code: Select all
    FileOutputStream fos = openFileOutput(filename, Context.MODE_WORLD_READABLE );
    fos.write((byte[])result);
    fos.close();

    uri = Uri.fromFile(new File(getFilesDir(), filename));

    Intent myIntent = new Intent(Intent.ACTION_VIEW);
    myIntent.setData(uri);
    startActivity(myIntent);



Unfortunatly this doesn't work. All i got is an ActivityNotFoundException (even if i try to open a *.jpg)

Thanks for any input!
bloddY
Once Poster
Once Poster
 
Posts: 1
Joined: Fri Aug 06, 2010 10:59 am

Top

Re: open file in byte array representation with Intents

Postby blundell » Fri Aug 06, 2010 3:47 pm

Hi hi hiii

Try this
Intent setDataAndType

setDataAndType (Uri data, String type)

You can then set the explicit type of your file. Pick one:
http://www.iana.org/assignments/media-types/

i.e.
Code: Select all
Intent myIntent = new Intent(Intent.ACTION_VIEW);
    myIntent.setDataAndType(uri , "text/plain");
    startActivity(myIntent);
User avatar
blundell
Master Developer
Master Developer
 
Posts: 1610
Joined: Tue Nov 18, 2008 12:58 pm
Location: UK

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: Google [Bot] and 6 guests