Android Display the value in ListView dynamically using adaptor

i am new to android and i am learning now, Plz help meeeeeee..... I want to display all the Emp name in the ListView using adaptor which i have fetched the value from database... Plz Help me out with this...

Here is my Code...

// POJO Class

public class Emp {

    int id;
    String fName;
    String lName;

    public Emp() {


    public Emp(String fName, String lName){
        this.fName = fName;
        this.lName = lName;

    public Emp(int id, String fName, String lName) { = id;
        this.fName = fName;
        this.lName = lName;

    // setter and getters...

// Layout demo.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android=""
    android:orientation="vertical" >

         android:layout_height="match_parent" >



public List<Emp> getAllEmp() {
    List<Emp> empList = new ArrayList<Emp>();
    String selectQuery = "SELECT  * FROM Emp" ;
    SQLiteDatabase db = this.getWritableDatabase();
    Cursor cursor = db.rawQuery(selectQuery, null);
    if (cursor.moveToFirst()) {
        do {
            Emp emp = new Emp();
        } while (cursor.moveToNext());
    return empList;


public void onCreate(Bundle savedInstanceState) {

    DbHelper helper = new DbHelper(getApplicationContext());;

    List<Emp> empList = helper.getAllEmp(); 

   // Here i have to write a logic that to get only fName and set to adaptor...

    list = (ListView) findViewById(;
    list.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, empList)); 

Here iam getting Set of emp Records...

This is Database

|       |           |           |       
|    1  |   Rahul   |   Dravid  |       
|    2  |   Sachin  | Tendulkar |           
|    3  |   Saurav  |   Ganguly |       

Thanks in advance...


Add in your onCreate() method

        ArrayList<String> empName = new ArrayList<String>();
    for (int i = 0; i < empList.size(); i++) {
    final ArrayAdapter<String> ListObject = new ArrayAdapter<String>(this,
            android.R.layout.simple_list_item_1, empName);
    ListView listView = findViewById(;

Need Your Help

ASP.NET SSL Authentication Ticket Security? security ssl https forms-authentication

I intend to use SSL on the login form so that the username and password is encrypted during user login.

fetching data on the iphone

php iphone mysql xml json

Hey i am developing an iPhone app of a existing PhP mySQL website. i want to know, how to pull data from database and display on the phone?