JSON Parsing – Android

Android
The last post XML Parsing using SAXParser was about parsing a web service providing XML. In this post we are going to parse JSON available at http://www.pcsalt.com/postservice/?format=json. The JSON available at the link may seem messy, for the formatted view of JSON JSONLint. In order to parse JSON, at first we should examine the JSON and determine what is it we need to parse. (more…)
Read More

XML Parsing using SAXParser – Android

Android
Webservices are one of the effective way of transferring information from server to mobile apps. The webservices may use XML or JSON formats for the purpose. This tutorial is about parsing information available at http://www.pcsalt.com/postservice/?format=xml. And, the end result will be an Android app having a list of posts on Android, and clicking on the list item will open the linked page. Following XML is an abstract from above URL. First we determine what tags are there in XML and then we would parse to extract and display this information. (more…)
Read More

Android SQLite Database – Part 2/2

Android
This is the second post in SQLite series. In this post we will create an app to perform insert, update, delete and select operation on database. We will be using same class created in previous post to interact with database. Let's first create a layout for providing an interface to interact with database to perform CRUD operations. activity_main.xml (more…)
Read More

Android SQLite Database – Part 1/2

Android
When it comes to save data in an Android device then there are three ways to do it. Depending on the nature of requirement data could be saved in- SQLite Database - A light weight database already available with Android. Shared Preferences - An XML file used privately by the application which created it, and File - Writing a file and saving it on SD card. (more…)
Read More

Override Button of AlertDialog – Android

Android
As per the requirement of applications, sometimes we need to provide a custom feature to the buttons of AlertDialog. For instance, we may need to change the color of Positive, Negative, and/or Neutral buttons. And for the same reason, we may need to override button of AlertDialog to provide custom behavior. In this tutorial, we are going to override the buttons of AlertDialog. So, this tutorial covers following points. - Create AlertDialog - Override the Buttons of AlertDialog - Change text color of AlertDialog buttons (more…)
Read More

Create AlertDialog with Custom Layout using XML Layout

Android
As application grows or while building an application for larger group, sometimes it is necessary to use a custom layout in the AlertDialog. The situation can be visualised by having a login dialog, where user would be asked for their login credentials. While creating custom layout for AlertDialog, we have two options, if the custom UI is simple enough to display one or two components then this could be done programmatically, else we need to create an XML layout and include that into the AlertDialog. This post is third in series of tutorials for creating and displaying AlertDialog. (more…)
Read More

Provide Selection from a list of options – Android

Android
This post is second in series of tutorials to create and display an AlertDialog.¬†Before starting this post, let us recap few things from previous post. To create an AlertDialog, we need AlertDialog.Builder and provide all required properties through the builder instance. Buttons are optional in AlertDialog, we can use all combinations of the buttons or we can choose not to use any button at all. AlertDialog can be created without any title. AlertDialog can be created without any message. (more…)
Read More

Create AlertDialog and Basic Usage – Android

Android
Creating and displaying an AlertDialog depends on the use-case of the application. But, the way of creating and displaying depends on the situation. There are several ways of creating it, so, this post is the first¬†in the series of tutorials to create and display an AlertDialog. In this series of tutorials, we will be learning from the basics of creating AlertDialog to add customization to it. Whether it is displaying custom view(s) on the dialog or handling the UI interaction of the dialog. All the source code will be available on GitHub and the link will be shared after completion of each post. (more…)
Read More