Showing posts with label Xamarin.Forms. Show all posts

Introduction: In this tutorial, we will learn how to perform MVVM approach in Xamarin.Forms using Fresh MVVM. MVVM approach is the b...

Master Detail Page in Xamarin.Forms using Fresh MVVM Master Detail Page in Xamarin.Forms using Fresh MVVM

A blog about android developement

Xamarin.Forms


Introduction:

In this tutorial, we will learn how to perform MVVM approach in Xamarin.Forms using Fresh MVVM. MVVM approach is the best approach for Xamarin.Forms and WPF Applications. There are a lot of MVVM plugins or libraries like FreshMVVM, MVVMCross, Prism, etc. available to simplify MVVM implementations.

FreshMVVM:

FreshMVVM is designed to perform MVVM easy and simple with Xamarin.Forms Application. It is created Michael Ridland. It has certain rules to perform MVVM Databinding. You can find the plugin from GitHub and Nuget.

Kindly refer my previous article on Fresh MVVM to know the basics & rules of Fresh MVVM.

Coding Part:

Steps:
I have split this part into 3 steps as in the following.
  1. Creating new Xamarin.Forms Projects.
  2. Setting up the plugin for Xamarin.Forms Application.
  3. Implementing Fresh MVVM.

Step 1: Creating new Xamarin.Forms Projects

Create New Project by Selecting New -> Project -> Select Xamarin Cross Platform App and Click OK.
Then Select Android and iOS Platforms as shown below with Code Sharing Strategy as PCL or .Net Standard and Click OK.

Step 2: Setting up the plugin for Xamarin.Forms Application

We will start coding for Fresh MVVM. Create New Xamarin Forms Project. Open Nuget Package Manager against the solution and do search for Fresh MVVM Plugin or Paste the following Nuget Installation.
Install-Package FreshMvvm -Version 2.2.3
Click Install to install this Plugin against your PCL Project or .NET standard Project.

Step 3: Implementing Fresh MVVM.

  1. Create your XAML page (view) with name ended up with “Page”.
  2. Create PageModel by create Class name ended with “PageModel” and inherited with “FreshBasePageModel” as shown below screenshot.
  3. In the same way, I have created two pages “Detail1Page” and “Detail2Page” with two respective page models “Detail1PageModel” and “Detail2PageModel”.
Set MainPage:
To create Fresh MVVM Master Detail Page as MainPage, we should use Fresh Master Detail Navigation Container with the following code. Open App.xaml.cs or App.cs and set MainPage.
var masterNavigation = new FreshMasterDetailNavigationContainer();
masterNavigation.Init("Menu");
masterNavigation.AddPage("First Page", null);
masterNavigation.AddPage("Second Page", null);
MainPage = masterNavigation;
  • Here, we will not discuss about navigation between pages. If you want to know, you can see my previous article on Fresh MVVM.
Full Code for App.xaml.cs:
You can find the code for App.xaml.cs below
public partial class App : Application
{
    public App()
    {
        try
        {
            InitializeComponent();
            var masterNavigation = new FreshMasterDetailNavigationContainer();
            masterNavigation.Init("Menu");
            masterNavigation.AddPage("First Page", null);
            masterNavigation.AddPage("Second Page", null);
            MainPage = masterNavigation;
        }
        catch (Exception ex)
        {

        }
    }

    protected override void OnStart()
    {
        // Handle when your app starts
    }

    protected override void OnSleep()
    {
        // Handle when your app sleeps
    }

    protected override void OnResume()
    {
        // Handle when your app resumes
    }
}

Download Code

You can download the code from GitHub. If you have doubt, feel free to post comment. If you like this article and is useful to you, do like, share the article & star the repository on GitHub.

Introduction: In this tutorial, we will learn how to perform MVVM approach in Xamarin.Forms using Fresh MVVM. MVVM approach is the best...

MVVM Databinding in Xamarin.Forms using Fresh MVVM MVVM Databinding in Xamarin.Forms using Fresh MVVM

A blog about android developement

Xamarin.Forms


Introduction:

In this tutorial, we will learn how to perform MVVM approach in Xamarin.Forms using Fresh MVVM. MVVM approach is the best approach for Xamarin.Forms and WPF Applications. There are a lot of MVVM plugins or libraries like FreshMVVM, MVVMCross, Prism, etc. available to simplify MVVM implementations.

FreshMVVM:

FreshMVVM is designed to perform MVVM easy and simple with Xamarin.Forms Application. It is created Michael Ridland. It has certain rules to perform MVVM Databinding. You can find the plugin from GitHub and Nuget.

