mail-archives/monodroid/2011-December/008132.html

89 строки
3.3 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [mono-android] Help with Activity.Finish
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:monodroid%40lists.ximian.com?Subject=%5Bmono-android%5D%20Help%20with%20Activity.Finish&In-Reply-To=">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="008129.html">
<LINK REL="Next" HREF="008153.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[mono-android] Help with Activity.Finish</H1>
<B>NebulaSleuth</B>
<A HREF="mailto:monodroid%40lists.ximian.com?Subject=%5Bmono-android%5D%20Help%20with%20Activity.Finish&In-Reply-To="
TITLE="[mono-android] Help with Activity.Finish">nebulasleuth at excite.com
</A><BR>
<I>Fri Dec 30 00:41:16 EST 2011</I>
<P><UL>
<LI>Previous message: <A HREF="008129.html">[mono-android] NotImplemenedException in ObservableCollection
</A></li>
<LI>Next message: <A HREF="008153.html">[mono-android] Help with Activity.Finish
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#8132">[ date ]</a>
<a href="thread.html#8132">[ thread ]</a>
<a href="subject.html#8132">[ subject ]</a>
<a href="author.html#8132">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>I have an Activity that starts a second activity using
StartActivityForResult().
The second activity starts fine, and then spawns a thread to do some work.
When the work is complete I want to return to the calling Activity by
calling SetResult() and Finish().
The problem is control doesn't return to the calling activity, the
application screen goes away (back to the launcher screen) and the debugger
never returns as if the app is hung.
I figured that I needed to do it from the UI Thread so I tried using
RunOnUIThread() to perform the SetResult/Finish. Still no luck.
So I created a Handler and used SendMessage to perform the action. Still no
luck.
as a test, I then spun after starting the thread, checking the IsAlive flag
until the thread completed and then called SetResult/Finish. Well that
worked! However, this is not really useful.
Can somebody shed some light on what is happening here?
-Mike
--
View this message in context: <A HREF="http://mono-for-android.1047100.n5.nabble.com/Help-with-Activity-Finish-tp5109329p5109329.html">http://mono-for-android.1047100.n5.nabble.com/Help-with-Activity-Finish-tp5109329p5109329.html</A>
Sent from the Mono for Android mailing list archive at Nabble.com.
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="008129.html">[mono-android] NotImplemenedException in ObservableCollection
</A></li>
<LI>Next message: <A HREF="008153.html">[mono-android] Help with Activity.Finish
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#8132">[ date ]</a>
<a href="thread.html#8132">[ thread ]</a>
<a href="subject.html#8132">[ subject ]</a>
<a href="author.html#8132">[ 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>