Skip to main content

Posts

Showing posts from February, 2013

Featured post

Simple RecyclerView example with filter option in Android

Hi Guys, Maybe you all are expert in terms of using RecyclerView in android. This blog is simple example for using filter option with RecyclerView adapter. As for now you will instantiate RecyclerView and set the adapter to RecyclerView as following way. RecyclerView list = (RecyclerView) findViewById(R.id.list); list.setLayoutManager(new LinearLayoutManager(this)); list.setHasFixedSize(true); ArrayList&ltNumber&gt numbers = new ArrayList&lt&gt(); String ONEs[] = {"ZERO", "ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE", "TEN"}; String TENs[] = {"ZERO", "TEN", "TWENTY", "THIRTY", "FOURTY", "FIFTY", "SIXTY", "SEVENTY", "EIGHTY", "NINETY", "HUNDRED"}; String HUNDREDS[] = {"ZERO", "HUNDRED", "TWO HUND

Pie Chart in Android without using external jar

Simple Pie Chart example without using any external jar in android. Here We are creating chart using Canvas class in android. This is the sample screenshot of our application.  And this is also sample screenshot of our application. It is easy to draw this chart in android. First our xml will be. &lt?xml version="1.0" encoding="utf-8"?&gt &ltRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" &gt &ltLinearLayout android:id="@+id/linear" android:layout_width="match_parent" android:layout_height="match_parent" &gt &lt/LinearLayout&gt &lt/RelativeLayout&gt Our Activity will be. public class MainActivity extends Activity { float values[] = { 70

Multiple ArrayList in Java

Like Multiple array also we can create and use multiple arraylist. Declaration of Multiple ArrayList in JAVA. ArrayList&ltinteger&gt sets[]; initialization of Multiple ArrayList in JAVA. sets = new ArrayList[5]; Sample program using Multiple ArrayList in JAVA. public class A { static ArrayList&ltinteger&gt numbers[]; public static void main(String[] args) throws ParseException { numbers= new ArrayList[5]; numbers[0] = new ArrayList&ltinteger&gt(); numbers[0].add(1); // extending your code in order to use more than one value of the List array numbers[1] = new ArrayList&ltinteger&gt(); numbers[1].add(2); numbers[1].add(3); // if you want to get the values of first array. for(int i = 0;i&ltnumbers[1].size();i++) System.out.println(numbers[1].get(i)); // if you want to get the values of whole arraylist. for(int j = 0; j&ltsets.length;j++) for(int i = 0;i&ltnumbers[j].size();i++) System.out.println(numbers[j].get(i)); } }