Rules for FreshMVVM:
It has simple rules to do MVVM. It is the first and important rule. – The Views (Pages) name should be ended with Page. – The ViewModel name should be ended with PageModel. – The namespace of both Page and Pagemodel should be name. – You don’t need to set BindingContext manually. The plugin will detect the View and ViewModel with its name. We will start coding with Fresh MVVM.

Coding Part:

Steps:
I have split this part into 3 steps as in the following.
  1. Creating new Xamarin.Forms Projects.
  2. Setting up the plugin for Xamarin.Forms Application.
  3. Implementing Fresh MVVM.

Step 1: Creating new Xamarin.Forms Projects

Create New Project by Selecting New -> Project -> Select Xamarin Cross Platform App and Click OK.
Then Select Android and iOS Platforms as shown below with Code Sharing Strategy as PCL or .Net Standard and Click OK.

Step 2: Setting up the plugin for Xamarin.Forms Application

We will start coding for Fresh MVVM. Create New Xamarin Forms Project. Open Nuget Package Manager against the solution and do search for Fresh MVVM Plugin or Paste the following Nuget Installation.
Install-Package FreshMvvm -Version 2.2.3
Click Install to install this Plugin against your PCL Project or .NET standard Project.

Step 3: Implementing Fresh MVVM.

  1. Create your XAML page (view) with name ended up with “Page”.
  2. Create PageModel by create Class name ended with “PageModel” and inherited with “FreshBasePageModel” as shown below screenshot.
  3. The namespace of Page and PageModel should be same as shown in the above screenshots. – The Binding Properties and Command Properties are implemented same as like normal MVVM approach. – To indicate the binding properties changed by using RaisePropertyChanged instead of OnPropertyChanged event in Normal MVVM. – The following code is used to raise the property changed.
    RaisePropertyChanged("MainPageLabel");
  4. Set MainPage:
    To initialize the FreshMVVM Navigation you should set the MainPage with FreshMVVM Navigation Container with the following code. Open App.xaml.cs or App.cs and set MainPage. 
    var page = FreshPageModelResolver.ResolvePageModel<MainPageModel>();
    var basicNavContainer = new FreshNavigationContainer(page);
    MainPage = basicNavContainer;
    Navigation between Pages:
    FreshMVVM itself has Navigation methods to make navigation between the pages.
    1. Use PushPageModel for pushing the page in the navigation stack or goto next page instead of PushAsync in normal MVVM.
      await CoreMethods.PushPageModel();
      It is equivalent to the following
      Navigation.PushAsync(new SecondPage());
    2. Use PopPageModel for popping the page from navigation stack instead of PopAsync in normal MVVM.
      await CoreMethods.PopPageModel();
      It is equivalent to the following
      Navigation.PopAsync();
    3. Use PopToRoot to navigate from any page to root page instead of PopToAsync in normal MVVM.
      await CoreMethods.PopToRoot(animate:false);
      It is equivalent to the following
      Navigation.PopToRootAsync();

Full Code for MainPageModel:

You can find the code for MainPageModel below
namespace FreshMVVMSample
{
    public class MainPageModel : FreshBasePageModel
    {

        #region Default Override functions
        public override void Init(object initData)
        {
            base.Init(initData);
            MainPageLabel = "Welcome to Fresh Mvvm Tutorial!";
        }

        public override void ReverseInit(object returnedData)
        {
            base.ReverseInit(returnedData);
        }

        protected override void ViewIsAppearing(object sender, EventArgs e)
        {
            base.ViewIsAppearing(sender, e);
        }

        protected override void ViewIsDisappearing(object sender, EventArgs e)
        {
            base.ViewIsDisappearing(sender, e);
        }
        #endregion

        #region Commands
        public Command GotoSecondPageCommand
        {
            get
            {
                return new Command(async () =>
                {
                    await CoreMethods.PushPageModel<SecondPageModel>();
                });
            }
        }
        #endregion

        #region Properties
        string _mainPageLabel = string.Empty;
        public string MainPageLabel
        {
            get
            {
                return _mainPageLabel;
            }
            set
            {
                if (_mainPageLabel != value)
                {
                    _mainPageLabel = value;
                    RaisePropertyChanged(nameof(MainPageLabel));
                }
            }
        }
        #endregion

    }
}

Download Code

You can download the code from GitHub. If you have doubt, feel free to post comment. If you like this article and is useful to you, do like, share the article & star the repository on GitHub.

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

A blog about android developement

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.

Platform Support:

