开发者

How to save image files in android mobile gallery in Flex 4.5

开发者 https://www.devze.com 2023-03-09 03:34 出处:网络
I am developing a mobile application in Adobe Flash builder 4.5. I want to save an image in mobile memory at run time.

I am developing a mobile application in Adobe Flash builder 4.5.

I want to save an image in mobile memory at run time.

Please help me, how can i save image in mobile's sdcard or in mobile memory? and after that i also have to show all images in this directory.

Please help me i dont know how can i access mobile directori开发者_StackOverflow社区es or interact with mobile directories in Flex 4.5.


I have solved this problem.

  1. Get Image bitmap data through ImageSnapshhot class. 2.Encode this bitmap data into byte Array using png encoder. 3.Then use File Class to save this byte Array.

here is the code of saving image byte array into sd card

var fl:File = File.documentsDirectory.resolvePath('savedLogos/'+getNowTimestamp()); trace(fl.nativePath)

          try
          {
              var fs:FileStream=new FileStream;
              fs.open(fl,FileMode.WRITE);
              fs.writeBytes(bytArray,0,bytArray.length);
              fs.close();
          }

trace command will show this path

/mnt/sdcard/savedLogos/Logo_2011430225732663.png

Image is saved in mobile sdcard and you can see this.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号