[android-developers] Re: cant read file from data/data/pkg/files/...

2009-04-13 Thread xiao dao

Hi,
   Please change this line code .

FileOutputStream fos = mcontx.openFileOutput(imageName,
Context.MODE_WORLD_READABLE)

On Mar 30, 10:29 am, Komal komal...@gmail.com wrote:
 Hi,
 I am saving an image using openFileOutput and now i want to use this
 image in my java script file.
 I am saving image using this code :

 Bitmap b=DownloadImage(imageUrl);
 FileOutputStream fos = mcontx.openFileOutput(imageName,
 Context.MODE_WORLD_WRITEABLE)                  

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: cant read file from data/data/pkg/files/...

2009-03-30 Thread Komal

Hello
please help me!!!
Thank you

On Mar 30, 1:29 pm, Komal komal...@gmail.com wrote:
 Hi,
 I am saving an image using openFileOutput and now i want to use this
 image in my java script file.
 I am saving image using this code :

 Bitmap b=DownloadImage(imageUrl);
 FileOutputStream fos = mcontx.openFileOutput(imageName,
 Context.MODE_WORLD_WRITEABLE)                    
 b.compress(CompressFormat.JPEG,
 75, fos);
 fos.flush();
 fos.close();

 It successfully write the image , i can see it in the file explorer of
 emulator.
 and   i can display that image using openFileInput in image view.
 But,,
 There is another activity where i am using webview to call javascript.
 i want to read that image in my javascript.my javascript code is ::

 *
 html xmlns=http://www.w3.org/1999/xhtml;
 head
 meta http-equiv=Content-Type content=text/html; charset=utf-8 /
 titletitle/title
 /head
 script language=javascript
             /* This function is invoked by the activity */
                function display() {

                     var path=data/data/com.android.mypkg/
 files/+window.mypage.getImageName();
                     document.getElementById(img).src=path;

                 }

 /script

 body onLoad=window.mypage.callAndroid()
 !-- Calls into the javascript interface for the activity --
         img id=img src= /

         p
                 b script type=text/javascript
                         var hl=window.mypage.getHeadline();
                         document.write(hl);
                         /script
                 /b
         /p
 /body
 /html

 **
 it is not displaying an image.
 can i read file from data/data/pkg/files/... directly like this?
 Please help me
 Thanx
 komal
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: cant read file from data/data/pkg/files/...

2009-03-30 Thread Mike Collins


If my understanding is correct, in general you can't because of
security.
Stuff under /data/data/package/... is protected from any code except
the
package itself.

  mike


On Mar 30, 4:16 pm, Komal komal...@gmail.com wrote:
 Hello
 please help me!!!
 Thank you

 On Mar 30, 1:29 pm, Komal komal...@gmail.com wrote:



  Hi,
  I am saving an image using openFileOutput and now i want to use this
  image in my java script file.
  I am saving image using this code :

  Bitmap b=DownloadImage(imageUrl);
  FileOutputStream fos = mcontx.openFileOutput(imageName,
  Context.MODE_WORLD_WRITEABLE)                    
  b.compress(CompressFormat.JPEG,
  75, fos);
  fos.flush();
  fos.close();

  It successfully write the image , i can see it in the file explorer of
  emulator.
  and   i can display that image using openFileInput in image view.
  But,,
  There is another activity where i am using webview to call javascript.
  i want to read that image in my javascript.my javascript code is ::

  ***­**
  html xmlns=http://www.w3.org/1999/xhtml;
  head
  meta http-equiv=Content-Type content=text/html; charset=utf-8 /
  titletitle/title
  /head
  script language=javascript
              /* This function is invoked by the activity */
                 function display() {

                      var path=data/data/com.android.mypkg/
  files/+window.mypage.getImageName();
                      document.getElementById(img).src=path;

                  }

  /script

  body onLoad=window.mypage.callAndroid()
  !-- Calls into the javascript interface for the activity --
          img id=img src= /

          p
                  b script type=text/javascript
                          var hl=window.mypage.getHeadline();
                          document.write(hl);
                          /script
                  /b
          /p
  /body
  /html

  ***­***
  it is not displaying an image.
  can i read file from data/data/pkg/files/... directly like this?
  Please help me
  Thanx
  komal- Hide quoted text -

 - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: cant read file from data/data/pkg/files/...

