开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