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

151 строка
6.6 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [mono-android] Threading with Rotation
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:monodroid%40lists.ximian.com?Subject=%5Bmono-android%5D%20Threading%20with%20Rotation&In-Reply-To=CAC30Ovizmru1PEXv9N-6kGQxSY-raB_ENK5K5dkyUhF1aTb6nw%40mail.gmail.com">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="007816.html">
<LINK REL="Next" HREF="007818.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[mono-android] Threading with Rotation</H1>
<B>Sayed Arian Kooshesh</B>
<A HREF="mailto:monodroid%40lists.ximian.com?Subject=%5Bmono-android%5D%20Threading%20with%20Rotation&In-Reply-To=CAC30Ovizmru1PEXv9N-6kGQxSY-raB_ENK5K5dkyUhF1aTb6nw%40mail.gmail.com"
TITLE="[mono-android] Threading with Rotation">kooshesh at gmail.com
</A><BR>
<I>Tue Dec 13 23:51:10 EST 2011</I>
<P><UL>
<LI>Previous message: <A HREF="007816.html">[mono-android] Threading with Rotation
</A></li>
<LI>Next message: <A HREF="007818.html">[mono-android] Threading with Rotation
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#7817">[ date ]</a>
<a href="thread.html#7817">[ thread ]</a>
<a href="subject.html#7817">[ subject ]</a>
<a href="author.html#7817">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>i'm sorry if my responses seem flamy but the majority of the work i've
had lately is fixing code of programmers like asshole here who have no
idea how to prgramm. How do they get jobs? I just wonder and wonder.
Do the clients go on like freelancer.com hoping to get low bid? Don't
you know that's how you get FUCKED? I mean, at least hire some talent
European (like the people who mange this list) or fucking stop hiring
Indians who don't know how to program, write shiity, shitty, code, and
end up on lists like this asking stupid ass questions about shit that
the developers don't need to help then with. If you can't use c# how
it should be, why are you using it to write an android app. You know
it's gonna leak memory and fail... fucking shit programmer.
I swear to god I might just hire someone to beat the shit out of these
guys. That might teach them to not take jobs that they can't handle.
On Tue, Dec 13, 2011 at 10:46 PM, Sayed Arian Kooshesh
&lt;<A HREF="http://lists.ximian.com/mailman/listinfo/monodroid">kooshesh at gmail.com</A>&gt; wrote:
&gt;<i> please stop using threads. pleas learn backgroundworker. or i will
</I>&gt;<i> find you. I will cut you open. I will eat your innards. is that threat
</I>&gt;<i> enough to make you write GOOD code? or are you forever doomed to bitch
</I>&gt;<i> on lists like this because you have problems. the problems being
</I>&gt;<i> shitty code and the solution being you STOP being a fucking
</I>&gt;<i> programmer.
</I>&gt;<i>
</I>&gt;<i> On Tue, Dec 13, 2011 at 9:31 PM, Jonathan Pryor &lt;<A HREF="http://lists.ximian.com/mailman/listinfo/monodroid">jonp at xamarin.com</A>&gt; wrote:
</I>&gt;&gt;<i> On Nov 16, 2011, at 1:10 PM, emalamisura wrote:
</I>&gt;&gt;&gt;<i> A common issue with maintaining state is handling Rotation with multiple
</I>&gt;&gt;&gt;<i> threads in Android. &#160;For instance if you start a thread, and then rotate the
</I>&gt;&gt;&gt;<i> phone before the thread is done with its work Android destroys the previous
</I>&gt;&gt;&gt;<i> Activity and generates a new one. &#160;Any references you had to your previous
</I>&gt;&gt;&gt;<i> activity will cause a reference exception.
</I>&gt;&gt;<i>
</I>&gt;&gt;<i> Right. Don't do that. :-)
</I>&gt;&gt;<i>
</I>&gt;&gt;<i> I'm also not sure what scenario you're thinking of. Activities are tied to their Main thread -- it isn't safe to interact with them except via the main thread or Activity.RunOnUiThread() -- and anything associated with the Activity follows the same rules as well. This would include the LastNonConfigurationInstance value, as used at:
</I>&gt;&gt;<i>
</I>&gt;&gt;<i> &#160; &#160; &#160; &#160;<A HREF="http://stackoverflow.com/a/8331994/83444">http://stackoverflow.com/a/8331994/83444</A>
</I>&gt;&gt;<i>
</I>&gt;&gt;<i> So the primary question is this: why are multiple threads using an Activity instance? If it's to use Activity.RunOnUiThread(), use an alternative, such as a Handler instance over the MainLooper:
</I>&gt;&gt;<i>
</I>&gt;&gt;<i> &#160; &#160; &#160; &#160;<A HREF="http://support.xamarin.com/customer/portal/questions/34836-toast-in-service">http://support.xamarin.com/customer/portal/questions/34836-toast-in-service</A>
</I>&gt;&gt;<i>
</I>&gt;&gt;&gt;<i> This becomes even more difficult
</I>&gt;&gt;&gt;<i> to handle in MonoDroid because alot of the semantics used in Java such as
</I>&gt;&gt;&gt;<i> using an internal static class inside your activity can't easily be
</I>&gt;&gt;&gt;<i> reproduced in C#
</I>&gt;&gt;<i>
</I>&gt;&gt;<i> I also don't understand this. Java's `static` nested classes are ~identical to C# nested types; it's non-`static` nested classes which differ.
</I>&gt;&gt;<i>
</I>&gt;&gt;<i> Thanks,
</I>&gt;&gt;<i> &#160;- Jon
</I>&gt;&gt;<i>
</I>&gt;&gt;<i> _______________________________________________
</I>&gt;&gt;<i> Monodroid mailing list
</I>&gt;&gt;<i> <A HREF="http://lists.ximian.com/mailman/listinfo/monodroid">Monodroid at lists.ximian.com</A>
</I>&gt;&gt;<i>
</I>&gt;&gt;<i> UNSUBSCRIBE INFORMATION:
</I>&gt;&gt;<i> <A HREF="http://lists.ximian.com/mailman/listinfo/monodroid">http://lists.ximian.com/mailman/listinfo/monodroid</A>
</I>&gt;<i>
</I>&gt;<i>
</I>&gt;<i>
</I>&gt;<i> --
</I>&gt;<i> Extreme Knowledge is not something for which he programs a computer
</I>&gt;<i> but for which his computer is programming him.
</I>&gt;<i>
</I>&gt;<i> -Wozniak
</I>
--
Extreme Knowledge is not something for which he programs a computer
but for which his computer is programming him.
-Wozniak
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="007816.html">[mono-android] Threading with Rotation
</A></li>
<LI>Next message: <A HREF="007818.html">[mono-android] Threading with Rotation
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#7817">[ date ]</a>
<a href="thread.html#7817">[ thread ]</a>
<a href="subject.html#7817">[ subject ]</a>
<a href="author.html#7817">[ 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>