Here, we have used DependencyService to download any file from server path. Because, we cannot download any file directly in Xamarin.Forms. We will see the DependencyService for Android and iOS Platforms. It is similar to UWP with slight changes.

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.  Without much introduction, we will skip into the coding part of this article.

Coding Part:

Steps: 

I have explained the method to create DependencyService with the steps as shown in the following. 
Step 1: Creating new Xamarin.Forms Projects.
Step 2: Setting up AndroidManifest and info.plist
Step 3: Creating a Dependency Service for Android and iOS Platforms.
Step 4: Implementing the functionality to download the file in PCL.

Step 1 Creating new Xamarin.Forms Projects.

Create New Project by Selecting New -> Project -> Select Xamarin Cross Platform App and Click OK.
pro1

Then Select Android and iOS Platforms as shown below with Code Sharing Strategy as PCL or .Net Standard and Click OK.
pro2

Step 2 Setting up AndroidManifest and info.plist

Before starting, we need to make some setup respective to the Platforms.
For Android:
  1. Expand your Android Project and open Properties.
  2. Then add or check the permissions.(INTERNET,WRITE EXTERNAL STORAGE)
  3. Then click Save.
For iOS:
  1. Expand your iOS Project and Open your Info.plist file with XML Editor.
  2. Then add the following Permissions.
    <key>NSPhotoLibraryAddUsageDescription </key>
    <string>Need permission to save files.</string>
  3. It provides permission to save file.
    <key>NSPhotoLibraryUsageDescription</key>
    <string>Need permission to access files.</string>
  4. It provides permission to access files.
From iOS 11, Separate Permission Patterns are followed for saving and Accessing the Storage or Gallery.

Step 3 Creating Dependency Service by Platform wise.

In Xamarin.Forms, we need to go with dependency service to download files.
  1. First we need to create an interface in your PCL or Shared Projects. In my case, I have created an Interface named as “IDownloader.cs”.
  2. Then Paste the following code in that.
    public interface IDownloader
    {
     void DownloadFile(string url, string folder);
     event EventHandler OnFileDownloaded;
    }
  3. Here, I have create a custom event handler to notify app users about file download. You have create a class named as “DownloadEventArgs” and Paste the following code.
    public class DownloadEventArgs : EventArgs
    {
     public bool FileSaved = false;
     public DownloadEventArgs(bool fileSaved)
     {
      FileSaved = fileSaved;
     }
    }

For Android:

  1. Create a class named as “AndroidDownloader.cs” in your Android Project and implements the class with “IDownloader” interface created in your Portable Library. 
  2. We can use WebClient to download any file from the given URL. WebClient is used for both Android and iOS Platforms to download files.
  3. You can find the code used in Android Platform.
    public class AndroidDownloader : IDownloader
    {
     public event EventHandler OnFileDownloaded;
    
     public void DownloadFile(string url, string folder)
     {
      string pathToNewFolder = Path.Combine(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath, folder);
      Directory.CreateDirectory(pathToNewFolder);
    
      try
      {
       WebClient webClient = new WebClient();
       webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed);
       string pathToNewFile = Path.Combine(pathToNewFolder, Path.GetFileName(url));
       webClient.DownloadFileAsync(new Uri(url), pathToNewFile);
      }
      catch (Exception ex)
      {
       if (OnFileDownloaded != null)
        OnFileDownloaded.Invoke(this, new DownloadEventArgs(false));
      }
     }
    
     private void Completed(object sender, AsyncCompletedEventArgs e)
     {
      if (e.Error != null)
      {
       if (OnFileDownloaded != null)
        OnFileDownloaded.Invoke(this, new DownloadEventArgs(false));
      }
      else
      {
       if (OnFileDownloaded != null)
        OnFileDownloaded.Invoke(this, new DownloadEventArgs(true));
      }
     }
    }
  4. Here, WebClient has an async event for notifying the download event completion.
  5. The Download event is notified by invoking the custom event created with Dependency Service from Android Platform code.

