FAQ Database Discussion Community


Getting a switch Checked event to fire in the same way as a Click event with mvvmcross

c#,xamarin,monodroid,mvvmcross
I've got an mvvmcross project for Android in development and have recently changed part of the UI to have a switch instead of a button to remove an item from a wish list. By default, the switch is set to On. In the button version, when the button is pressed,...

How To Create a Vertical SeekBar in Xamarin?

android,xamarin,monodroid,xamarin-studio
I am using Xamarin Free Version and I am trying to Create a Seek Bar the following The Seek bar will be white with a white thumb and the golden box next to it is content Link to image: http://s8.postimg.org/gpt6ao5xh/Veritcal_Seek_Bar.jpg The only thing is that there will be 6 SeekBars...

Udp reads empty bytes after first time - mono andoid

c#,android,xamarin,monodroid
On my Xamarin.Android app I'm sending udp broadcast message to find my servers on the local LAN. My servers then return the MachineName they run on which I display in a ListView on my app in the form of <MachineName> - <Ip address> This all works well on the first...

How to resolve System.NullReferenceException: Object reference not set to an instance of an object in xamarin android

android,file,xamarin,monodroid,nullreferenceexception
I am facing this issue in this code line - File videofiles=new File(App._file.AbsolutePath); guys please help me out ths issue .thanks in advance. Exception Log System.NullReferenceException: Object reference not set to an instance of an object at VRecorder.MainActivity.deleteVideo () [0x00001] in e:\workspace\VRecorder\VRecorder\MainActivity.cs:91 at VRecorder.MainActivity.<OnCreate>b__1 (object,System.EventArgs) [0x00001] in e:\workspace\VRecorder\VRecorder\MainActivity.cs:49 at Android.Views.View/IOnClickListenerImplementor.OnClick...

MvvmCross android binding to fragment

xamarin,monodroid,mvvmcross
is there any way to bind in layout directly to custom fragment? ie: <fragment android:id="@+id/AwesomeFragment" android:layout_width="match_parent" android:layout_height="match_parent" local:MvxBind="CustomTarget PropertyInVM;" class="My.Awesome.Fragment" /> CustomTarget is CustomTargetBinding...

NavUtils.NavigateUpFromSameTask in Xamarin.Android

android,xamarin,monodroid
This is the host activity: [Activity(Label = "CrimePagerActivity")] [MetaData("android.support.PARENT_ACTIVITY", Value = "CriminalIntent.CrimeListActivity")] public class CrimePagerActivity : FragmentActivity This is the fragment hosted by CrimePagerActivity: public class CrimeFragment : Android.Support.V4.App.Fragment and try { if (NavUtils.ParentActivity != null) NavUtils.NavigateUpFromSameTask(Activity); } then get an error message: System.NotSupportedException: Unable to activate instance of type...

Why is my DrawerLayout still open on activity resume, in spite of closing it?

android,monodroid,android-navigation
I have a DrawerLayout which contains a ListView of items that link to other Activities. The OnItemClick event of the ListView is a switch-case for each menu element, which runs the code ... case targetActivity: listViewInstance.ClearChoices(); drawerInstance.CloseDrawer(MainMenuLayout); drawerInstance.RequestLayout(); StartActivity(targetIntent); break; ... This works mostly as expected, but if I change...

Error when writing a class extending View in android

android,xamarin,monodroid
I am new to xamarin. I have created a demo in xamarin Android. While trying to write a class extending the View class I got an error that the View does not have default constructor. But I have not writted default constructor at all. All I have done is written...

UsbDeviceConnection ControlTransfer() returns -1

android,xamarin,monodroid,usbserial
I've been writing an application to communicate with a CP2102 usb to serial chip in xamarin android. I can succssesfully grant premission to open the device and claim the interfaces. After I open the device I use these lines of code to claim the interface and get the endpoints: for...

Xamarin Forms Android Error: Please install package 'Android Support Library'

xamarin,monodroid,android-support-library,appcompat,xamarin.forms
I recently uploaded my project to Git, and used a auto-generated Xamarin/Windows/MacOS/VisualStudio .gitignore file. I did a lot of work and testing on iOS, but now I'm coming back to android but upon building the Project.Droid version, I get the following errors: Error 11 Please install package: 'Android Support Library'...

