[android-developers] Re: Resume my activity from thread

2009-06-01 Thread hina naz
*visit my site and earn more money**  *

* http://latesttechnologyinfo.com/*

*  http://latesttechnologyinfo.com/*

*  http://latesttechnologyinfo.com/*

*  http://latesttechnologyinfo.com/*

*  http://latesttechnologyinfo.com/*

*  http://latesttechnologyinfo.com/  *

* **http://latesttechnologyinfo.com/*

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Resume my activity from thread

2009-05-30 Thread Saurav Mukherjee
what i have understood from your query is that u have implemented the
Runnable interface.
if u have done so, u have to use an Handler object to get hold of the ui
elements...
if this does not help u, please explain your problem properly.

On Sat, May 30, 2009 at 5:13 PM, fala70 fal...@gmail.com wrote:


 I've an activity with a Runnable thread into. From a button command I
 call the camera external application. Into my thread there is a check
 for news picture file is created.

 Now I need to resume my activity from my run func. I tried to recall
 startActivity of my own but doesn't work. The other solution can be
 kill the current process (camera app).

 somebody has a solution ?

 thanks

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Resume my activity from thread

2009-05-30 Thread Mark Murphy

fala70 wrote:
 I've an activity with a Runnable thread into. From a button command I
 call the camera external application. Into my thread there is a check
 for news picture file is created.
 
 Now I need to resume my activity from my run func. I tried to recall
 startActivity of my own but doesn't work. The other solution can be
 kill the current process (camera app).
 
 somebody has a solution ?

Wait for the user to press the back button.

Remember: while you were the one to launch the camera application, it's
not your phone, so the user is welcome to stay in the camera application
as long as she wants.

Only launch external applications when you are willing to give up control.

In the case of the camera, if you don't want to give up control, use the
Camera object and take the picture yourself.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Need Android talent? Ask on HADO! http://wiki.andmob.org/hado

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Resume my activity from thread

2009-05-30 Thread fala70

Hi Mark, when your new book on 1.5 sdk ? :-)

Mark the problem born around intent ACTION_IMAGE_CAPTURE. Mainly I
need to capture an image from camera.
I tried to use ACTION_IMAGE_CAPTURE with the follow code:

final Intent imageCaptureIntent = new Intent
(MediaStore.ACTION_IMAGE_CAPTURE);
imageCaptureIntent.putExtra(MediaStore.EXTRA_OUTPUT,
Uri.fromFile(new 
File(Environment.getExternalStorageDirectory
(), test.jpg)));
startActivityForResult(imageCaptureIntent, RESULT_CAPTURE_IMAGE);

it work but the image resolution is too low and seem impossible get an
image with full resolution.
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){
}
}
}


On 30 Mag, 13:50, Mark Murphy mmur...@commonsware.com wrote:
 fala70 wrote:
  I've an activity with a Runnable thread into. From a button command I
  call the camera external application. Into my thread there is a check
  for news picture file is created.

  Now I need to resume my activity from my run func. I tried to recall
  startActivity of my own but doesn't work. The other solution can be
  kill the current process (camera app).

  somebody has a solution ?

 Wait for the user to press the back button.

 Remember: while you were the one to launch the camera application, it's
 not your phone, so the user is welcome to stay in the camera application
 as long as she wants.

 Only launch external applications when you are willing to give up control.

 In the case of the camera, if you don't want to give up control, use the
 Camera object and take the picture yourself.

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://twitter.com/commonsguy

 Need Android talent? Ask on HADO!http://wiki.andmob.org/hado
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Resume my activity from thread

2009-05-30 Thread Mark Murphy

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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---