| Author |
Message |
plusminus Site Admin


Joined: 14 Nov 2007 Posts: 2624 Location: College Park, MD
|
Posted: Thu Jan 03, 2008 11:48 am Post subject: |
|
|
Hello Katharnavas,
saving takes place here:
| Java: | FileOutputStream stream = super.openFileOutput("picture" + i++ + ".png", MODE_PRIVATE);
camera.capture(canvas);
myPic.compress(CompressFormat.PNG, 100, stream);
stream.flush();
stream.close(); |
Simply alter the Parameter of super.openFileOutput(...);. If you want to write to the SD-Card, there is no need for using "openFileOutput", because you can use standard java methods, like new FileOutputStream(...)...
Regards,
plusminus
_________________
Download my apps  Please remember, that this board is give & take 
| Android Development Community / Tutorials
Last edited by plusminus on Thu Jan 03, 2008 2:02 pm; edited 1 time in total |
|
| Back to top |
|
 |
Katharnavas Senior Developer

Joined: 04 Dec 2007 Posts: 100 Location: India
|
Posted: Thu Jan 03, 2008 1:11 pm Post subject: |
|
|
Hi,
Its nice to have you after a pleasant new year ...
|
|
| Back to top |
|
 |
Lex Developer

Joined: 16 Nov 2007 Posts: 30
|
Posted: Thu Jan 03, 2008 1:29 pm Post subject: |
|
|
| Thank you for this tutorial. Very helpful !
|
|
| Back to top |
|
 |
bavarol Experienced Developer

Joined: 10 Dec 2007 Posts: 52
|
Posted: Thu Mar 06, 2008 12:10 pm Post subject: |
|
|
| plusminus wrote: | Hello Katharnavas,
saving takes place here:
| Java: | FileOutputStream stream = super.openFileOutput("picture" + i++ + ".png", MODE_PRIVATE);
camera.capture(canvas);
myPic.compress(CompressFormat.PNG, 100, stream);
stream.flush();
stream.close(); |
Simply alter the Parameter of super.openFileOutput(...);. If you want to write to the SD-Card, there is no need for using "openFileOutput", because you can use standard java methods, like new FileOutputStream(...)...
Regards,
plusminus |
Hi, I have written "-sdcard <path of sdcard.img>" on command line as ever, then I altered super.OpenFileOutput by new FileOutputStream(...) in all possible variants (new FileOutputStream(String), new FileOputputStream(File), etc) but I still get FileNotFoundException, why?
Regards
|
|
| Back to top |
|
 |
bavarol Experienced Developer

Joined: 10 Dec 2007 Posts: 52
|
|
| Back to top |
|
 |
drhu00 Junior Developer

Joined: 12 Feb 2008 Posts: 11
|
Posted: Sat Mar 08, 2008 5:31 pm Post subject: How to retrieve the png file that I saved? |
|
|
I can save these png files as said in this post
picture0.png
picture1.png
etc.
but how can I get back these pictures?
|
|
| Back to top |
|
 |
plusminus Site Admin


Joined: 14 Nov 2007 Posts: 2624 Location: College Park, MD
|
|
| Back to top |
|
 |
drhu00 Junior Developer

Joined: 12 Feb 2008 Posts: 11
|
Posted: Sat Mar 08, 2008 6:11 pm Post subject: |
|
|
Thank you plusminus. The question is that when I use your filebrowser
http://www.anddev.org/android_filebrowser__v20-t101.html
under the data, I find it is empty so I can't find the
/data/data/org.picture/files/picture0.png
That's why I am wounder where is the file stored.
Does your filebrowser can retrive all the directory and files under data? Why it is empty? When I use the eclipse DDMS shows all the files and directory.
|
|
| Back to top |
|
 |
plusminus Site Admin


Joined: 14 Nov 2007 Posts: 2624 Location: College Park, MD
|
Posted: Sun Mar 09, 2008 1:35 pm Post subject: |
|
|
Hello drhu00,
the reason for that is the rights, the application is running with.
You need administrator-priviledges to browse that folder, which a normal application has not.
Regards,
plusminus
_________________
Download my apps  Please remember, that this board is give & take 
| Android Development Community / Tutorials |
|
| Back to top |
|
 |
Steel Developer

Joined: 28 Dec 2007 Posts: 43 Location: Copenhagen, Denmark
|
Posted: Tue Mar 11, 2008 4:24 pm Post subject: |
|
|
A fine tutorial indeed.
I wonder about the quality hint in the Bitmap.compress(...)-function though. The javadoc says:
quality Hint to the compressor, 0-100. 0 meaning compress for small size, 100 meaning compress for max quality.
Now thats fine and logical for the JPEG-compressor, but for the PNG-compressor shouldn't it be 1-8 (BitsPerPixel for PNG-8) or 24 (for PNG-24)?
Issue 443 filed.
_________________ Eclipse is a fork, IntelliJ is the ninja sword. Which weapon are you going into battle with? |
|
| Back to top |
|
 |
