Display a Warning asynchroneously

Hi there

I cannot find the way to display the Warning in asynch way. My WCF service returns warnings which must be shown as pop-ups. It seems like that secondary client thread, which accepts the WCF result, conflicts with the main UI thread so I cannot see any popups and my app just aborted with no details provided.

WCF tutorial recommends using of RunOnUiThread, but this is for the control. I use the following approach:

Toast.MakeText(this, "Warning!", ToastLength.Short).Show();

and it is not working.

Any clue?

Thanks.

Posts

  • NikolayRenziglovNikolayRenziglov CAMember ✭✭

    Solution found.
    Thank you very much.

  • DaveHuntDaveHunt USMember ✭✭✭✭✭

    @NikolayRenziglov,

    And the solution was?

  • SKallSKall USMember ✭✭✭✭

    If I had to guess, replacing 'this' with 'Application.Context' would probably help if the toast is inside non-context class.

  • NikolayRenziglovNikolayRenziglov CAMember ✭✭

    Oh, the same thing:

    _activity.RunOnUiThread( () => Toast.MakeText(_activity, "Warning", ToastLength.Long).Show() );

    where _activity is just my current activity of type Activity.

    Thanks.

Sign In or Register to comment.