Sun Sep 30 22:02:46 PDT 2018


Image



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[] = { 700, 400, 100, 500,600 }; @Overri?





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)); } }



Comments

Popular posts from this blog

termux vnc viewer setup

../Settings.jpg

me.html