Introduction In this article, we will learn how to create Dropdown in Xamarin.Forms (Xamarin.iOS). As we learned in the previous article ...

Dropdown control in Xamarin.Forms Dropdown control in Xamarin.Forms

banner_dropdown_part2

Introduction

In this article, we will learn how to create Dropdown in Xamarin.Forms (Xamarin.iOS). As we learned in the previous article about by default, Android Platform has dropdown called as “Spinner”, but iOS Platform has no dropdown like Android Spinner and how to achieve the dropdown in Xamarin.Forms for Android Platform using Custom renderer approach. In this article, we are going to create a custom renderer to achieve the dropdown for iOS platform in Xamarin.Forms.

Introduction: In this tutorial, we will learn how to implement Multi-Lingual in Xamarin.Forms without using external plugins or platfor...

Multilingual Implementation - Xamarin.Forms Multilingual Implementation - Xamarin.Forms



Introduction:

In this tutorial, we will learn how to implement Multi-Lingual in Xamarin.Forms without using external plugins or platform wise implementation with dependency service. The latest Xamarin forms offers .net standard to implement the multilingual and without further delay, we will skip into the coding part of the article.

Introduction In this tutorial, we will learn how to handle the Placeholder issue in Xamarin.Forms for Picker Control. Xamarin.Forms Picke...

Placeholder for Picker - Xamarin.Forms Placeholder for Picker - Xamarin.Forms

Introduction

In this tutorial, we will learn how to handle the Placeholder issue in Xamarin.Forms for Picker Control. Xamarin.Forms Picker Control is a combination of EditText plus AlertDialog for Android and UITextField plus UIPicker for iOS. The Title property of Xamarin.Forms Picker Control is a property to set title for AlertDialog plus Hint for EditText for Android and Placeholder for UITextField.

For Example, we are setting the title property of the picker control is “Title” and it has items source and selected index of the control as “-1” then the control will shows “Title” in Placeholder and title of the alert or popup. Sometimes, it is meaning less to use this control due to this.

Introduction: In this article, we will learn how to integrate and play a video using YouTube API in Android with Kotlin. YouTube Andro...

YouTube Player API in Android using Kotlin YouTube Player API in Android using Kotlin

Introduction:

In this article, we will learn how to integrate and play a video using YouTube API in Android with Kotlin.

YouTube Android Player API enables developers to incorporate or integrate video playback functionality into our own developed Android applications. Using this API, we can load and cue play videos. It has a built in play controls for controlling the video playback actions such as Play, Pause or Seek to a specific time/point in the current video. Our Android Phone must have the YouTube app. Because this API interact with service that is a part of YouTube app.


Introduction: In my previous article , we have learned How to handle “android.os.FileUriExposedException”, if we have an app that share...

How to use Camera API for Android N and above devices in Android How to use Camera API for Android N and above devices in Android


Introduction:

In my previous article, we have learned How to handle “android.os.FileUriExposedException”, if we have an app that shares files with other apps using an Uri on API 24+. In this article, we will learn “How to use Camera Intent in Android N above devices”.


In this article, we will learn how to download any files from online server and save the same to the local directory of the Android an...

How to download files in Xamarin.Forms How to download files in Xamarin.Forms

xfdownload
In this article, we will learn how to download any files from online server and save the same to the local directory of the Android and iOS Phones using DependencyService. Xamarin.Forms allows developers to define behaviour in platform-specific projects. DependencyService then finds the right platform implementation, allowing shared code to access the native functionality. To know more about DependencyService Click Here

A cross platform library that allows you to call for interactive alerts from a shared/portable library. Support: Android iOS Portable...

Interactive alerts for Xamarin Interactive alerts for Xamarin

A cross platform library that allows you to call for interactive alerts from a shared/portable library.

Support:

  • Android
  • iOS
  • Portable library
NuGet

Setup

InteractiveAlerts setup as Acr.UserDialogs.

iOS

The library configures.

Android Initialization (In your main activity)

InteractiveAlerts.Init(this);
OR InteractiveAlerts.Init(() => provide your own top level activity provider)
OR MvvmCross - InteractiveAlerts.Init(() => Mvx.Resolve<IMvxAndroidCurrentTopActivity>().Activity)
OR Xamarin.Forms - InteractiveAlerts.Init(() => (Activity)Forms.Context)

MvvmCross

Screenshots from Interactive alerts

iOS

Success Alert Error Alert Warning Alert Wait Alert