For iOS:

  1. Create a class named as “iOSDownloader.cs” in your iOS Project and implements the class with “IDownloader” interface created in your Portable Library. 
  2. We can use WebClient to download any file from the given URL. WebClient is used for both Android and iOS Platforms to download files.
  3. You can find the code used in iOS Platform.
    public class IosDownloader : IDownloader
    {
     public event EventHandler OnFileDownloaded;
    
     public void DownloadFile(string url, string folder)
     {
      string pathToNewFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), folder);
      Directory.CreateDirectory(pathToNewFolder);
    
      try
      {
       WebClient webClient = new WebClient();
       webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed);
       string pathToNewFile = Path.Combine(pathToNewFolder, Path.GetFileName(url));
       webClient.DownloadFileAsync(new Uri(url), pathToNewFile);
      }
      catch (Exception ex)
      {
       if (OnFileDownloaded != null)
        OnFileDownloaded.Invoke(this, new DownloadEventArgs(false));
      }
     }
    
     private void Completed(object sender, AsyncCompletedEventArgs e)
     {
      if (e.Error != null)
      {
       if (OnFileDownloaded != null)
        OnFileDownloaded.Invoke(this, new DownloadEventArgs(false));
      }
      else
      {
       if (OnFileDownloaded != null)
        OnFileDownloaded.Invoke(this, new DownloadEventArgs(true));
      }
     }
    }
  4. Here, WebClient has an async event for notifying the download event completion.
  5. The Download event is notified by invoking the custom event created with Dependency Service from iOS Platform code.
Don’t forget to add the following lines above the namespace of your Dependency Service classes.
[assembly: Dependency(typeof(Dependency_Class_Name))]

Step 4: Implementing the functionality to download the file in PCL

The following code shows the following points – How to subscribe the download event. – How to call the download function.
public partial class MainPage : ContentPage
{
 IDownloader downloader = DependencyService.Get();
 public MainPage()
 {
  InitializeComponent();
  downloader.OnFileDownloaded += OnFileDownloaded;
 }

 private void OnFileDownloaded(object sender, DownloadEventArgs e)
 {
  if (e.FileSaved)
  {
   DisplayAlert("XF Downloader", "File Saved Successfully", "Close");
  }
  else
  {
   DisplayAlert("XF Downloader", "Error while saving the file", "Close");
  }
 }

 private void DownloadClicked(object sender, EventArgs e)
 {
  downloader.DownloadFile("http://www.dada-data.net/uploads/image/hausmann_abcd.jpg", "XF_Downloads");
 }
}

Download Code 

You can download the full source code from GitHub. If you like this article, do like, share and star the repo in GitHub.

In this tutorial, we will learn how to pin Latitude and Longitude or Co-Ordinates in External maps in Xamarin.Forms. The Co-Ordinates a...

Pin Coordinates To External Maps In Xamarin.Forms Pin Coordinates To External Maps In Xamarin.Forms

A blog about android developement

Xamarin.Forms


In this tutorial, we will learn how to pin Latitude and Longitude or Co-Ordinates in External maps in Xamarin.Forms. The Co-Ordinates are pinned with Google Maps in Android and Apple Maps in iOS. 

External Maps Plugin: 

This plugin is used to pin specific geo-location and Navigating user from current location to that specified location. James Montemongo had written a plugin to navigate users. But this plugin doesn’t have functionality to pin the specified location. So I have rewritten the plugin and you can find the plugin from GitHub and Nuget. 

Platform Support: 

It has the support for Android and iOS Platforms. 
  • Xamarin.iOS - iOS 7+ 
  • Xamarin.Android - API 10+ 

Coding Part: 

Steps: 

I have split this part into 3 steps as in the following. 
Step 1: Creating new Xamarin.Forms Projects. 
Step 2: Setting up the plugin for Xamarin.Forms Application. 
Step 3: Implementing the functionality to pin location.

Step 1

Create New Project by Selecting New -> Project -> Select Xamarin Cross Platform App and Click OK.
Then Select Android and iOS Platforms as shown below with Code Sharing Strategy as PCL or .Net Standard and Click OK.

Step 2

We will start coding for External Maps. Create New Xamarin Forms Project. Open Nuget Package Manager against the solution and do search for External Maps Plugin or Paste the following Nuget Installation.
Install-Package ExternalMapsPlugin -Version 1.0.0
Add this Plugin against Android & iOS Platforms.

Step 3

Open your XAML file and paste the following code. I have added a clicked event for the button to trigger or pin the specific co-ordinate to the map.
<code class="xml language-xml"><?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:MapsPluginSample"
             x:Class="MapsPluginSample.MainPage">

 <Button Text="Pin Co-Ordinate" 
            Clicked="OnButtonClicked"
            VerticalOptions="Center" 
            HorizontalOptions="Center" />

</ContentPage>
Open your MainPage.xaml.cs and add button click as shown below.
private void OnButtonClicked(object sender, EventArgs e)
{
 
}

Add Pinto method to locate co-ordinates in External Maps.

private void OnButtonClicked(object sender, EventArgs e)
{
       CrossMapsPlugin.Current.PinTo("Vannarapettai", 10.7653, 79.0687, 8);
}
Here, Vannarapettai is the label for your location 10.7653, 79.0687 is Latitude & Longitude of the location respectively. 8 is the zoom level of your Application.

