Thu Nov 29 11:02:46 PST 2018


Image



AChartEngine is now the most widely used jar in the world to draw various types of following charts.



            1. Graphical chart



            2. Line chart



            3. Bar chart



            4. Scatter chart



            5. Time chart



            6. Pie chart



This article is about draw pie chart using achartengine.



Sample screen shot of pie chart drawn using achartengine.





This pie chart has the following options.



        1. Movable



        2. Zoomable



        3. Clickable



To draw this chart first you have to import
achartengine jar into your project folder. If you are using eclipse  then right click on your project --> Build Path --> Configure Build Path --> Libraries tab --> Add External JARs. This is the way to import external jars into our project.



Coding:




main.xml



&ltLinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation?




Image



This is simple sqlite database tutorial without using External database. If you want to know how use external database in android then please
click me! To create and access a table in android using SQLite is very simple. The following method will show how to create a table and see column names of that table in android.

public void table1() { db = this.getWritableDatabase(); db.execSQL("CREATE TABLE IF NOT EXISTS table1(id INTEGER PRIMARY KEY AUTOINCREMENT , description TEXT)"); // to see colomn names in our table1 Cursor t = db.rawQuery("PRAGMA TABLE_INFO(table1)", null); if (t.moveToFirst()) { do { Log.i("", t.getString(0) + " " + t.getString(1)); } while (t.moveToNext()); } t.close(); db.close(); } And the following sample code is used to insert data into table.

public void inserIntoTable1(String desc) { db = this.getWritableDatabase(); ContentValues cv = new ContentValues(); try { db.beginTransacti?




Image



This is tutorial for accessing external DB from assets folder. In android We can create sqlite database by using SQLite Database Browser. Now the question is how to access this database in source code. The answer is very simple. Store the database in assets folder that is placed in project folder.



Then we can access this database in dbhelper class using

context.getAssets().open(DB_NAME);

After this we should copy this database to our root directory. Why because our SQLiteOpenHelper reads data from root directory only. for this we have to open new empty file in root directory by using.

private String DB_PATH = "/data/data/" + context.getPackageName() + "/" + "databases/"; String DB_NAME = "database"; String outFileName = DB_PATH + DB_NAME; OutputStream myOutput = new FileOutputStream(outFileName); then we have to copy our data to this empty file by using.

byte[] buffer = new byte[1024]; int length; while ((length = myInput.read(buffer)) > 0)?



Comments

Popular posts from this blog

termux vnc viewer setup

../Settings.jpg

me.html