plusminus Site Admin


Joined: 14 Nov 2007 Posts: 2624 Location: College Park, MD
|
Posted: Tue Mar 11, 2008 5:21 pm Post subject: |
|
|
Hello Steel,
I don't know. Maybe they are wrapping the values internally , depending on what file-type was selected.
Regards,
plusminus
_________________
Download my apps  Please remember, that this board is give & take 
| Android Development Community / Tutorials |
|
| Back to top |
|
 |
Pere Freshman

Joined: 11 Apr 2008 Posts: 2
|
Posted: Fri Apr 11, 2008 6:11 pm Post subject: |
|
|
Hi,
I'm an absolute beginner with Android. I found this site and started practicing with the nice tutorials it provides. Then I found this one which has something to do with what I wanted to do with Android, so I think it would be a good start point to base my project on.
But I'm having problems getting it to work right from the beginning. I downloaded camera.zip, put into my Eclipse project folder and tried to run it. First of all I got a problem because the android.jar folder was configured in another path (probably for a Unix system). After fixing that, I get the following errors:
"the method setCallback(Preview) is undefined for the type SurfaceHolder" (file CameraPreview.java, line 136).
"the return type is incompatible with SurfaceHolder.Callback.surfaceCreated(SurfaceHolder)" (file CameraPreview.java, line 164).
About the 1st error, as Eclipse gives me the option to change the method to "addCallback", I supposed the method just could had changed its name in a newer version of the API or whatsoever; I am using last version of the API and maybe this tutorial could have been done using an older version.
For the 2nd one, I have no clue. I simply tried changing the return type to "void" to try to run it... and then, after I try to run the project from the "Run" dialog, I get a "Project is not an Android Project. Aborting!" error in Eclipse.
I would be very happy if someone could enlight me with some help to get this running...
Thanks a lot!
|
|
| Back to top |
|
 |
Stephen.Ada Junior Developer

Joined: 10 Mar 2008 Posts: 10
|
Posted: Sun Apr 20, 2008 5:55 am Post subject: |
|
|
a nice tut.
I did save some pictures in the dir . but the picutre did't display what it is as i capture in android.
the first picture display like this:
but the successive captured picture can't display ,however....
have u guys ever encourtered this problem?
any help appreciate!
| Description: |
|
| Filesize: |
1.31 KB |
| Viewed: |
1968 Time(s) |

|
|
|
| Back to top |
|
 |
Pere Freshman

Joined: 11 Apr 2008 Posts: 2
|
Posted: Fri Apr 25, 2008 4:56 pm Post subject: |
|
|
Hi again,
Please, can anyone give me some hint in getting my problem solved? I haven't touched a line of the source code provided, but still I am not able to run it.
|
|
| Back to top |
|
 |
bavarol Experienced Developer

Joined: 10 Dec 2007 Posts: 52
|
Posted: Wed Jun 04, 2008 7:30 pm Post subject: |
|
|
| Pere wrote: | Hi again,
Please, can anyone give me some hint in getting my problem solved? I haven't touched a line of the source code provided, but still I am not able to run it. |
| Pere wrote: | Hi,
I'm an absolute beginner with Android. I found this site and started practicing with the nice tutorials it provides. Then I found this one which has something to do with what I wanted to do with Android, so I think it would be a good start point to base my project on.
But I'm having problems getting it to work right from the beginning. I downloaded camera.zip, put into my Eclipse project folder and tried to run it. First of all I got a problem because the android.jar folder was configured in another path (probably for a Unix system). After fixing that, I get the following errors:
"the method setCallback(Preview) is undefined for the type SurfaceHolder" (file CameraPreview.java, line 136).
"the return type is incompatible with SurfaceHolder.Callback.surfaceCreated(SurfaceHolder)" (file CameraPreview.java, line 164).
About the 1st error, as Eclipse gives me the option to change the method to "addCallback", I supposed the method just could had changed its name in a newer version of the API or whatsoever; I am using last version of the API and maybe this tutorial could have been done using an older version.
For the 2nd one, I have no clue. I simply tried changing the return type to "void" to try to run it... and then, after I try to run the project from the "Run" dialog, I get a "Project is not an Android Project. Aborting!" error in Eclipse.
I would be very happy if someone could enlight me with some help to get this running...
Thanks a lot! |
Hi Pere (are you from Catalonia? ), you should use CameraPreview of APIDemo, start the emulator and then click over ApiDemo and go to "graphic", and you'll find CameraPReview. I think it's still there.
I still work under m3rc22 cause of my Project.
So you have not to download cameraPreview.zip from this post.
Bye
Adios
Adeu
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
© 2007, Android Development Community
All rights reserved.
Powered by phpBB.
|