Re: [mono-android] Win Phone Development and xamarin relatedbasic question
Thanks. I have place an order of the same from the local store. Another thing that I learned was that under Win7 Phone, I cannot iterate through contact list, Is that true ? Regards -- From: "Berndt Hamboeck" Sent: Saturday, March 17, 2012 3:04 PM To: "'Discussions related to Mono for Android'" Subject: Re: [mono-android] Win Phone Development and xamarin relatedbasicquestion> If you spend a few bucks, Amazon could throw some light on this: Professional Cross-Platform Mobile Development in C# Paperback: 384 pages Publisher: Wrox; 1 edition (February 21, 2012) Language: English ISBN-10: 1118157702 ISBN-13: 978-1118157701 Cheers, Berndt -Original Message- From: monodroid-boun...@lists.ximian.com [mailto:monodroid-boun...@lists.ximian.com] On Behalf Of Jignesh Desai Sent: Samstag, 17. März 2012 07:31 To: Discussions related to Mono for Android Subject: [mono-android] Win Phone Development and xamarin related basic question Hi, I am attending a class on Win7 Phone development. I learn that its fully Silverlight based. now I understand that silverlight does not run on android or iphone. I also learn that Windows Mobile Development is different then Windows Phone Development and apps written using Win Mobile Development will not run on Win7. So how does code written in xamarin does cross platform application? Can someone throw light on this ? Cheers Jignesh ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
Re: [mono-android] Asynchronous display pics into listview
There are several ways to get something like this to work. One simple way is to maintain a dictionary of row numbers (position) to ImageView's - that way the row number can be your unique number. You do of course need to make sure that your dictionary is kept up to date if your convertView's get reused. e.g. you could do something like: private Dictionary _imageLookup; public override View GetView(int position, View convertView, ViewGroup parent) { lock(this) { var view = (convertView ?? inflater.Inflate(Resource.Layout.DialogCategoriesLigne, parent, false)) as LinearLayout; var ImageItem = view.FindViewById(Resource.Id.imageItemDialogCategoriesLigne) as ImageView; foreach (var kvp in _imageLookup) { if (kvp.Value == ImageItem) { _imageLookup.Remove(kvp.Key); break; } } _imageLookup[position] = ImageItem; KickOffAsyncSearchHere(position); var Description = view.FindViewById(Resource.Id.descriptionDialogCategoriesLigne) as TextView; var Nbimages = view.FindViewById(Resource.Id.nbimgDialogCategoriesLigne) as TextView; ImageItem.SetImageResource(Resource.Drawable.DefaultImageMenu); Description.SetText(listetext[position].description); Nbimages.SetText(listetext[position].description); return view } } // async thread comes in here somehow private void ImageSearchComplete(int position, Drawable drawable) { RunOnUIThread(() => UIImageSearchComplete(position drawable)); } // called on UI thread - but use lock anyway private void UIImageSearchComplete(int position, Drawable drawable) { lock (this) { ImageView imageView; if (!_imageLookup.TryGetValue(position, out imageView) return; imageView.SetDrawable(drawable); } Another way to do this is to wrap up the logic inside a subclassed ImageView. I've recently coded something like this for this class - https://github.com/slodge/MvvmCross/blob/master/Cirrious/Cirrious.MvvmCross.Binding/Android/Views/MvxHttpImageView.cs Which internally uses this helper: https://github.com/slodge/MvvmCross/blob/master/Cirrious/Cirrious.MvvmCross/Platform/Images/MvxDynamicImageHelper.cs - which in turn uses a "disk" and in-memory caching framework - a bit like the code in monotouch.dialog If you don't care abour disk and in-memory caching, then you should be able to hack something up quite quickly. Stuart On 18 March 2012 17:37, Michel wrote: > Hello. > > ** ** > > To display asynchonous pics to my listview, with one or more http > connexions, i wrote a special thread, and change Imageitem.setImageDrawable. > > > But there is a problem with this system i must put a unique id for > each ImageView in listview, load the item ImageView into a list, and just > view.Addview(Imageitem) if item imageview is not null to not do a new > ImageView() when Getview is call > > But GREF inscrease :(, and application crash if i scroll lot of! > > ** ** > > The best Getview to not have increase GREF (0 increase more), is : > > ** ** > >public override View GetView(int position, View convertView, > ViewGroup parent) > > { > > var view = (convertView ?? > inflater.Inflate(Resource.Layout.DialogCategoriesLigne, parent, false)) as > LinearLayout; > > var ImageItem = > view.FindViewById(Resource.Id.imageItemDialogCategoriesLigne) as ImageView; > > > var Description = > view.FindViewById(Resource.Id.descriptionDialogCategoriesLigne) as TextView; > > > var Nbimages = > view.FindViewById(Resource.Id.nbimgDialogCategoriesLigne) as TextView; > > ** ** > > ** ** > > > ImageItem.SetImageResource(Resource.Drawable.DefaultImageMenu); > > > Description.SetText(listetext[position].description); > > > Nbimages.SetText(listetext[position].description); > > > > > > > > > return view > > > } > > > > > The problem with it, i can't put a unique Id to my ImageItem, and in my > independant Thread, i can't change the pic. > > ** ** > > If i just do in my independant thread a ImageItem.setImageDrawable, all > pics are loaded in the first listview item > > ** ** > > Somone have a idea ? > > ___ > Monodroid mailing list > Monodroid@lists.ximian.com > > UNSUBSCRIBE INFORMATION: > http://lists.ximian.com/mailman/listinfo/monodroid > > ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
[mono-android] Calling System.Net.WebClient.DownloadData(string url) without INTERNET permission does'n cause any exceptions
Trying to call System.Net.WebClient.DownloadData(string url) without in manifest doesn't cause any exceptions. It you accidentally forget to add "uses-permission", it makes difficult enougth to find an actual reason, why DownloadData() does't work properly. -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/Calling-System-Net-WebClient-DownloadData-string-url-without-INTERNET-permission-does-n-cause-any-exs-tp5576565p5576565.html Sent from the Mono for Android mailing list archive at Nabble.com. ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
Re: [mono-android] Calling System.Net.WebClient.DownloadData(string url) without INTERNET permission does'n cause any exceptions
I tried playing around with it in a Java environment, and it does not seem to throw any exceptions apart from UnknownHost exception, which does not say anything about that the INTERNET permission has been set. On Mon, Mar 19, 2012 at 10:51 AM, PVoLan wrote: > Trying to call System.Net.WebClient.DownloadData(string url) without > > > > in manifest doesn't cause any exceptions. It you accidentally forget to add > "uses-permission", it makes difficult enougth to find an actual reason, why > DownloadData() does't work properly. > > -- > View this message in context: > http://mono-for-android.1047100.n5.nabble.com/Calling-System-Net-WebClient-DownloadData-string-url-without-INTERNET-permission-does-n-cause-any-exs-tp5576565p5576565.html > Sent from the Mono for Android mailing list archive at Nabble.com. > ___ > Monodroid mailing list > Monodroid@lists.ximian.com > > UNSUBSCRIBE INFORMATION: > http://lists.ximian.com/mailman/listinfo/monodroid -- Med Venlig Hilsen / With Best Regards Tomasz Cielecki http://ostebaronen.dk ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
Re: [mono-android] Asynchronous display pics into listview
After search a lot for my problem, i see all work fine Just for my test, I never scroll to see the result so ive a last problem i dont understand. The first time the listview is call, all pics are loaded in the first line . But after, if I scroll down, picts are loaded in the good lines, and If I scroll up, its ok too Have an idea? De : monodroid-boun...@lists.ximian.com [mailto:monodroid-boun...@lists.ximian.com] De la part de Stuart Lodge Envoyé : lundi 19 mars 2012 09:35 À : Discussions related to Mono for Android Objet : Re: [mono-android] Asynchronous display pics into listview There are several ways to get something like this to work. One simple way is to maintain a dictionary of row numbers (position) to ImageView's - that way the row number can be your unique number. You do of course need to make sure that your dictionary is kept up to date if your convertView's get reused. e.g. you could do something like: private Dictionary _imageLookup; public override View GetView(int position, View convertView, ViewGroup parent) { lock(this) { var view = (convertView ?? inflater.Inflate(Resource.Layout.DialogCategoriesLigne, parent, false)) as LinearLayout; var ImageItem = view.FindViewById(Resource.Id.imageItemDialogCategoriesLigne) as ImageView; foreach (var kvp in _imageLookup) { if (kvp.Value == ImageItem) { _imageLookup.Remove(kvp.Key); break; } } _imageLookup[position] = ImageItem; KickOffAsyncSearchHere(position); var Description = view.FindViewById(Resource.Id.descriptionDialogCategoriesLigne) as TextView; var Nbimages = view.FindViewById(Resource.Id.nbimgDialogCategoriesLigne) as TextView; ImageItem.SetImageResource(Resource.Drawable.DefaultImageMenu); Description.SetText(listetext[position].description); Nbimages.SetText(listetext[position].description); return view } } // async thread comes in here somehow private void ImageSearchComplete(int position, Drawable drawable) { RunOnUIThread(() => UIImageSearchComplete(position drawable)); } // called on UI thread - but use lock anyway private void UIImageSearchComplete(int position, Drawable drawable) { lock (this) { ImageView imageView; if (!_imageLookup.TryGetValue(position, out imageView) return; imageView.SetDrawable(drawable); } Another way to do this is to wrap up the logic inside a subclassed ImageView. I've recently coded something like this for this class - https://github.com/slodge/MvvmCross/blob/master/Cirrious/Cirrious.MvvmCross. Binding/Android/Views/MvxHttpImageView.cs Which internally uses this helper: https://github.com/slodge/MvvmCross/blob/master/Cirrious/Cirrious.MvvmCross/ Platform/Images/MvxDynamicImageHelper.cs - which in turn uses a "disk" and in-memory caching framework - a bit like the code in monotouch.dialog If you don't care abour disk and in-memory caching, then you should be able to hack something up quite quickly. Stuart On 18 March 2012 17:37, Michel wrote: Hello. To display asynchonous pics to my listview, with one or more http connexions, i wrote a special thread, and change Imageitem.setImageDrawable. But there is a problem with this system i must put a unique id for each ImageView in listview, load the item ImageView into a list, and just view.Addview(Imageitem) if item imageview is not null to not do a new ImageView() when Getview is call But GREF inscrease :(, and application crash if i scroll lot of! The best Getview to not have increase GREF (0 increase more), is : public override View GetView(int position, View convertView, ViewGroup parent) { var view = (convertView ?? inflater.Inflate(Resource.Layout.DialogCategoriesLigne, parent, false)) as LinearLayout; var ImageItem = view.FindViewById(Resource.Id.imageItemDialogCategoriesLigne) as ImageView; var Description = view.FindViewById(Resource.Id.descriptionDialogCategoriesLigne) as TextView; var Nbimages = view.FindViewById(Resource.Id.nbimgDialogCategoriesLigne) as TextView; ImageItem.SetImageResource(Resource.Drawable.DefaultImageMenu); Description.SetText(listetext[position].description); Nbimages.SetText(listetext[position].description); return view } The problem with it, i can't put a unique Id to my ImageItem, and in my independant Thread, i can't change the pic. If i just do in my independant thread a ImageItem.setImageDrawable, all pics are loaded in the first listview item Somone have a idea ? ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
[mono-android] FlurryAnalytics
Has anyone implemented/knows where to get hold of MonoDroid bindings/JNI wrapper for flurry analytics? Thanks! - Patrik ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
Re: [mono-android] profiling support in monodroid?
Hi Jon Sorry for the delay in responding. I have been busy trying to gather as much info on the problem as possible. I went away and tried to get the profiler running via environment variables as per your suggestion, however I didn't see a way of invoking the profiler other than using the command line option '--profile=log:heapshot'. There certainly weren't any documented environment variables that I found, so I guess I have hit a brick wall in getting the profiler to run on Mono for Android right now. The next step I took was to strip back our codebase to run just the very core network stack (which is cross platform and runs on .NET and Mono), removing all UI layer code. I managed to find a leak when repeatedly starting/stopping our network stack on a busy network on a mac using mono (with boehm GC). The interesting thing is that the exact same code does not leak when running on Windows using .NET. Again, sadly, I also ran into the very same problem that we encountered with the GC crashes bug we discussed previously - it only seems to happen on a busy network with plenty of Upnp devices kicking about, so it will be difficult for me to give you a working repro app. My next line of attack was to try to get the mono profiler running on the mac, and try and chase down the leaked objects but unfortunately the profiler requires the use of sgen and as soon as I run it using sgen, both mono 2.10.8 and the 2.10.9 beta crash out with mono-sgen related stacktraces. So next I had a shot at compiling and running the latest mono from a fresh git clone today, but this crashed out with an EntryPointNotFoundException trying to run CreateNLSocket() from libMonoPosixHelper, so I obviously missed some build switch or something. I have tried and failed to isolate any one area of code, since the only reliable way that I have to monitor heap usage in the mono vm is by setting MONO_GC_DEBUG=5, waiting for nursery collections to be created and watching the logcat output for debug messages from the GC. Thus my only means of measuring memory usage is in itself interfering with my attempts to isolate it to a particular piece of code. So how I can take this forward from here as this memory leak is now preventing me from releasing my app? Do you have any other suggestions for debugging memory usage pending profiler support in Mono for Android? Cheers Iain -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/profiling-support-in-monodroid-tp5564284p5577752.html Sent from the Mono for Android mailing list archive at Nabble.com. ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
[mono-android] Losing Visual Studio Intellisense
Hello has anyone has any experience of the intellisense in Visual Studio disappearing when in a Mono for Android solution? I recently had to uninstall and re-install Visual Studio (from Ultimate to Premium versions). Ever since I keep losing the intellisense in Visual Studio ONLY in Mono for Android projects. I have un-installed and re-installed Mono several times now and it does come back but then seems to disappear again. Any ideas? Thanks Julian -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/Losing-Visual-Studio-Intellisense-tp5576925p5576925.html Sent from the Mono for Android mailing list archive at Nabble.com. ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
[mono-android] namespace System.Drawing in Xamarin API
I installed Android.Mono for developing android application. I don`t see System.Drawing namespace inside VS2010. But these classes are presented here http://androidapi.xamarin.com/ Could someone explaine, can i use System.Drawing classes like Color, Rectangle, Point, Size for developing Android application. Thanks in advance -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/namespace-System-Drawing-in-Xamarin-API-tp5578365p5578365.html Sent from the Mono for Android mailing list archive at Nabble.com. ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
[mono-android] Error message when trying to compile and test on Android emulator
I am getting an error of Unhandled exception in button_ok_Click:Task. See exception for details. When I view the details I get the message in the image: http://mono-for-android.1047100.n5.nabble.com/file/n5578375/Mono-Error.jpg We are also having issues running the Honeycomb Gallery example. It is mainly just not loading. We waited upwards of 20 minutes for the package to install on the emulator. Is there an issue with the way we have it set up? We are on Windows, running Mono for Android, using the default AVD's set up by Mono. Please assist. Thanks in advance. -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/Error-message-when-trying-to-compile-and-test-on-Android-emulator-tp5578375p5578375.html Sent from the Mono for Android mailing list archive at Nabble.com. ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
Re: [mono-android] namespace System.Drawing in Xamarin API
On Mar 19, 2012, at 5:09 PM, GigaNTes wrote: > I installed Android.Mono for developing android application. I don`t see > System.Drawing namespace inside VS2010. But these classes are presented here > http://androidapi.xamarin.com/ They're in OpenTK.dll, so you need to add an assembly reference to OpenTK.dll. - Jon ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
[mono-android] JNIENV Call Syntax
I'm trying to make a call from c# to a Java library and can't figure out the bits of JNIENV syntax, I'm able to get so far and was wondering if anyone could help me. I have put the Java Code and the C# code that I've got so far. I've just listed some of the main members in the Java PushManager class which I'm trying make the call in. I'm able to make calls to enablePush and disablePush ok. Able to get results back for the FindClass and the "shared" GetMethodID but not sure where to go after this. /Java Code // This is the Java call I'm trying to make in C# String apid = PushManager.shared().getAPID(); // This is the PushManager Class package com.urbanairship.push; public class PushManager { public static void init() { /* compiled code */ } public static com.urbanairship.push.PushManager shared() { /* compiled code */ } public static void enablePush() { /* compiled code */ } public static void disablePush() { /* compiled code */ } private PushManager() { /* compiled code */ } public java.lang.String getAPID() { /* compiled code */ } } / /C# Code So Far IntPtr ipPushmanager = JNIEnv.FindClass("com/urbanairship/push/PushManager"); IntPtr ipShared = JNIEnv.GetStaticMethodID(ipPushmanager , "shared", "()Lcom/urbanairship/push/PushManager;"); IntPtr ipApid = JNIEnv.GetMethodID(?, "getAPID", "()Ljava.lang.String;"); / Thanks Gavin -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/JNIENV-Call-Syntax-tp5578767p5578767.html Sent from the Mono for Android mailing list archive at Nabble.com. ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid
Re: [mono-android] JNIENV Call Syntax
On Mar 19, 2012, at 8:56 PM, GavinBryan wrote: > I'm trying to make a call from c# to a Java library and can't figure out the > bits of JNIENV syntax You're on the right track... :-) > // This is the Java call I'm trying to make in C# > String apid = PushManager.shared().getAPID(); > IntPtr ipPushmanager = JNIEnv.FindClass("com/urbanairship/push/PushManager"); > IntPtr ipShared = JNIEnv.GetStaticMethodID(ipPushmanager , "shared", > "()Lcom/urbanairship/push/PushManager;"); These are both correct. > IntPtr ipApid = JNIEnv.GetMethodID(?, "getAPID", "()Ljava.lang.String;"); The getAPID() method is an instance method on com.urbanairship.push.PushManager (as that's the type that PushManager.shared() returns). Conveniently enough, this is also a type you already looked up. You do need to fix the signature though: IntPtr ipApid = JNIEnv.GetMethodID(ipPushmanager, "getAPID", "()Ljava/lang/String"); Which leaves invocation: IntPtr sharedInstance = JNIEnv.CallStaticObjectMethod(ipPushmanager, ipShared); var apid = Java.Lang.Object.GetObject( JNIEnv.CallObjectMethod(sharedInstance, ipApid), JniHandleOwnership.TransferLocalRef); // Not necessarily necessary, but a good practice JNIEnv.DeleteLocalRef(sharedInstance); Method invocation is done by one of the JNIEnv.CallStaticXxxMethod() or JNIEnv.CallXxxMethod() methods; Xxx depends on the return type of the method, and CallStatic XxxMethod() is for static methods while CallXxxMethod() is for instance methods. Thus we use JNIEnv.CallStaticObjectMethod() to invoke the PushManager.shared() static method (as it returns a java.lang.Object subclass), and we use JNIEnv.CallObjectMethod() to invoke the PushManager.getAPID() instance method (which likewise returns a java.lang.Object subclass). Finally we convert the value returned from JNIEnv.CallObjectMethod() into a Java.Lang.String instance by using the Java.Lang.Object.GetObject(IntPtr, JniHandleOwnership) method, which returns a value of type `T`. The JniHandleOwnership parameter specifies what kind of JNI handle the value is; in this case, it's a local ref (as that's what all JNIEnv.Call*ObjectMethod() methods return). As the comment suggests, JNIEnv.DeleteLocalRef(sharedInstance) _may_ not be necessary. The local reference table is limited to only 512 entries, but it's cleared upon returning to Dalvik code. If your method is short, it's _probably_ fine to skip this, but "better safe than sorry." - Jon ___ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid