Open native Camera app within another app?

Basic Tutorials concerning: GUI, Views, Activites, XML, Layouts, Intents, ...

Open native Camera app within another app?

Postby sm12 » Fri Jan 16, 2009 9:42 pm

Hello,

Is it possible to call "Camera" app from another application and retrieve a picture?

What I want to do is open android's native camera app within my app and retrieve a picture to further usage in my application, instead of creating my own camera application.

Any ways to do that?

Thanks.
sm12
Freshman
Freshman
 
Posts: 7
Joined: Thu Nov 13, 2008 4:36 am

Top

Postby sm12 » Sat Jan 17, 2009 4:28 pm

There is a way actually to do it with intent and startActivityForResult:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  2.   if(requestCode == CAPTURE_IMAGE) {
  3.      if(resultCode == RESULT_CANCELLED)
  4.           // do smth
  5.      if(resultCode == RESULT_OK)
  6.           // do smth
  7.   }
  8. }
  9.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


Is "resultCode == RESULT_OK" contains my captured image?
Can I directly save it?

And what is the intent to call the camera app to retrieve an image?

Thanks
sm12
Freshman
Freshman
 
Posts: 7
Joined: Thu Nov 13, 2008 4:36 am

Top

Return to Novice Tutorials

Who is online

Users browsing this forum: No registered users and 5 guests