fala70 wrote:
> Hi Mark, when your new book on 1.5 sdk ? :-)
All three books will be updated over the next several weeks, with two
being updated within about 10 days. The original Android book will take
longest, mostly because I want to get the other two in print.
> Mainly I need to capture an image from camera.
You can do that yourself, with full control, without having to launch an
external activity, via the Camera object. _The Busy Coder's Guide to
*Advanced* Android Development_ has a chapter on this, and that should
be brought up to Android 1.5 in ~10 days.
It's not that hard, once you have the recipe, and then you have full
control over the user experience.
> Then I found an other solution (the current). I created an activity
> with implemented the
> Runnable interface. Run func. check if new images are created from
> camera app. I'd like kill the camera activty from my run func. when an
> new image is found. Look below my code.
>
> private void CaptureImage()
> {
> _bEndThread = false;
> _thread = new Thread(this);
> _thread.start();
>
> ComponentName toLaunch;
> toLaunch = new ComponentName
> ("com.android.camera","com.android.camera.Camera");
> Intent intent = new Intent(Intent.ACTION_MAIN);
> intent.addCategory(Intent.CATEGORY_LAUNCHER);
> intent.setComponent(toLaunch);
> intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK|
> Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
> startActivity(intent);
> }
>
>
> public void run() {
> Cursor c = managedQuery
> (android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI,null,null,null,null);
> int iNPics = c.getCount();
> while(!_bEndThread){
> try{
> c = managedQuery
> (android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI,null,null,null,Media.DATE_TAKEN
> + " ASC");
> if( c.getCount()>iNPics ) {
> c.moveToLast();
> iNPics = c.getCount();
>
> Uri ur = Media.EXTERNAL_CONTENT_URI;
> _uri=Uri.withAppendedPath(ur, c.getString
> (c.getColumnIndex(Media._ID)));
>
> /********************************************/
> /* AND NOW ????? I WANT RESUME MY ACTIVITY */
> /********************************************/
>
> _bEndThread=true;
> }
> _thread.sleep(1000);
> }
> catch (Exception ex){
> }
> }
> }
I stand by my recommendation: use the Camera object and take the picture
yourself. If you need MediaStore to know about the picture, I'm sure
there is some way to do that (e.g., call insert()).
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy
_The Busy Coder's Guide to Android Development_ Version 2.0 Available!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---