2009-03-30 Thread Komal

Hi Mike,
Thanks for your reply.

My xhtml file is under assets folder,it is in the app, then why cant i
use it?

and i can use all images saved in assets in the xhtml page.
 but i cant save image at runtime in the assets folder using
file:///android_asset/filename.jpg
I manually save .jpg file under assets and use it in the xhtml file,
it displays an image.


On Mar 31, 10:40 am, Mike Collins mike.d.coll...@gmail.com wrote:
 If my understanding is correct, in general you can't because of
 security.
 Stuff under /data/data/package/... is protected from any code except
 the
 package itself.

   mike

 On Mar 30, 4:16 pm, Komal komal...@gmail.com wrote:

  Hello
  please help me!!!
  Thank you

  On Mar 30, 1:29 pm, Komal komal...@gmail.com wrote:

   Hi,
   I am saving an image using openFileOutput and now i want to use this
   image in my java script file.
   I am saving image using this code :

   Bitmap b=DownloadImage(imageUrl);
   FileOutputStream fos = mcontx.openFileOutput(imageName,
   Context.MODE_WORLD_WRITEABLE)                    
   b.compress(CompressFormat.JPEG,
   75, fos);
   fos.flush();
   fos.close();

   It successfully write the image , i can see it in the file explorer of
   emulator.
   and   i can display that image using openFileInput in image view.
   But,,
   There is another activity where i am using webview to call javascript.
   i want to read that image in my javascript.my javascript code is ::

   ***­**
   html xmlns=http://www.w3.org/1999/xhtml;
   head
   meta http-equiv=Content-Type content=text/html; charset=utf-8 /
   titletitle/title
   /head
   script language=javascript
               /* This function is invoked by the activity */
                  function display() {

                       var path=data/data/com.android.mypkg/
   files/+window.mypage.getImageName();
                       document.getElementById(img).src=path;

                   }

   /script

   body onLoad=window.mypage.callAndroid()
   !-- Calls into the javascript interface for the activity --
           img id=img src= /

           p
                   b script type=text/javascript
                           var hl=window.mypage.getHeadline();
                           document.write(hl);
                           /script
                   /b
           /p
   /body
   /html

   ***­***
   it is not displaying an image.
   can i read file from data/data/pkg/files/... directly like this?
   Please help me
   Thanx
   komal- Hide quoted text -

  - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: cant read file from data/data/pkg/files/...

2009-03-30 Thread Mark Murphy

Komal wrote:
  but i cant save image at runtime in the assets folder using
 file:///android_asset/filename.jpg

Assets are packaged inside the APK and are read-only.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android App Developer Training: http://commonsware.com/training.html

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: cant read file from data/data/pkg/files/...

2009-03-30 Thread Komal

Thanx mark,

Can i read from data/data/pkg/files/filenm in java script/html page?

Thanx komal


On Mar 31, 11:34 am, Mark Murphy mmur...@commonsware.com wrote:
 Komal wrote:
   but i cant save image at runtime in the assets folder using
  file:///android_asset/filename.jpg

 Assets are packaged inside the APK and areread-only.

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://twitter.com/commonsguy

 AndroidApp Developer Training:http://commonsware.com/training.html
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: cant read file from data/data/pkg/files/...

2009-03-30 Thread Mark Murphy

Komal wrote:
 Can i read from data/data/pkg/files/filenm in java script/html page?

I don't know. I have never tried it.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android App Developer Training: http://commonsware.com/training.html

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: cant read file from data/data/pkg/files/...

2009-03-30 Thread Komal

Hi,
if somebody can solve my doubt ,please help me!!!

Thanks in advance!!!

On Mar 31, 12:32 pm, Mark Murphy mmur...@commonsware.com wrote:
 Komal wrote:
  Can i read from data/data/pkg/files/filenm in java script/html page?

 I don't know. I have never tried it.

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://twitter.com/commonsguy

 Android App Developer Training:http://commonsware.com/training.html
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---