mail-archives/monodroid/2012-November/012972.html

112 строки
4.4 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE> [mono-android] Wait x seconds
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:monodroid%40lists.ximian.com?Subject=Re%3A%20%5Bmono-android%5D%20Wait%20x%20seconds&In-Reply-To=%3CCA%2BC5j5ZEwqZK15YSHQ7v8LeQPgdPOKYdeDi3e2rocb3ffXHACw%40mail.gmail.com%3E">
<META NAME="robots" CONTENT="index,nofollow">
<style type="text/css">
pre {
white-space: pre-wrap; /* css-2.1, curent FF, Opera, Safari */
}
</style>
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="012969.html">
<LINK REL="Next" HREF="012970.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[mono-android] Wait x seconds</H1>
<B>Goncalo Oliveira</B>
<A HREF="mailto:monodroid%40lists.ximian.com?Subject=Re%3A%20%5Bmono-android%5D%20Wait%20x%20seconds&In-Reply-To=%3CCA%2BC5j5ZEwqZK15YSHQ7v8LeQPgdPOKYdeDi3e2rocb3ffXHACw%40mail.gmail.com%3E"
TITLE="[mono-android] Wait x seconds">goncalo at minkan.net
</A><BR>
<I>Tue Nov 27 10:15:40 UTC 2012</I>
<P><UL>
<LI>Previous message: <A HREF="012969.html">[mono-android] Wait x seconds
</A></li>
<LI>Next message: <A HREF="012970.html">[mono-android] Display simple menu when item is pressed
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#12972">[ date ]</a>
<a href="thread.html#12972">[ thread ]</a>
<a href="subject.html#12972">[ subject ]</a>
<a href="author.html#12972">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>That's because you're blocking in the UI thread with that sleep. If you
want to do something like that you'll have to do a sleep in a background
thread and then posting something back into the UI thread.
Maybe timers can help you better (System.Timers.Timer or
System.Threading.Timer).
On 27 November 2012 01:59, Canning &lt;<A HREF="http://lists.ximian.com/mailman/listinfo/monodroid">simon at wizbiz.net.nz</A>&gt; wrote:
&gt;<i> I am using MonoDevelop for Android and have a question.
</I>&gt;<i>
</I>&gt;<i> Currently, I am displaying a toast message and then wish to display a
</I>&gt;<i> messagebox x amount of seconds later. I have tried this code:
</I>&gt;<i>
</I>&gt;<i> System.Threading.Thread.Sleep(5000)
</I>&gt;<i>
</I>&gt;<i> However, the messagebox is displayed straight after the toast statement
</I>&gt;<i> with
</I>&gt;<i> no wait.
</I>&gt;<i>
</I>&gt;<i> Can I please have some help to let the toast be displayed and then the
</I>&gt;<i> application wait x amount of seconds and then display the messagebox?
</I>&gt;<i>
</I>&gt;<i> Thanks
</I>&gt;<i>
</I>&gt;<i>
</I>&gt;<i>
</I>&gt;<i> --
</I>&gt;<i> View this message in context:
</I>&gt;<i> <A HREF="http://mono-for-android.1047100.n5.nabble.com/Wait-x-seconds-tp5712503.html">http://mono-for-android.1047100.n5.nabble.com/Wait-x-seconds-tp5712503.html</A>
</I>&gt;<i> Sent from the Mono for Android mailing list archive at Nabble.com.
</I>&gt;<i> _______________________________________________
</I>&gt;<i> Monodroid mailing list
</I>&gt;<i> <A HREF="http://lists.ximian.com/mailman/listinfo/monodroid">Monodroid at lists.ximian.com</A>
</I>&gt;<i>
</I>&gt;<i> UNSUBSCRIBE INFORMATION:
</I>&gt;<i> <A HREF="http://lists.ximian.com/mailman/listinfo/monodroid">http://lists.ximian.com/mailman/listinfo/monodroid</A>
</I>&gt;<i>
</I>
--
Gon&#231;alo Oliveira
-------------- next part --------------
An HTML attachment was scrubbed...
URL: &lt;<A HREF="http://lists.ximian.com/pipermail/monodroid/attachments/20121127/41c98a39/attachment.html">http://lists.ximian.com/pipermail/monodroid/attachments/20121127/41c98a39/attachment.html</A>&gt;
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="012969.html">[mono-android] Wait x seconds
</A></li>
<LI>Next message: <A HREF="012970.html">[mono-android] Display simple menu when item is pressed
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#12972">[ date ]</a>
<a href="thread.html#12972">[ thread ]</a>
<a href="subject.html#12972">[ subject ]</a>
<a href="author.html#12972">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.ximian.com/mailman/listinfo/monodroid">More information about the Monodroid
mailing list</a><br>
</body></html>