Skip to main content

Posts

Showing posts from November, 2015

Adding Json array to Serializable Class using Gson.

Why you should use Gson and Serializable Class to Handle Json Data: Gson can be used along with Serializable class to save variables, unnecessary loops and memory  to save the data you get from Json.  Let's Imagine you have array of contact detail and its total count is four. which is something like this. Json Snippet: [ { "name" : "Mark" , "phoneNumber" : "1008788666" , "emailId" : "mark@mail.com" , "address" : "600 Pennsylvania Avenue, Washington DC" }, { "name" : "Christian" , "phoneNumber" : "8007780066" , "emailId" : "christian@mail.com" , "address" : "11 Wall Street New York" }, { "name" : "Benedict" , "phoneNumber" : "4258781555" , "emailId" : "ben

Picasso Android Example

In this post I am about to show you, how to cache an image and display it in Android application, you can also use Picasa to save the Image that you are caching to local directory.  You can download the library .jar file from here . key Features of Picasso Library Android: Easy to code with Picasso --> With single line of code you can able to cache Image to your application or download Image to local directory of your phone.  Handles ImageView Recycling in Adapter -->  Let's take an listview adapter for example, if you are about to use Picasso to display images to a listview , the caching and cancellation of caching when the list child is visible or Invisible is handled automatically by Picasso.  PlaceHolder --> You can use place holder to notify the user, what's happening when the image caching starts, so before displaying the complete image on the view, you can display an image prior to that notifying the user what's happening like (d

PopupWindow with Image and Text Android

PopupWindow :  Download the complete Android Studio Project from  here .       In this example, I am about to show you , how to create a pop-up window which will be displayed below the overflow icon,when someone clicks it. The design will look like this.  So when some clicks on the overflow Icon it will display pop up window showing the different social networking sites. On choosing any of the option below will take them to a new Activity loading the selected site on the Web view in new activity.  WebView ->  A Web View is a view/widget, which allows you to load and display web content inside your activity.  you don't need any new dependencies or external libraries to achieve this. Lets jump into the code. 1.Activity_Main.xml: <? xml version = "1.0" encoding = "utf-8" ?> <LinearLayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:tools= "http://schemas.