зеркало из https://github.com/mono/mail-archives.git
100 строки
4.2 KiB
HTML
100 строки
4.2 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE> [mono-android] Generic Activity
|
|
</TITLE>
|
|
<LINK REL="Index" HREF="index.html" >
|
|
<LINK REL="made" HREF="mailto:monodroid%40lists.ximian.com?Subject=%5Bmono-android%5D%20Generic%20Activity&In-Reply-To=41B845D1-5AD2-4CCB-8DE2-152ECE2DCD1B%40xamarin.com">
|
|
<META NAME="robots" CONTENT="index,nofollow">
|
|
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
|
|
<LINK REL="Previous" HREF="008034.html">
|
|
<LINK REL="Next" HREF="008047.html">
|
|
</HEAD>
|
|
<BODY BGCOLOR="#ffffff">
|
|
<H1>[mono-android] Generic Activity</H1>
|
|
<B>jcwmoore</B>
|
|
<A HREF="mailto:monodroid%40lists.ximian.com?Subject=%5Bmono-android%5D%20Generic%20Activity&In-Reply-To=41B845D1-5AD2-4CCB-8DE2-152ECE2DCD1B%40xamarin.com"
|
|
TITLE="[mono-android] Generic Activity">jcwmoore at gmail.com
|
|
</A><BR>
|
|
<I>Thu Dec 22 19:59:14 EST 2011</I>
|
|
<P><UL>
|
|
<LI>Previous message: <A HREF="008034.html">[mono-android] Generic Activity
|
|
</A></li>
|
|
<LI>Next message: <A HREF="008047.html">[mono-android] Generic Activity
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#8046">[ date ]</a>
|
|
<a href="thread.html#8046">[ thread ]</a>
|
|
<a href="subject.html#8046">[ subject ]</a>
|
|
<a href="author.html#8046">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
<HR>
|
|
<!--beginarticle-->
|
|
<PRE>
|
|
Jonathan Pryor-2 wrote
|
|
><i>
|
|
</I>><i> StartActivity(typeof(LookupActivity<AmpachePlaylist>));
|
|
</I>><i>
|
|
</I>><i> This won't work, because an Android Callable Wrapper will be generated for
|
|
</I>><i> LookupActivity<T> (as LookupActivity_1), but not for
|
|
</I>><i> LookupActivity<AmpachePlaylist>. Thus, when Android attempts to create a
|
|
</I>><i> LookupActivity_1, we'll attempt to run the managed side constructor, which
|
|
</I>><i> will fail as 'T' is unknown (and not knowable).
|
|
</I>><i>
|
|
</I>><i> I'm not even sure if it's possible to make it work, either.
|
|
</I>><i>
|
|
</I>><i> Finally, it doesn't make sense to me, as the purpose of an Activity
|
|
</I>><i> (generally) is to instantiate a single user-visible screen. By making it
|
|
</I>><i> generic, you're providing a _set_ of such activities, but the UI will
|
|
</I>><i> still display only one icon, so how is your app supposed to know which one
|
|
</I>><i> of the set was desired?
|
|
</I>><i>
|
|
</I>><i> - Jon
|
|
</I>><i>
|
|
</I>
|
|
Thanks for the info,
|
|
|
|
Generally, i would agree with you that it doesn't make sense to have a
|
|
generic activity; however, in this case the activity is very simple, it just
|
|
displays a list of names, playlist names, artist names or album names, with
|
|
no special logic, just a list of strings. In this case, sense i don't want
|
|
to write 3 activities that would literally be the exact same code (minus
|
|
using a different IRepository<T>,) a generic activity makes sense to me.
|
|
Now i have managed to achieve the same results by pushing the type name into
|
|
the activity's intent, and then moving the generic parameter down to the
|
|
activities non-overridden methods.
|
|
|
|
bottom line this feature would be a neat trick to use in android and could
|
|
allow to create a very flexible, but very limited, UI. after all, this
|
|
activity is only able to display a list of strings and very little else.
|
|
|
|
|
|
--
|
|
View this message in context: <A HREF="http://mono-for-android.1047100.n5.nabble.com/Generic-Activity-tp5093565p5096000.html">http://mono-for-android.1047100.n5.nabble.com/Generic-Activity-tp5093565p5096000.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="008034.html">[mono-android] Generic Activity
|
|
</A></li>
|
|
<LI>Next message: <A HREF="008047.html">[mono-android] Generic Activity
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#8046">[ date ]</a>
|
|
<a href="thread.html#8046">[ thread ]</a>
|
|
<a href="subject.html#8046">[ subject ]</a>
|
|
<a href="author.html#8046">[ 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>
|