0

のデータベースに行を表示しようとしていEditBoxます。しかし、私は問題を抱えています。これまでのところ私のコードは

public void ViewEmployeeButton (View view)
{
    DatabaseHandler db = new DatabaseHandler(this);
    Employee e1 = new Employee();       
    EditText et=(EditText) findViewById(R.id.employeeId);
    EditText detailEmp=(EditText) findViewById(R.id.detailEmployee);
    int id=Integer.getInteger(et.getText().toString());
    e1=db.getEmployee(id);
    detailEmp.setText(???)
}

employee には、Getid, GetName, GetUsername, GetPassowrd, GetAgeを返す関数がありStringsます。のパラメータに何を書きますsetTextか?アウトアウトが複数行になるようにします。

データベースでは、行は次のようになります。

1 キランパスワード KiranTauqir 21

次のような出力が必要です

id 1 ユーザー名 kiran パスワード パスワード 名前 KiranTauqir 年齢 21

助けてください?

4

1 に答える 1

0

すべての列の値を取得し、改行文字「\n」とともに文字列に追加するだけです。

サンプル コードは次のようになります。

    int i=0;
    String output;
    while(i<e1.getColumnCount())
    {
           output.append(e1.getString(i) +"\n");   //getString(i) will return the value of particular column
           i++;
    }
    detailEmp.setText(output);
于 2013-02-26T12:12:22.907 に答える