Tag

Xamarin Android Archives - Falafel Software Blog

Xamarin Android – Launch App From Browser

By | Android, Android, Xamarin | No Comments

Often times your mobile application will have an associated website and a typical scenario is to allow the user to open the  mobile app from the site when browsing on their mobile device.  Here is how you can accomplish this in Xamarin Android. First is the activity that will be the entry point for links coming from the browser.  In my case I just want to grab the passed in parameters, which we will talk about later, and then kickoff my main activity and that is all that is going on here.  Because this activity has no associated layout, i.e. we aren’t…

Read More

Day 31: Distributing your Android App and Wrap-up

By | Android, Xamarin | 5 Comments

This is post 32 of 32 in the series “31 Days of Xamarin.Android” Before we wrap up this series, let’s take a quick look at how we can distribute a Xamarin.Android Application. The most common way to distribute your android application is using the Google Play Store. To distribute an app on the Google Play Store, we need to create an “APK” file. Let’s take a look at how we can do that from Xamarin Studio – In Xamarin Studio, make sure you switch your Configuration to “Release” mode. After that, click on “Build” menu option and then click on…

Read More

Day 30: Monitoring your Xamarin.Android applications using Xamarin Insights

By | Android, Xamarin | No Comments

This is post 31 of 32 in the series “31 Days of Xamarin.Android” Monitoring how well your app is doing is an absolute necessary thing now a days. Even the small company / indie developers are actually competing for app usage time with big companies like Facebook, Twitter, etc. So if your app crashes and you wait for your users to tell your about it, chances are your users will never ever come back to your app. Xamarin provides a wonderful tool called Xamarin Insights for monitoring your mobile applications (be it be Android or iOS). In today’s post we…

Read More

Day 29: Plugins for Xamarin.Android

By | Android, Xamarin | No Comments

This is post 30 of 32 in the series “31 Days of Xamarin.Android” Any Xamarin series will not be complete without talking about the awesome Plugin ecosystem that Xamarin has. Xamarin’s Github Repository has the whole list of Plugins for Xamarin that are developed by folks at Xamarin and also community Xamarin developers. A Plugin for Xamarin is just DLLs which are often distributed using Nuget or Xamarin Component store. The plugins abstract hard to do functionality over a simple and common API. Today, we are looking at Plugins for Xamarin.Android but a majority Xamarin plugins are, and become powerful,…

Read More

Day 28: Using SQLite.Net with Xamarin.Android

By | Android, Xamarin | 3 Comments

This is post 29 of 32 in the series “31 Days of Xamarin.Android” Today, we will explore on how to use SQLite.Net with Xamarin.Android. SQLite.Net is a open source library for SQLite written in .NET to allow light-weight mobile applications (or others) save data in a local SQLite database.   SQLite.Net implemented is written by Frank A Krueger, and the source of the project is all up on Github. To use SQLite.Net in your Xamarin.Android application, you need to add a Nuget package called “SQLite-net PCL”

Note: There are a lot of SQLite Nuget packages, make sure you pick…

Read More

Day 27: Using HttpClient with Xamarin.Android

By | Android, Xamarin | 9 Comments

This is post 28 of 32 in the series “31 Days of Xamarin.Android” Today, we will look at how we can use HttpClient to read data from a remote API and display it in a List (RecyclerView). We are looking at HttpClient in today’s example, but you can use any library like WebClient, RestSharp or any other library of your choice. Keeping to the theme of showing Star Wars data in this series, today, we will consume the Star Wars API https://swapi.co/documentation. To use HttpClient in your Xamarin.Android Application, you should first install the HttpClient Nuget Package –

 …

Read More

Day 26: Remote Notifications with Parse

By | Android, Xamarin | 3 Comments

This is post 27 of 32 in the series “31 Days of Xamarin.Android” Today, we will explore how to create Remote Notifications in Xamarin.Android. To do remote notifications in any Android Application, we need to work with Google Cloud Messaging (GCM). This process of working with GCM is a bit complicated and there are number of providers out there that take care of this complicated procedure for you and expose simple APIs for you to hook into. For this sample, we will take a look at how to use Facebook’s Parse but you can use any Push Notification Provider there…

Read More

Day 25: Local Notifications

By | Android, Xamarin | 2 Comments

This is post 26 of 32 in the series “31 Days of Xamarin.Android” Today, we will explore how to create Local Notifications in Xamarin.Android. Notifications in Android are use two types of layouts – Base Layout Expanded Layout Base Layout Notification Base Layout Notification is the simplest form of Android Notifications. The Base Layout Notifications consist of the following – A Notification Icon. This is a simple Android Drawable Resource Image that indicates either the originating app icon or type of the notification shown. A title for the notification. Additional text for the notification. Timestamp at which the notification is…

Read More

Day 24: Toasts and Snackbars

By | Android, Xamarin | One Comment

