[android-developers] Re: AsyncTask vs Thread?

2012-03-26 Thread scame
I had a same bug in the AsyncTask. So i prefer a Thread.

вторник, 27 марта 2012 г. 5:18:01 UTC+4 пользователь martypantsROK написал:

 I have an operation that consumes too much time for the UI thread and 
 need to do it in another thread. I created a thread using AsyncTask 
 and the thread loops until it finds and answer. When its done, I use 
 postExecute to deal with the data and update views. The problem is 
 that the thread intermittently stops in the middle of a long loop with 
 no errors. Sometimes it goes through all data looking, sometimes, the 
 thread returns having only looped through a portion. 

 I posted a question on Stackoverflow, but the only answer I got was 
 not to use AsyncTask but just use threads without providing any 
 reasoning or details why one is better than another. 

 What do folks here think?  Is there something wrong with the way I've 
 implemented my AsyncTask? Or is the stackoverflow poster correct in 
 that I should just blindly use Thread without understanding why this 
 is incorrect, good, bad, ugly or whatever. 

 private void playDeviceTile() { 

 if (mDbHelper.isPlayingDevice(game_id)) { 

 // make sure I'm seeing all played tiles 
 refreshPlayedTiles(); 

 final Boolean found; 



 final ProgressDialog dialog = new ProgressDialog(mcontext); 
 dialog.setMessage(Android is thinking...); 
 dialog.show(); 

 new AsyncTaskVoid,Void, Boolean(){ 
 @Override 
 protected void onPostExecute(Boolean isFound) { 
 if (!isFound) { 

 passPlay(1);  // never found a tile to 
 play. We have to pass 
 } 
 else { 
playTile(currentTile,1); 

} 
 dialog.dismiss(); 
 postInvalidate(); 
 invalidate(); 
 } 

 @Override 
 protected Boolean doInBackground(Void... params) { 
 try { 
 return doSearchforSpot(); 
 } catch (Exception e) { 
 Log.e(DRAW, Exception find spot for device 
 tile, e); 
 } 
 return null; 
 } 

 }.execute(); 

 } 
 }

-- 
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] Path to screenshot

2012-03-12 Thread scame
Hello.

Is there a way to find out the path used by android to save
screenshots? Can i get the path from a code?

-- 
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: sending email automatically

2011-10-09 Thread scame
Не совсем понял, что ты именно хочешь. Чтобы тебе автоматически письмо 
отсылалось по какому-то интервалу? Создай сервис, запусти в нём поток и по 
таймеру хреначь. Или я не понял.

-- 
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: Compilation error on my if else statement

2011-10-09 Thread scame
Wow. http://download.oracle.com/javase/tutorial/java/nutsandbolts/if.html

-- 
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