-5

hi i want to get data from the sqlite database. I want to use a method to load data in my Edittext.

private void ladeDaten(String tbname,String fach)
    {
        String select = "SELECT info FROM "+tbname+" WHERE name='"+fach+"'";

        String info = ""; // how I can 

        ((EditText)(findViewById(R.id.txtContacto))).setText(info);
    }

What can I do?

Tarasov
  • 3,625
  • 19
  • 68
  • 128

1 Answers1

0

Solution for you :

public int GetDeptID(String Dept)
  {
   SQLiteDatabase db=this.getReadableDatabase();

   Cursor c=db.rawQuery("SELECT "+colDeptID+" as _id FROM "+deptTable+" WHERE "+colDeptName+"=?",
new String []{Dept});
   c.moveToFirst();
   return c.getInt(c.getColumnIndex("_id"));

  }

Read more here : http://mobileorchard.com/android-app-development-using-sqlite-database/

ITS ONLY EXAMPLE

TN888
  • 7,659
  • 9
  • 48
  • 84