This is post 25 of 32 in the series “31 Days of Xamarin.Android” Today, we will explore common ways to show feedback to users in Android. The most common way in Android being Toasts and Snackbars is the new way of showing alerts to users that can be acted upon. Snackbars require the Design Support Library. Toasts Toast provides a simple way to show feedback to users after an operation is complete. Toast appears on the bottom of the screen, only taking up the same that is required for filling the message. Let’s see how a simple Toast looks like…

Read More

Day 23: TabLayout

By | Android, Xamarin | 16 Comments

This is post 24 of 32 in the series “31 Days of Xamarin.Android” Today, we will explore one of the most common navigational patterns in Mobile Apps: Tabbed Layout. We will look at how we can create a Tabbed Layout in Android using Xamarin.Android using the “TabLayout” widget. To use TabLayout in Xamarin.Android we first must install the Xamarin Support Design Library using Nuget. The command to install the package is –

Once the package is installed, we can now move on adding the TabLayout widget. TabLayout widget goes hand in hand with the ViewPager view which is used…

Read More

Day 22: ScrollView and WebView

By | Android, Xamarin | One Comment

This is post 23 of 32 in the series “31 Days of Xamarin.Android” Today, we will explore couple more of commonly used views in Xamarin.Android: ScrollView, WebView. ScrollView ScrollView in Android is used in scenarios where the number of views on the screen overflow and present a need for a scroll bar to see the Views that are towards the end of the screen. Let’s see the problem at hand first. I took a layout file and filled it with bunch of Views so the full screen is not seen on the on presented screen height –

If you…

Read More

Day 21: RecyclerView

By | Android, Xamarin | 3 Comments

This is post 22 of 32 in the series “31 Days of Xamarin.Android” Today, we will explore more about RecyclerView in Xamarin.Android. RecyclerView was introduced in Android 5.0 (Lollipop). RecyclerView is the new and better way to display large collections of data in Android. RecyclerView enforces the ViewHolder pattern Day 19 for ListView to reuse Views effectively, making it a very suitable View for handling large sets of data. On the other hand, RecyclerView, unlike ListView, does not provide any built in support for Item Click events, it is up to us to define these events using the .NET Events…

Read More

Day 20: CardView

By | Android, Xamarin | 2 Comments

This is post 21 of 32 in the series “31 Days of Xamarin.Android” Today, we will explore more about CardView in Xamarin.Android. CardView was introduced in Android 5.0 (Lollipop). CardView is mainly used to create Card like user interface for showing lists of data in Android Application. CardView can hold just text (basic) and text with images (advanced) in its Layout. CardView’s Layout is based on the FrameLayout widget with rounded corners and shadows. We will be taking the Star Wars sample app that we have been working on in the last two days and we will be transforming to…

Read More

Day 19: ListView and Adapters, Part 2

By | Android, Xamarin | 5 Comments

This is post 20 of 32 in the series “31 Days of Xamarin.Android” This is part 2 of 2 part series exploring ListView and Adapters in Xamarin.Android in our 31 Days of Xamarin.Android Blog series. In today’s post we will explore using BaseAdapter and also a custom layout for the ListView’s Item Row. Let’s dive right into the code and look at what ListView’s AXML and Custom Item Row’s AXML would look like –

Gist file link: https://gist.github.com/vkoppaka/1744b7ec5fec43b8ee55 Lets take a look at how the Main Activity that shows the ListView is –

  Gist file link:…

Read More

Day 18: ListView and Adapters, Part 1

By | Android, Xamarin | 2 Comments

This is post 19 of 32 in the series “31 Days of Xamarin.Android” Over the past few days we have gotten to know a lot about Android and Xamarin.Android. Now lets us dive into the most commonly used View in Android of all ListView. ListViews are found in pretty much every single application, in fact I challenge you real quick to name 3 apps on your phone which don’t have lists of data of some sought (excluding games). Not easy isn’t it?!. So let’s learn this integral part of Android Development in detail. ListView as the name indicates is used…

Read More

Day 17: Fragments in Xamarin.Android

By | Android, Xamarin | 3 Comments

This is post 18 of 32 in the series “31 Days of Xamarin.Android” Today we will take a look at a concept that is heavily used in Android world called Fragments. Fragments in Android are modular and self-contained pieces that have their own lifecycle, layout and behavior. Fragments are generally smaller than Activity and are often used for dynamic UI. A group of Fragments generally make up an Activity (screen) in Android. Fragments were first introduced in Android HoneyComb (3.0) so your application must be targeting at least API Level 11 to make use of Fragments in Android. Fragments in…

Read More

Day 16: Controls: Media Controls

By | Android, Xamarin | One Comment