Android

Success Alert Error Alert Warning Alert Wait Alert

Powered by

  • Acr.UserDialogs - https://github.com/aritchie/userdialogs
  • iOS - https://github.com/vikmeup/SCLAlertView-Swift
  • Android - https://github.com/pedant/sweet-alert-dialog

Simple cross platform plugin to pick place using google maps with the help of Cross Platform API. Setup Available on NuGet: http://ww...

Cross Place Picker for Xamarin Android and iOS Cross Place Picker for Xamarin Android and iOS

Simple cross platform plugin to pick place using google maps with the help of Cross Platform API.

Setup

Platform Support

Platform Supported Version
Xamarin.iOS Yes iOS 7+
Xamarin.Android Yes API 15+

API Usage

Install-Package Fantacode.Plugin.CrossPlacePicker -Version 2.0.0

Call CrossPlacePicker.Current from any project or PCL to gain access to APIs.

Working

Calling PlacePicker Without Bounds
try
          {
              var result = await CrossPlacePicker.Current.Display();
              if (result != null)
              {
                  await DisplayAlert(result.Name, "Latitude: " + result.Coordinates.Latitude + "\nLongitude: " + result.Coordinates.Longitude, "OK");
              }
          }
          catch (Exception ex)
          {
              await DisplayAlert("Error", ex.ToString(), "Oops");
          }
With Bounds
try
      {
          var southWest = new Coordinates(85, -180);
          var northEast = new Coordinates(-85, 180);
          var CoordinateBounds = new CoordinateBounds(southWest, northEast);
          var result = await CrossPlacePicker.Current.Display(CoordinateBounds);
      }
      catch (Exception ex)
      {
          await DisplayAlert("Error", ex.ToString(), "Oops");
      }

Important Permission and Setup Information

Please read these as they must be implemented for all platforms.

Android

