What is ASP.NET CORE?

Asp.net core is a free and open source web framework used to develop the next generation of ASP.NET applications. ASP.NET Core is developed and powered by Microsoft as well as the community user base. It is a modular Framework that has the capability to run on legacy .NET Framework that runs on Windows as well... Continue Reading →

Toast in android using xamarin forms

randomtutes

When we want to let user know that something happening we can use Toast.

Let’s see how to create Toast in in Android in Xamarin Forms

Create xamrin foms application with Android project

project

  • In .net standard project add a Interface



This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters


public interface IToastMessageService
{
void ShowToastMessage(string message);
}
  • In Android project add ToastMessageService and implement the IToastMessageService



This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters


[assembly: Xamarin.Forms.Dependency(typeof(ToastMessageService))]
namespace ToastTestXamarin.Droid
{
public class…

View original post 168 more words

Double tap to exit in xamarin Android

randomtutes

So I had to implement double tap to exit from app in Android using xamarin. This how it is implemented

  • Create blank Android App

create project

  • Override OnBackPressed method in MainActivity.cs



This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters


private bool doubleBackToExitPressedOnce = false;
public override void OnBackPressed()
{
if (doubleBackToExitPressedOnce)
{
base.OnBackPressed();
Java.Lang.JavaSystem.Exit(0);
return;
}
this.doubleBackToExitPressedOnce = true;
Toast.MakeText(this, "Double tap to exit", ToastLength.Short).Show();
new Handler().PostDelayed(() =>
{
doubleBackToExitPressedOnce = false;
}, 2000);
}
view raw

MainActivity.cs

hosted with ❤ by GitHub
  • That’s it 🙂 Run the app and see the out put

double tap to exitGIF_Maker_VideoToGif_15-3-2018_95808_PM

Thanks. 🙂

View original post

Create a website or blog at WordPress.com

Up ↑