Demo

The Following screenshots demonstrates how this plugin works. You can download the source code of this article and post your comments about this article and Plugin.

AndroidiOS

Download Code

You can download the full source code of the article in GitHub. If you like this article, do star the repo in GitHub. Hit like the article.

In this article, we will learn to load Base64 String Images into Images in Xamarin.Forms without using any External Plugins like FFMpe...

Loading Base64 Images In Xamarin.Forms Loading Base64 Images In Xamarin.Forms

A blog about android developement

Xamarin.Forms


In this article, we will learn to load Base64 String Images into Images in Xamarin.Forms without using any External Plugins like FFMpeg Image Loader Plugin.

Base64 Images

Base64 is a group of similar binary-to-text encoding schemes that represent binary data in an ASCII string format by translating it into a radix-64 representation. The term Base64 originates from a specific MIME content transfer encoding. To know more about Base64 Click Here.

Platform Support

The approach used here is done with Portable Library. So, it supports all the 3 (Android, iOS, and UWP) Platforms supported by Xamarin.Forms.
Without much introduction, we will skip into the coding part of this article.

Steps

I have explained the method to load base64 image in Image with 3 steps as shown below.
Step 1 - Creating new Xamarin.Forms Projects.
Step 2 - Creating a user interface with Xamarin.Forms.
Step 3 - Implementing the functionality to load Base64 Image.
Step 1 Creating new Xamarin.Forms Projects.
Create New Project by Selecting New >> Project >> Select Xamarin Cross-Platform App and Click OK.
Xamarin
Then Select Android and iOS Platforms as shown below with Code Sharing Strategy as PCL or .NET Standard and Click OK.
Xamarin
Step 2 Creating a user interface with Xamarin.Forms
Add Image Control to your Page, and here, I am going to add the control in MainPage.xaml. You can paste the codes shown below to create user interface for your page.
<?xml version="1.0" encoding="utf-8" ?>  
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" 
 xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
 xmlns:local="clr-namespace:Base64" 
 x:Class="Base64.MainPage">  
    <ContentPage.Content>  
        <Image x:Name="xfImage" 
   VerticalOptions="Center"
   HorizontalOptions="Center" /> 
 </ContentPage.Content>  
</ContentPage>
Step 3 implementing the functionality to load Base64 Image
In Xamarin.Forms, we can assign the source for Images by many ways like File Path, Image URL, From Resource Folder or Stream of Image.
We can convert the Base64 string into Stream of Image. That is array of Bytes (byte[]). We will use this method to assign Base64 image to Image Controls using the following code.
byte[] Base64Stream = Convert.FromBase64String(base64Image);  
xfImage.Source = ImageSource.FromStream(() => new MemoryStream(Base64Stream));
Full Code of MainPage.xaml.cs
namespace Base64 {  
    public partial class MainPage: ContentPage {  
        string base64Image = "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";  
        public MainPage() {  
            InitializeComponent();  
            byte[] Base64Stream = Convert.FromBase64String(base64Image);  
            xfImage.Source = ImageSource.FromStream(() => new MemoryStream(Base64Stream));  
        }  
    }  
}
The longest string shown here is the base 64 is encoded to the image
  • Convert.FromBase64String(base64Image) is used to convert base64 string byte[].
  • ImageSource.FromStream(() => new MemoryStream(Base64Stream)) is used to convert the byte[] to Image Stream and Stream is assigned to Image Control.

When considering how to build iOS and Android applications, many people think that the native languages, Objective-C, Swift, and Java, ...

Xamarin - Introduction Xamarin - Introduction

A blog about android developement

Xamarin.Forms


When considering how to build iOS and Android applications, many people think that the native languages, Objective-C, Swift, and Java, are the only choice. However, over the past few years, an entire new ecosystem of platforms for building mobile applications has emerged.

Xamarin is unique in this space by offering a single language – C#, class library, and runtime that works across all three mobile platforms of iOS, Android, and Windows Phone (Windows Phone’s native language is already C#), while still compiling native (non-interpreted) applications that are performant enough even for demanding games. 

Each of these platforms has a different feature set and each varies in its ability to write native applications – that is, applications that compile down to native code and that interop fluently with the underlying Java subsystem. For example, some platforms only allow apps to be built in HTML and JavaScript, whereas some are very low-level and only allow C/C++ code. Some platforms don’t even utilize the native control toolkit.  

In Androidmads, we will not cover the basics of Xamarin App development. But, we will cover the advanced concepts of Xamarin as well as we will assist you, if you find any help with Xamarin Basics. And also we will see about Flutter App development.