Camera Preview and OCR

xamarin,monodroid,android-camera,ocr,tesseract
I am new to android development - I'm using Xamarin. I am trying to write an application that initiates the camera preview, and then constantly scans the incoming frames for text (I am using Xamarin.Tesseract from NuGet). In other words, I don't want to make the user take a photo...

add a soap header in C#

c#,web-services,xamarin,monodroid,xamarin.forms
I am building an Xamarin.forms App for android where we are consuming third party webservices. I have created the proxy and I can see the methods exposed by the service. But I cannot access the methods of the service as I have to add header to my SOAP request which...

Unable to register push notification templates with Xamarin Azure Messaging component on Android

android,xamarin,push-notification,monodroid,azure-notificationhub
I have a Xamarin Android app that is using Azure Notification Hubs with the Xamarin Azure Messenging component. If I just register the device with some tags, based on the sample code, everything works correctly. If I register the device with a named template, the registration method throws a NotificationHubException...

Xamarin.Forms Dependency Service ActivityNotFoundException: No Activity found to handle Intent

android,xamarin,monotouch,monodroid,xamarin.forms
I'm using Xamarin.Forms Dependency Service to make a phone call in my PCL. The method itself is : public void Call(string number) { var uri = Android.Net.Uri.Parse(number); var intent = new Intent(Intent.ActionView, uri); Forms.Context.StartActivity(intent); } Method call: DependencyService.Get<IPhoneDialler>().Call("+447836726414"); Using it throws Android.Content.ActivityNotFoundException: No Activity found to handle Intent Same approach...

Xamarin.Android: item previously inserted in ArrayAdapter is not found again

xamarin,monodroid,android-arrayadapter
I've inherited this Xamarin.Android app and it has a few issues. A particular bug involves an ArrayAdapter<ProductListObject>, where ProductListObject is a common POCO that's shared between subprojects (i.e. Android, Windows Phone and iOS); it just has a couple of properties (e.g. an Id) and overrides the (.NET) Equals() method to...

Missing assembly reference Microsoft.IdentityModel.Clients.ActiveDirectory

c#,xamarin,monodroid,azure-active-directory,assembly-references
I'm currently developing a Xamarin.Android application in VS2013. I want to implement Azure Active Directory in my app following this guide. Then I add Microsoft.IdentityModel.Clients.ActiveDirectory nuget package as described. Then I want to add an AuthenticationResult attribute, but then I got a missing assemble reference error. Even when I explicitely...

Display complex Html text in android like gmail

android,html,webview,textview,monodroid
Hi i have to display html text with its style property, i tried both textview and webview . when i use textview with Html.fromHtml("html text ") its showing only text without html style and other hand when i use webview the whole content display in single line with horizontal scroll...

Populating a list of songs with Album Art - Not able to get Album art

xamarin,monodroid,mediastore,albumart
I'm currently building a music browser/player of the music on a the device. I sucessufully populated the a listview with the names of the songs and their artist but I'm not able to show the albumart associated with the song. I'm not quite sure what is the correct path to...

Xamarin: How to print from Android device to dot matrix printer?

c#,android,xamarin,monodroid
I have the following hardware: Dot matrix printer: LX 300-II. Android device with Android version 4.2.2. Connection type: USB, Wi-FI, Bluetooth. I have an Android Activity that create an invoice, so I want to print some text on printer. But I can't make it work. I tried using USBManager with...

Alternative to multi-binding and converters?

c#,.net,xamarin,mono,monodroid
I'm looking for an alternative for two reasons: Multi-binding and converters are not available for Xamarin.Android (correct me if I'm wrong). Binding requires atleast one side to be a dependency property (which sucks). I'll try to explain what I want through code: Given classes Foo and Bar: class Foo {...

Geocoder class gives wrong coordinates and won't parse coordinates to get street address. Xamarin

android,google-maps,xamarin,monodroid
I typed in the code from http://developer.xamarin.com/recipes/android/os_device_resources/gps/get_current_device_location/ and I keep getting the coordinates for the Xamarin office in San Francisco as my current location when I run the app. I have installed the Google Maps apk on my Nexus 4 (KitKat) API 19 emulator and Google Maps displays my current...