The ACCESS_FINE_LOCATION permission is required.
  • In your AndroidManifest.xml file, add your API key in a meta-data tag (ensure you are within the <application> tag as follows:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
      android:name=".MainApplication"
      ...>
    <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="YOUR_ANDROID_API_KEY_HERE"/>
    ...
</application>

iOS

You must request permission to use location services. First add one or both of the following keys to your Info.plist file, to request ‘when in use’ or ‘always’ authorization:
NSLocationWhenInUseUsageDescription
NSLocationAlwaysUsageDescription

For the place picker, it’s enough to request ‘when in use’ authorization, but you may want to request ‘always’ authorization for other functionality in your app. For each key, add a string informing the user why you need the location services. For example:
Such as:
<key>NSLocationWhenInUseUsageDescription</key>
<string>Show your location on the map</string>
If you want the dialogs to be translated you must support the specific languages in your app. Read the iOS Localization Guide
  • In your AppDelegate.cs file, import the Google Places library by adding using Google.Maps; on top of the file.
  • Within the FinishedLaunching method, instantiate the library as follows:
var apikey = "YOUR-API-KEY-HERE";
PlacesClient.ProvideApiKey(apikey);
MapServices.ProvideAPIKey(apikey);

Troubleshooting

Incase if the place picker is not launching or automatically being hidden, please make sure that you have generated API key from Google Developer Console. If you are facing any other problem, please open an issue with Application Output.
Google Signup and API Keys

Introduction In this article, we will learn how to parse an HTML page using jsoup in Xamarin.Android, just like we used jsoup in ...

HTML Parser In Xamarin.Android Using jsoup HTML Parser In Xamarin.Android Using jsoup


Introduction

In this article, we will learn how to parse an HTML page using jsoup in Xamarin.Android, just like we used jsoup in Native Java Android development.

jsoup

jsoup is a Java library for working with real-world HTML. It provides a very convenient API for extracting and manipulating the data, using the best of DOM, CSS, and jQuery-like methods.

jsoup for Xamarin.Android

In this article, we will see the Xamarin.Android binding or port Java jsoup and its implementations with the application. You can find the binding DLL of jsoup from GitHub or its package from NuGet

Coding Part

I have split this article into 3 steps.
Step 1 : Creating a new Xamarin.Android project.
Step 2 : Setting up the plug-in for Xamarin.Android application.
Step 3 : Implementing jsoup in Xamarin.Android application.

Step 1 - Creating new Xamarin.Android Projects
Create a new project by selecting New >> Project, and select Android App followed by a click on OK.

Xamarin
Step 2 - Setting up the plug-in for Xamarin.Android application
In this step, we will include the jsoup plug-in for Xamarin.Android Project. Open NuGet Package Manager against the project and do search for jsoup. Select the jsoup package from the list and click "Install" to add the library or paste the following in Package Manager Console to install the NuGet plugin.
Install-Package Jsoup -Version 1.0.0
Xamarin
Step 3 - Implementing jsoup in Xamarin.Android application
In this part, we will see how to implement Jsoup to parse an HTML page or link.
  • Open your MainActivity.cs and paste the following code.
    Document doc = Jsoup.Connect("https://androidmads.blogspot.in/").Get();  
    Element link = doc.Select("img").First();  
    link.AbsUrl("src");
  • Here, the document used to make the web page is given as a singles file or document.
  • Consist of Elements and TextNodes.
  • Document extended from Elements or Nodes and TextNodes are extended from Nodes.
  • In the above example, the page from https://androidmads.blogspot.in link is retrieved and assigned to Document.
  • Then the Image tagged Elements (<img />) are retrieved from the document and I have getting the first “img” tag using Select("img").First()”By default, doc.Select("img")” will returns the list of element or Elements.
  • Then, I have separated or retrieved the source of the image tag element using “link.AbsUrl("src")”.
  • The Jsoup Connections needed to be run with separate thread. So, I had done the call with AsyncTask. You can find the full code below.
Full code of the MainActivity.cs
The following code shows how to implement jsoup in Xamarin.Android with AsyncTask.
[Activity(Label = "JsoupSample", MainLauncher = true)]  
    public class MainActivity : Activity  
    {  
        TextView textView;  
        protected override void OnCreate(Bundle savedInstanceState)  
        {  
            try  
            {  
                base.OnCreate(savedInstanceState);  
  
                // Set our view from the "main" layout resource  
                SetContentView(Resource.Layout.Main);  
  
                textView = FindViewById(Resource.Id.HtmlTextView);  
                new JsoupServerCall(this).Execute();  
            }  
            catch (Exception ex)  
            {  
  
            }  
        }  
  
        private class JsoupServerCall : AsyncTask  
        {  
            MainActivity activity;  
            public JsoupServerCall(MainActivity activity)  
            {  
                this.activity = activity;  
            }  
            protected override Java.Lang.Object DoInBackground(params Java.Lang.Object[] @params)  
            {  
                Document doc = Jsoup.Connect("https://androidmads.blogspot.in/").Get();  
                Element link = doc.Select("img").First();  
                return link.AbsUrl("src");  
            }  
  
            protected override void OnPostExecute(Java.Lang.Object result)  
            {  
                base.OnPostExecute(result);  
                activity.textView.Text = result + "";  
            }  
        }  
    } 
Download Code
You can download the full source code from the Github.

A Tiny Font Utility Library for Xamarin.Android to apply custom Fonts to Toolbar NavigationView Menu Submenu Other Views like EditTex...

Font Utils Library for Xamarin.Android Font Utils Library for Xamarin.Android

A Tiny Font Utility Library for Xamarin.Android to apply custom Fonts to

  • Toolbar
  • NavigationView
  • Menu
  • Submenu
  • Other Views like EditText, TextView, etc.

Supported Android Languages

  • Java
  • Kotlin
  • Xamarin

Readme for Java and Kotlin can be found here https://github.com/androidmads/FontUtils.

How to download

You can download the plugin from Nuget Package Manager using

Install-Package XAFontUtils -Version 1.0.1

How to use

The following code are used to implement the library in Xamarin.Android
// To import the Library
using XAFontUtilsLibrary;
...
// Applying Custom Font
Typeface typeface = Typeface.CreateFromAsset(Assets, "custom_font.ttf");
// Init Library
FontUtils fontUtils = new FontUtils();
// Apply font to Toolbar
fontUtils.ApplyFontToToolbar(toolbar, typeface);
// Apply font to NavigationView
fontUtils.ApplyFontToNavigationView(navigationView, typeface);
// Apply font to Menu
fontUtils.ApplyFontToMenu(menu, typeface);
// Apply font to Other Views like TextView...
fontUtils.ApplyFontToView(textview, typeface);
fontUtils.ApplyFontToView(editText, typeface);
fontUtils.ApplyFontToView(radioButton, typeface);
fontUtils.ApplyFontToView(checkBox, typeface);

Github Link

You can download the code from GitHub and it is open sourced.

License

It is Licensed under MIT License. You can find that here.