https://bugzilla.novell.com/show_bug.cgi?id=641112
https://bugzilla.novell.com/show_bug.cgi?id=641112#c0 Summary: Strange behavoiur using the Tag attribute of Android.View Classification: Mono Product: MonoDroid Version: SVN Platform: Other OS/Version: Other Status: NEW Severity: Normal Priority: P5 - None Component: Class Libraries AssignedTo: [email protected] ReportedBy: [email protected] QAContact: [email protected] Found By: --- Blocker: --- User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.62 Safari/534.3 Trying to store an object in a Tag attribute of TextView there is a strange behavoiur. If I use an object from the class library (e.g. string or TextView) all works properly. If I store an object create by a my class (derived from Java.Lang.Object or not, is the same) the Tag attribute is null. Here same sample code: ====================================================== using System; using Android.App; using Android.Content; using Android.Runtime; using Android.Views; using Android.Widget; using Android.OS; using Android.Util; namespace TagSample { [Activity(MainLauncher = true)] public class Activity1 : Activity { int count = 1; public Activity1(IntPtr handle) : base(handle) { } protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.layout.main); // Get our button from the layout resource, // and attach an event to it Button button = FindViewById<Button>(Resource.id.myButton); News news = new News(); news.Title = "Title"; news.Description = "Description"; /* TEST 1 PASS */ button.Tag = "String"; CheckResult("Check 1", button.Tag); /* TEST 2 PASS */ button.Tag = button; CheckResult("Check 2", button.Tag); /* TEST 3 KO */ button.Tag = news; if (news == null) { Log.W("TEST_TAG", " NEWS IS NULL "); } else { Log.W("TEST_TAG", " NEWS NOT IS NULL "); } CheckResult("Check 3", button.Tag); } private void CheckResult(string test, Java.Lang.Object obj) { if (obj == null) { Log.W("TEST_TAG", test + " KO :( "); } else { Log.W("TEST_TAG", test + " OK :) *****"); } } } } Reproducible: Always Steps to Reproduce: Simpy run the sample code Actual Results: here the output from logcat D/dalvikvm( 290): Added shared lib /data/data/TagSample.TagSample/lib/libmonodr oid.so 0x43e37290 W/ActivityManager( 60): Launch timeout has expired, giving up wake lock! W/ActivityManager( 60): Activity idle timeout for HistoryRecord{43fec4d0 TagSa mple.TagSample/tagSample.Activity1} D/dalvikvm( 117): GC_EXPLICIT freed 1409 objects / 72144 bytes in 5846ms W/TEST_TAG( 290): Check 1 OK :) ***** W/TEST_TAG( 290): Check 2 OK :) ***** W/TEST_TAG( 290): NEWS NOT IS NULL W/TEST_TAG( 290): Check 3 KO :( Expected Results: The desidered output is. W/TEST_TAG( 290): Check 1 OK :) ***** W/TEST_TAG( 290): Check 2 OK :) ***** W/TEST_TAG( 290): Check 3 OK :) ***** -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
