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

155 строки
7.5 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=CAC30OvifbEhHyMQuw2DiKXLZWUwcj%2B8wGe3Zcd_A%3DeeqoR%3D0Bg%40mail.gmail.com">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="007817.html">
<LINK REL="Next" HREF="007819.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[mono-android] Threading with Rotation</H1>
<B>Dean Cleaver</B>
<A HREF="mailto:monodroid%40lists.ximian.com?Subject=%5Bmono-android%5D%20Threading%20with%20Rotation&In-Reply-To=CAC30OvifbEhHyMQuw2DiKXLZWUwcj%2B8wGe3Zcd_A%3DeeqoR%3D0Bg%40mail.gmail.com"
TITLE="[mono-android] Threading with Rotation">dean.cleaver at xceptionsoftware.com
</A><BR>
<I>Wed Dec 14 00:17:12 EST 2011</I>
<P><UL>
<LI>Previous message: <A HREF="007817.html">[mono-android] Threading with Rotation
</A></li>
<LI>Next message: <A HREF="007819.html">[mono-android] &quot;leave the following resource extensions uncompressed&quot;
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#7818">[ date ]</a>
<a href="thread.html#7818">[ thread ]</a>
<a href="subject.html#7818">[ subject ]</a>
<a href="author.html#7818">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>Might be time for you to leave the list. Your attitude is not wanted here.
-----Original Message-----
From: <A HREF="http://lists.ximian.com/mailman/listinfo/monodroid">monodroid-bounces at lists.ximian.com</A> [mailto:<A HREF="http://lists.ximian.com/mailman/listinfo/monodroid">monodroid-bounces at lists.ximian.com</A>] On Behalf Of Sayed Arian Kooshesh
Sent: Tuesday, December 13, 2011 10:51 PM
To: Discussions related to Mono for Android
Subject: Re: [mono-android] Threading with Rotation
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
</I>&gt;&gt;&gt;<i> multiple threads in Android. &#160;For instance if you start a thread,
</I>&gt;&gt;&gt;<i> and then rotate the phone before the thread is done with its work
</I>&gt;&gt;&gt;<i> Android destroys the previous Activity and generates a new one. &#160;Any
</I>&gt;&gt;&gt;<i> references you had to your previous 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;
</I>&gt;&gt;<i> <A HREF="http://support.xamarin.com/customer/portal/questions/34836-toast-in-s">http://support.xamarin.com/customer/portal/questions/34836-toast-in-s</A>
</I>&gt;&gt;<i> ervice
</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
</I>&gt;&gt;&gt;<i> such as using an internal static class inside your activity can't
</I>&gt;&gt;&gt;<i> easily be 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
_______________________________________________
Monodroid mailing list
<A HREF="http://lists.ximian.com/mailman/listinfo/monodroid">Monodroid at lists.ximian.com</A>
UNSUBSCRIBE INFORMATION:
<A HREF="http://lists.ximian.com/mailman/listinfo/monodroid">http://lists.ximian.com/mailman/listinfo/monodroid</A>
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="007817.html">[mono-android] Threading with Rotation
</A></li>
<LI>Next message: <A HREF="007819.html">[mono-android] &quot;leave the following resource extensions uncompressed&quot;
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#7818">[ date ]</a>
<a href="thread.html#7818">[ thread ]</a>
<a href="subject.html#7818">[ subject ]</a>
<a href="author.html#7818">[ 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>