"If you mean 'android.os.Handler' there is no such method 'Post()'. Did you
mean 'post()' or a different type?"
-I mean post().

I did not copy the code, I typed it to try to explain my problem, sory for
any errors on that.

I will try to ask the question in a different way:

I have a worker thread that needs to post several peaces of code to the UI
thread.
So I am using android.os.Handler post() method.

*How can I ensure that code I "post" to the UI is executed in the same
sequence I "post" it*?

Notes:
-That code needs to run in the UI thread.
-Can't use postAtFrontOfQueue() because the worker thread is posting some
code has work is getting done, so I can't reverse the call sequence to use
this function. Ideal would be something like "postAtEndOfQueue".

Thanks





On Thu, Apr 18, 2013 at 12:00 AM, Lew <lewbl...@gmail.com> wrote:

>
>
> On Wednesday, April 17, 2013 11:33:21 AM UTC-7, Filipe wrote:
>>
>> Hi,
>>
>> Does Handler.Post() respects the "Post" sequence?
>>
>
> If you mean 'android.os.Handler' there is no such method 'Post()'. Did you
> mean 'post()' or a different type?
>
> A simplifyed version of what I am doing in my Activity is:
>>
>> public void onCreate(Bundle savedInstanceState)
>> {
>>  super.onCreate(**savedInstanceState);
>>  setContentView(new AbsoluteLayout());
>>  new Handler().Post(new Runnable() {
>>
>
> This should fail to compile if you are using 'android.os.Handler'.
>
>
>>                 public void run() {
>>                  CheckView();
>>                 }
>>             });
>> }
>> private void CheckView()
>>
>
> You should follow the Java naming conventions, by which this method will
> be called 'checkView()'.
>
>
>> {
>>  int myHeight=getWindow().**findViewById(Window.ID_**
>> ANDROID_CONTENT).getHeight() ;
>> }
>>
>> Sometimes in myHeight I get the correct values, and sometimes I don't?
>>
>> If I change the Handler.Post to Handler.PostDelayed(...,1000) it allways
>> works, so the problem seems to be that when I use Post() the CheckView()
>> code is executed before the setContentView.
>>
>> So how can I guarantee to Post code to be executed at the end of all
>> graphic processing has been done, without PostDelayed() ?
>>
>>
>
> Start by using the correct method name.
>
> --
> Lew
>
>
> --
> --
> 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
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "Android Developers" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/android-developers/BepSPNyU2Us/unsubscribe?hl=en
> .
> To unsubscribe from this group and all its topics, send an email to
> android-developers+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to