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 →
Building Web Application using Entity Framework and MVC 5
Introduction Technologies are constantly evolving and as developer we need to cope up with what’s the latest or at least popular nowadays. As a starter you might find yourself having a hard-time catching up with latest technologies because it will give you more confusion as to what sets of technologies to use and where to... Continue Reading →
Toast in android using xamarin forms
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
- 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
So I had to implement double tap to exit from app in Android using xamarin. This how it is implemented
- Create blank Android App
- 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); |
} |
- That’s it 🙂 Run the app and see the out put
Thanks. 🙂