This is post 17 of 32 in the series “31 Days of Xamarin.Android” Today we will take a look at different Media Controls in Xamarin.Android. We will explore the following controls – Gallery ImageView ImageButton Gallery Gallery control in Android is used to showing items in a horizontally scrolling list. Important thing to note here is in recent versions of Android, this control has become Obsolete in favor of HorizontalScrollView and ViewPager. But, if you are targeting older Android Devices, Gallery is still a really good option to show horizontally scrolling lists. To get started, drag and drop a Gallery…

Read More

Day 15: Controls: DateTime Controls

By | Android, Xamarin | One Comment

This is post 16 of 32 in the series “31 Days of Xamarin.Android” Today we will take a look at different DateTime Controls in Xamarin.Android. We will explore the following controls – CalendarView DatePicker TimePicker This article will also serve as a quick introduction to Fragments in Android, although, we will explore Fragments in more detail in the upcoming blog posts. CalendarView CalendarView control in Android is used to showing and selecting dates. Let’s take a look at a simple example of a CalendarView control in action – To get started, drag and drop a CalendarView Control on to the…

Read More

Day 14: Spinner

By | Android, Xamarin | 4 Comments

This is post 15 of 32 in the series “31 Days of Xamarin.Android” Today we will take a look at Spinner control in Xamarin.Android. We will explore two different ways to create a spinner control in today’s blog post. Simple Spinner with data coming from a hard-coded list of string values A slightly more customized spinner where the data is coming for a repository (can be any repository) Simple Spinner with Array Adapter Let’s get started with Simple Spinner. Open Main.axml Layout file in your Xamarin.Android project and let’s drag and drop a Spinner control on to the layout. If…

Read More

Day 13: Controls: Input Controls, Part 2

By | Android, Xamarin | 2 Comments

This is post 14 of 32 in the series “31 Days of Xamarin.Android” In today’s post we will go over few of the rest of the input controls in Xamarin.Android   Switch A Switch control can toggle between two states, ON or OFF. The Switch control’s default is value is OFF. The text that is shown for the Switch, it’s ON and OFF text and its default state are all configurable using AXML in Xamarin Android. Let’s look at a simple Switch control AXML –

  Gist file link: https://gist.github.com/vkoppaka/97236a1aff7585e55b16 Properties In the XML snippet above there are 4…

Read More

Day 12: Controls: Input Controls, Part 1

By | Android, Xamarin | 2 Comments

This is post 13 of 32 in the series “31 Days of Xamarin.Android” Over the course of next 5 days we will explore controls, or more commonly called in Android world as Views. In today’s post, let’s dig specifically into Input Controls, which are controls that lets users enter data or change state. We will explore the following controls – EditText Date Email Multiline Text Number Password Person Name Phone Postal CheckBox RadioButton ToggleButton RatingBar We will start today by exploring different type of EditText (Text Box) controls. EditText EditText is the one of the most common input controls to…

Read More

Day 11: Android Main Concepts: Services

By | Android, Xamarin | One Comment

This is post 12 of 32 in the series “31 Days of Xamarin.Android” Today we will explore what Services in Android world are. Services in Android is just another Application Component that are used to perform long running tasks. Services are generally started by another components such as Activities in your Android Application. Services can be used in two ways – Started Services Bounded Services Started Services A Started Service is triggered by an Application Component such as Activity by calling “StartService” method. The Service can also be stopped by the Application Component by calling the “StopServiceThis” method. This type…

Read More

Day 10: Android Main Concepts: Activities

By | Android, Xamarin | One Comment

This is post 11 of 32 in the series “31 Days of Xamarin.Android” Today, let’s explore what Activities in Android are – Activities in Android are what provides screens for the users to interact with. Generally, each screen in Android has a corresponding Activity. An application can have one or more Activities that come together to present the user with various screens that constitute the Application. One among the activities in the application is designated as the “MainLauncher”, typically called MainActivity. Activities in Xamarin.Android are just classes which inherit from the “Activity” Base class and are decorated with the “Activity”…

Read More

Day 9: Android Main Concepts: Intents

By | Android, Xamarin | One Comment

This is post 10 of 32 in the series “31 Days of Xamarin.Android” Over the next three days, we will explore some of the fundamentals of building an Android Application. They are – Intents Activities Services Today, let’s explore what Intents in Android are – Intents in Android are just data structures that are message objects. Intents can request an operation to be performed by some other component in Android. Intents are generally used to start Activities and Services in Android. We will explore in coming blog posts on how to use Intents to start an Activity and Services. All…

Read More

Day 8: Grid and Table Layout

By | Android, Xamarin | One Comment

This is post 9 of 32 in the series “31 Days of Xamarin.Android” Grid Layout Grid layout is one of the new kids in the block, it got introduced with Ice Cream Sandwich (API Level 14). If you are a .NET Programmer who is familiar with Windows Phone (or Windows’) Grid Definitions, this should feel right at home to you. Grid Layout is used to put views into rows and columns reminiscent of tables. As with any ViewGroup Grid Layout can also hold other types of ViewGroups. Let’s start digging into the XML code that is used to create Grid…

Read More