How to grant permission to open usb device with usb manager? openDevice() always returns null

android,xamarin,monodroid,android-usb
I want to use a usb device in the following code. It successfully lists the usb devices and iterates over them. In the following code the object "device" is the usbdevice that i need to open. Everything seems Ok except the OpenDevice() method that always returns a null value! [Activity(Label...

NullPointerException while trying to replace a fragment

android,android-fragments,xamarin,monodroid,mvvmcross
I am getting a javga.lang.NullPointerException while trying to replace a Fragment in my Activity. I use a FrameLayout as my host for the fragment to be placed in dynamically based on button clicks. Exception Stacktrace: [AndroidRuntime] Shutting down VM [AndroidRuntime] FATAL EXCEPTION: main [AndroidRuntime] Process: com.data3s.eluzzionnative, PID: 1595 [AndroidRuntime] java.lang.NullPointerException...

Re-use azure mobile service client across activities

c#,xamarin,monodroid,azure-mobile-services
I've been working with Azure Mobile Services and Xamarin Android and I'm currently stumped on how to re-use a mobile service client. Every Xamarin Android example I've seen uses a single activity that creates a new reference to a client. I would like to create a reference to the client...

Exception when launching activity from PreferenceScreen

android,xamarin,monodroid,android-preferences
I'd like to launch an activity from a preference screen. This already did work in the past and I haven't changed any code but updated the Android SDK (updated packages and installed new ones) and since then it doesn't work anymore. I get an exception that the activity could not...

HttpClient - Xamarin Android - MvvmCross

android,xamarin,monodroid,mvvmcross,dotnet-httpclient
I've been developing an application for Android using Xamarin with MvvmCross and everything has been going fine, me and my team were able to develop the solution and this week we decided to make the final adjustments and to test the application in other environments. During the tests I had...

Xamarin.Forms: Start an activity using DependencyService

c#,android-activity,xamarin,monodroid,xamarin.forms
In my Xamarin.Forms.Page I have a DependencyService that must activate an activity in my .Droid project. How do I activate the Activity? I've tried StartActivity(typeof(FacebookActivity)); but I get Java.Lang.NullPointerException: Exception of type 'Java.Lang.NullPointerException' was thrown. What do I have to initialize? ...

Update Google Maps marker with long polling without blocking UI

xamarin,monodroid,google-maps-markers
I have a Google Map (MapFragment) with more than 5 markers on it. I want to update the position of markers for every 10-15 seconds. I will be getting new co ordinates via a API call. Is there any way we can update the markers without blocking the UI? Sample...

Xamarin.Android ViewPager with only ImageViews

c#,android,xamarin,monodroid
I'm trying to make a ViewPager containing only ImageView. But it keeps giving me errors on this line. ((ViewPager)collection).AddView (i); System.InvalidCastException: Cannot cast from source type to destination type. Here is my ViewPagerAdapter public class GalleryAdapter : PagerAdapter { Context context; private List<string> mitems; public GalleryAdapter (Context c, List<string> items)...

How to use CheckBox in the menu in Android?

android,xamarin,monodroid
I am new to Android. I want to use a checkbox in the menu which has to be checked and unchecked while the user touching. And I need to perform some actions if the check box is checked. Right now I have a checkbox that is checked when the program...

InvalidCastException in release when casting TextFormatted to ISpannable or ISpanned

c#,android,xamarin,monodroid
This question is the same but it doesn't seem to answer the question as to why this cast fails in release mode but works in debug. The Android docs specify: Return the text the TextView is displaying. If setText() was called with an argument of BufferType.SPANNABLE or BufferType.EDITABLE, you can...

Visual Studio + Xamarin: Create database SQLite

c#,android,sqlite,monodroid
I'm trying create a database on my application (Xamarin.Android). I'm using this tutorial http://developer.xamarin.com/recipes/android/data/databases/sqlite/ but the site don't explicate about parameter to path on private string createDatabase(string path) { try { var connection = new SQLiteAsyncConnection(path);{ connection.CreateTableAsync<person>(); return "Database created"; } catch (SQLiteException ex) { return ex.Message; } } Can...

Xamarin.Android and Parse

c#,parse.com,xamarin,monodroid
I am writing an app with C# and Xamarin.I am using Parse at the backend.I am currently stuck at point where when a user clicks signup button my app checks for a user with same phone number in parse database.Ideally If app finds app makes a toast of "cannot signup".If...

Bind IBitmap to ImageView

xamarin,monodroid,reactiveui
I try to bind an IBitmap in my ViewModel to an ImageView in an AndroidActivity. The basic bind does not work and asks me to register an IBindingTypeConverter for that: class BitmapToImageViewConverter : IBindingTypeConverter { public int GetAffinityForObjects(Type fromType, Type toType) { return (fromType == typeof (IBitmap) && toType ==...

xamarin.forms.labs ImageButton issue

xaml,xamarin,monodroid,xamarin.forms
I am using Xamarin.Forms and a Monodroid project. I use Xamarin.Forms.Labs to render an ImageButton control. Everytime I try to render the control in xaml I get this exception: System.TypeInitializationException: An exception was thrown by the type initializer for Xamarin.Forms.Labs.Controls.ImageButton ---> System.MissingMethodException: Method 'BindableProperty.Create' was not found. Here is the...

Show Dialog Fragment in Fragment

android,xamarin,monodroid
How show MvxDialogFragment in MvxFragment. Can not use FragmentMaganer and other solution. No Work public void ShowFragmentLatestInvoices() { var transaction = FragmentManager.BeginTransaction(); var Manager = FragmentManager.BeginTransaction (); LatestInvoicesFragment LatestInvoicesFragment = new LatestInvoicesFragment(); LatestInvoicesFragment.DataContext = ViewModel.InvoiceVM; LatestInvoicesFragment.Show(SupportFragmentManager, "LatestInvoices_fragment"); OnAttachFragment (LatestInvoices); } ...

Integrating xamarin, CouchBaseLite, MVVMCross and SyncGateway such that View changes with database

xamarin,monodroid,mvvmcross,couchbase-lite,couchbase-sync-gateway
I am working on a xamarin project where i use CouchBase Lite as my Local database. I also want to use MVVMCross library. Could anyone specify where should i include couchbase-Lite library, MVVMCross - hot tuna library(like class library or portable class library or platform specif project) such that view...

Issue with android class library resources after updating xamarin

xamarin,monodroid,portable-class-library
After updating to the newest release from xamarin I am experiencing some issues regarding resources. We have a android class library which contains our core android app features, e.g activities, android resources(default Icons and so forth). This is referenced by multiple android projects each containing their own android resources for...

Floating Action Button in Xamarin.Forms

android,xamarin,monodroid,xamarin.forms,floating-action-button
I had completed my App's home page in Xamarin.Forms Portable. Now i want to add a Flotation Action Button In my Android Project ! Is there any way to add FAB for Android in my existing home page, which was coded in Xamarin.Forms Portable. OR I want to create a...

How to save to more JSON data to a already created file?

c#,xamarin,monodroid
So i followed this tutorial here: http://developer.xamarin.com/recipes/ios/general/file_system/save_documents/ and everything works fine but the only thing is that once a file is created that has JSON saved to it i want to be table to add a some more JSON data right now i am using JSON.net to Serialize my data...

What's the proper way to implement Fragments in MvvmCross 3.5.1

android,android-fragments,xamarin,monodroid,mvvmcross
After upgrading from 3.5 to 3.5.1 I am getting errors inflating Fragments in my Xamarin.Android project. Unable to start activity ComponentInfo{xxx.xxx/md51537e9497dba76724980c8d1dff85301.MyView}: android.view.InflateException: Binary XML file line #1: Error inflating class fragment Caused by: android.app.Fragment$InstantiationException: Trying to instantiate a class md51537e9497dba76724980c8d1dff85301.LoginView that is not a Fragment What is causing this error?...

how to put a private use character in string with xamarin

c#,fonts,xamarin,monotouch,monodroid
I want to use some icons from the metro font (http://metroui.org.ua/font.html) on my Xamarin project, I can't find a solution to put a character in private use on my string, it's always replace by a square with a ? inside. If anyone know how I can put special character, it...

AndroidChromecastSDK (Xamarin Bindings) : Getting the RemoteMediaPlayer.MediaStatus always return null

c#,monodroid,google-play-services,chromecast
I'm developping a custom sender application for chromecast in C# using Xamarin. At this point, I can send MediaInfo to the receiver app and play a song correctly on my TV. The problem I have is when I try to stop the RemoteMediaPlayer. Calling Stop() on the player returns a...

HackyViewPager in Xamarin.Android

android,xamarin,monodroid
I'm trying to convert this HackyViewPager for PhotoView into a version for Xamarin.Android, but I can't now wrap my head around on how to. Here is the HackyViewPager class that extends ViewPager public class HackyViewPager extends ViewPager { private boolean isLocked; public HackyViewPager(Context context) { super(context); isLocked = false; }...

How to get instance of ActivityManager in Xamarin?

android,xamarin,monodroid
To check if the application is in foregraound or background i am trying to access ActivityManager as per below. ActivityManager activityManager = GetSystemService(Context.ACTIVITY_SERVICE) as ActivityManager; List<RunningAppProcessInfo> appProcesses = activityManager.getRunningAppProcesses(); foreach(RunningAppProcessInfo appProcess in appProcesses){ if(appProcess.importance == RunningAppProcessInfo.IMPORTANCE_FOREGROUND){ Log.i("Foreground App", appProcess.processName); //SetNotification (); } } But I am getting compliation error as...

Xamarin Android: ActionBar SearchView ActionView returns null

android,xamarin,monodroid,xamarin-studio
I'm using the ActionBar menu as: <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/menu_search" android:actionViewClass="com.abc.AppSearchView" android:icon="@drawable/ic_menu_search" android:showAsAction="always|collapseActionView" /> </menu> Then I inflate it and : public override bool OnCreateOptionsMenu (IMenu menu) { MenuInflater.Inflate (Resource.Menu.actionMenu, menu); _actionBarMenu = menu; // Get the SearchView and set the searchable configuration var searchManager =...

Finding all identifiers containing part of the token

c#,android,monodroid
I know I can get a string from resources using Resources.GetIdentifier(token, "string", ctx.ApplicationContext.PackageName) (sorry, this is in C#, it's part of a Xamarin.Android project). I know that if my elements are called foo_1, foo_2, foo_3, then I can iterate and grab the strings using something like var myList = new...

Xamarin.Android using async method on background thread causes screen flash

c#,android,android-asynctask,monodroid,async-await
So I'm trying to create a loading/splash screen for an app that I'm creating. Basically, if the user isn't authenticated, then they shouldn't be able to access the other parts of the app. Additionally, I'd like the app to attempt to sync the necessary database objects before it loads up...

namespace prefix “myapp” is not defined in Xamarin While Building App?

android,xamarin,monodroid,xamarin-studio
I want to build a Toolbar in Xamarin app. When i want to create a menu it shows me error saying that "namespace prefix "myapp" is not defined". Here is code. <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res/android-auto"> <item android:id="@+id/action_reply" android:icon="@drawable/ic_action_reply" android:title="Reply" myapp:showAsAction="always" /> <item android:id="@+id/action_undo" android:icon="@drawable/ic_action_undo" android:title="Undo"...

Can't find native method using JNI error when specifying propertyName in ObjectAnimator

android,xamarin,monodroid
I'm trying to do sliding fragments, as in this code: https://github.com/lucamtudor/Sliding-Fragments However, when ported over to Xamarin, it gives the error: 01-26 18:07:10.943 D/PropertyValuesHolder(17296): Can't find native method using JNI, use reflectionjava.lang.NoSuchMethodError: no method with name='setYFraction' signature='(F)V' in class Ltestappandroid/FractionalLinearLayout; 01-26 18:07:10.943 E/PropertyValuesHolder(17296): Couldn't find setter/getter for property yFraction with...

MvvmCross - MvxBind:Warning Failed to create target binding for binding Hello for -empty-

c#,android,xamarin,monodroid,mvvmcross
I'm just starting my first Xamarin application and have gotten things setup pretty much as the default configuration of a new solution with very minimal changes. The application compiles fine and deploys to the Virtual Device fine as well. MvxBindingAttributes.xml <?xml version="1.0" encoding="utf-8"?> <resources> <declare-styleable name="MvxBinding"> <attr name="MvxBind" format="string"/> <attr...

Can Xamarin create an object instance by class name?

monotouch,xamarin,monodroid
In Xamarin Android, is it possible to create an instance of an object from the class name? For example if my class is Foo, I would like to do this: ObjectHandle handle = (Foo)System.Activator.CreateInstance(null, "Foo"); Foo foo = (Foo)handle.Unwrap(); foo.PartyOn(); The class Foo is in the same project (the main...

Protecting Local SQLite Database (Android Application)

android,sqlite,security,monodroid
We have an Android application which stores its data in a local SQLite database; primarily for performance, but also to allow for working off-line (as we are often in areas with low signal). At the moment, the data is stored in encrypted format (passed down from our web servers), but...

MVVMCross Custom Control and Binding

xamarin,monodroid,mvvmcross
I have created a custom control (CustomCard) which is a subclass of the CardView control. I would like to use this control within my project in different places. For example, I may place the CustomCard within an xml layout manually, or I may want the CustomCard to be an item...

Listview adapter in a ViewPager in a fragment - How to get the Activity

listview,xamarin,android-viewpager,monodroid
I'm trying to build a music browser/player of the local files on the devices using a CursorLoader. I'm using Xamarin android, c#. I'm using a ViewPager which is within a Fragment (not FragmentActivity, since the fragment is part of a Navigation Drawer). I'm having trouble with the listView.Adapter which is...

Can't start activities marked as MainLauncher in parallel

c#,android,xamarin,monodroid
I'm working on a Xamarin Android project where I'd like to have activities as different starting points (e.g. app1 and app2). To achieve this I've added the option "MainLauncher = true" to the Activity-Attribute of those activities which seemed to work fine in the beginning: [Activity( Label = "App1", Icon...

When making requests with parse an exception is thrown with the message “This header must be modified with the appropiate property.”

parse.com,monotouch,xamarin,monodroid
I'm working on a project with a parse backend. I have run into an issue where I always get an exception when making requests on Android. [mono] System.ArgumentException: This header must be modified with the appropiate property. [mono] at System.Net.WebHeaderCollection.CheckRestrictedHeader (System.String headerName) [0x00000] in :0 [mono] at System.Net.WebHeaderCollection.Set (System.String name,...

Multiple Views for single ViewModel (iOS)

ios,monotouch,xamarin,monodroid,mvvmcross
I am aware that in order to achieve this, I need to create a custom presenter and map the ViewModel to my Views manually by overriding the InitializeViewLookup method. I successfully did this on Android and so far it works fine, but I can't seem to do it on iOS....

Hide softkeyboard in Xamarin

c#,android,xamarin,monodroid,xamarin.forms
How do I hide the softkeyboard for showing up when focusing an Entry in Xamarin.forms portable forms project? I assume we have to write platform specific renderers for that, but the following does not work: I create my own entry subclass: public class MyExtendedEntry : Entry { } and then...

Google Maps URLs showing up blank in Xamarin webview on Android

android,ios,webview,xamarin,monodroid
I'm not trying to use the Google Maps API, just trying to display a standard Google Map URL in a webview inside of my app. For example - https://www.google.com/maps/place/Disneyland+Park,+1313+Disneyland+Dr,+Anaheim,[email protected],-117.918974,17z/data=!4m2!3m1!1s0x80dcd7d12b3b5e6b:0x2ef62f8418225cfa When I load that URL, I just get a blank page (works properly on iOS). I've been researching for a couple...

MvvmCross Popup Window

c#,xamarin,monodroid,mvvmcross
I would like to have a popup window. Even though I am using MvvmCross, it will strictly run on Android. In Windows Store, you can do the following with xaml: <Popup VerticalOffset="300" HorizontalOffset="200" x:Name="SigPopup" > <Border BorderBrush="{StaticResource ApplicationForegroundThemeBrush}" Background="{StaticResource ApplicationPageBackgroundThemeBrush}" BorderThickness="1"> <StackPanel> <StackPanel Orientation="Horizontal" > <Button x:Name="btnAccept" Content="Accept" Click="btnAccept_Click"/> <Button...

Passing a portable Class to an Activity with Xamarin's Mono for Android

c#,android,xamarin,monodroid
I'm developing an app with Xamarin which will be released on Windows Phone, iOS and Android. This project includes a fair amount of portable code which is used in all three versions. Currently I'm working on the Android app and have run into an issue - I need to pass...

is possible to convert any code in native android to xamarin.android ?

xamarin,monodroid
I was a Android developer and now I am studying Xamarin , but I always ask myself "can I convert all android(ios) code to xamarin.android(xamarin.ios) ?" because I know c# is similar to java . However , they still have a few differnt syntax . Someone can help me answer...

How to handle an event that is trigged by a button from inside of a listadapter item?

android,xamarin,monodroid
Suppose we have a list with several items. Each item has several fragments and a label within. When a user clicks on each label I need to change the text of the button1 that is out of the list view. How can I receive that label click event from inside...

How to get Bit Depth of a Bitmap on Mono For Android

bitmap,monodroid,android-bitmap
In .NET one way to check the bitdepth of a Bitmap image is using the Bitmap class like so: switch (bitmap.PixelFormat) { case System.Drawing.Imaging.PixelFormat.Format1bppIndexed: return 1; case System.Drawing.Imaging.PixelFormat.Format4bppIndexed: return 4; case System.Drawing.Imaging.PixelFormat.Format8bppIndexed: return 8; case System.Drawing.Imaging.PixelFormat.Format16bppArgb1555: case System.Drawing.Imaging.PixelFormat.Format16bppGrayScale: case System.Drawing.Imaging.PixelFormat.Format16bppRgb555: case...

Android contextual action bar displays incorrect

android,xamarin,monodroid
I use Appcompat v21.0.3.0 On Genymotion (Android 4.0.5), Samsung GT-I8730 (4.1.2) and Sony Xperia Z3 (5.0.2) contextual action bar displays as expected. But on Samsung Galaxy Note 2 (4.4.2) and Samsung Galaxy S4 (4.4.4) it displays strange. What could be causing this?...

Application can't run in Samsung S6

c#,android,xamarin,monodroid
I have a Xamarin.Android App compiled and packaged. It works on any device Blu Dash 3.5, Samsung S5 and inferior, Hummer, etc. In Xamarin Studio I go to Options --> Application Build --> Advanced --> Supported ABIs and mark all of them: armeabi armeabi-v7a x86 arm64-v8a x86_64 So, I put...

WebRequest not working with ssl on Xamarin.Forms, despite servicePointManager hack

mono,monotouch,xamarin,monodroid,xamarin.forms
I am writing an application that needs to read from a REST api that is only available over https. I am running into the issue where the request fails in Mono.Security, with the message: "The authentication or decryption has failed." I did my research and found that Mono by default...

FragmentManager crashes when using Replace

android,android-fragments,xamarin,mono,monodroid
I have an Activity and few Fragments. I have to replace fragment in FrameLayout. But when I'm using this function my app crashes. Here is the code of function Android.Support.V4.App.Fragment fragment = null; switch (position) { case 0: fragment = new ScheduleFragment(); break; case 1: fragment = new MainFragment(); break;...

Correct way to store encryption key for SqlCipher database

c#,android,xamarin,monodroid,sqlcipher
I have a Xamarin application and have managed to download my data from my server to my device. I have also got it set up so that it can take a SqlCipher Encryption key to encrypt the data. My question is where is the correct location to store my key...

How to send POST request in Xamarin?

c#,android,xamarin,monodroid
I've built my backend in rails. My email address is "[email protected]" and it's already registered. The password is "28902890" here After giving the following command in terminal curl -v -H 'Content-Type: application/json' -H 'Accept: application/json' -X POST https://auth-agdit.herokuapp.com/api/v1/sessions -d "{\"user\":{\"email\":\"[email protected]\",\"password\":\"28902890\"}}" I get this response from my backend, {"success":true,"info":"Logged in :)...

ViewPager/PagerAdapter shows all views on first page

c#,android,android-viewpager,monodroid,android-pageradapter
What's happening The ViewPager in my app shows all views I instantiated on page one. If I instantiate two views for example, both views are shown in page one, and the second page is just blank. Images showing the problem As you can see below, page one contains both pages...

How to fix missing method exception in Xamarin.Forms PCL Android mobile app

xamarin,monodroid,xamarin.forms
I'm getting a System.MissingMethodException error after updating Xamarin.Forms package for Android Mobile App. In MainActivity.cs line #22: LoadApplication (new App ()); Application Output: [] Missing method Android.Runtime.JNIEnv::StartCreateInstance(Type,string,JValue*) in assembly Mono.Android.dll, referenced in assembly /storage/emulated/0/Android/data/XAMLDataBindings_PCL.Droid/files/.__override__/Xamarin.Android.Support.v4.dll I have tried Clean & Rebuild All as mentioned on the Xamarin forum but still not...

android binding library protected members

android,xamarin,monodroid,xamarin-studio
I added binding library. It contains different packages and default onlly one of them was visible in my xamarin application. I did some changes in metadata.xml: <metadata> <attr path="/api/package[@name='kr.co.bluebird.android.bbapi.client']/class[@name='BBAPI_Client']/method[@name='BBAPI_Client']" name="visibility">public</attr> <attr path="/api/package[@name='kr.co.bluebird.android.bbapi.client']/class[@name='BBAPI_Client']/method[@name='startService']" name="visibility">public</attr> <attr...

Binding to DataModel in MVVMCross

xamarin,monodroid,mvvmcross
I have done the intro tutorial online and it works. My question is how does Mvvmcross know which View to associate with the ViewModel? There is nothing I can see in the code where they reference each other.

ViewPager fragments created but not beeing displayed on Android <= Jellybean

android,android-viewpager,fragment,monodroid,android-4.2-jelly-bean
I have the following layout: <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.v4.widget.DrawerLayout android:id="@+id/drawerLayout" android:layout_width="match_parent" android:layout_height="match_parent"> <FrameLayout android:id="@+id/parentLayout" android:layout_width="match_parent" android:layout_height="match_parent"> <FrameLayout...

Losing data/files after app closes Xamarin Forms

c#,xamarin,monodroid,xamarin.forms
I am developing a crossplatform app with Xamarin and got stuck with this problem. Every time I launch my app, all the data I had saved before is lost. To give more details, I am using SQLite to persist some information and even storing some image files in the app's...

How to hide out a layout in Xamarin.forms C#?

c#,android,monodroid,xamarin.forms
I have a Stacklayout with switch control, when the switch values are true i have to show the layout and if the value changes to false i have to hide the layout. Based on some samples, i saw how to hide out a button but for hiding out a layout...

XmlDocument saving the file incompletely

c#,xml,xamarin,monodroid,xmldocument
I have a simple code which modifies an existing XML file as follows: roomsfile = new File(Path.Combine(rootDir, "rooms.dat")); XmlDocument roomdata = new XmlDocument(); roomdata.Load(roomsfile.AbsolutePath); XmlElement root = roomdata.DocumentElement; XmlNode roomNode = roomdata.CreateElement("room"); XmlNode noNode = roomdata.CreateElement("no"); XmlNode nameNode = roomdata.CreateElement("name"); //roomNo and roomName are text fields noNode.InnerText = roomNo.Text; nameNode.InnerText...

Scroll programmatically to the bottom of an expandablelistview with big content in last item

android,android-listview,xamarin,monodroid,expandablelistview
I'm trying to scroll to the bottom of an expandablelistview programmatically. Every other thread in SO points to either: var groupPosition = listView.ExpandableListAdapter.GroupCount - 1; var childCount = (listView.ExpandableListAdapter as MyAdapter).GetChildrenCount (groupPosition); listView.SetSelectedChild (groupPosition, childCount, false); or: var groupPosition = listView.ExpandableListAdapter.GroupCount - 1; listView.SetSelectedGroup (groupPosition); These work great if your...

Xamarin Tesseract OCR binding for Android

xamarin,monodroid,ocr,tesseract
I would like to use tesseract ocr for Xamarin.Android and Xamarin.iOS applications. I found the binding for iOS (https://github.com/jherby2k/Xamarin-Tesseract-OCR-iOS-Unified). Is there an equivalent for Android ?...

Xamarin MonoDroid does not support running the previous version

android,visual-studio-2013,xamarin,monodroid
I have just installed the Xamarin tools, installation went without any errors. I have launched VS 2013 Update 4 Pro and created Blank App ( Native Shared ). I did not modify code or project structure, just tried to run. So i have changed the Startup Project to Adnroid project:...