I want to make a list contains some username from my sqlite database. I want it has white background and black text. I felt difficult when find every tutorial thought me to use extends listactivity….is there any technique to make it ?
here is some of my code in nir.java
setContentView(R.layout.changeplayer);
btnCreateN = (Button)findViewById(R.id.btnCreateNew);
btnCreateN.setOnClickListener(this);
btnSetP = (Button)findViewById(R.id.btnOK);
btnSetP.setOnClickListener(this);
//buat listview
lstUnameView = (ListView)findViewById(R.id.listUsername);
adapter = new ArrayAdapter <String>(this,
android.R.layout.simple_list_item_1, lstUname);
lstUnameView.setAdapter(adapter);
//koneksi ke db, ngambil username-username
helper = new sqlite(this, "tamadb", 1);
db1 = helper.getWritableDatabase();
c = db1.rawQuery("SELECT username FROM tama", null);
if(c.moveToFirst())
{
do
{
lstUname.add(c.getString(0));
}while(c.moveToNext());
}
helper.close();
and this my code in layout changeplayer
<RelativeLayout xmlns:android="schemas.android.com/apk/res/android";
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ListView android:id="@+id/listUsername"
android:layout_width="fill_parent"
android:layout_height="350px"
android:drawSelectorOnTop="false"
android:background = "#FFFFFFFF"
android:cacheColorHint = "#191919" />
<Button android:id="@+id/btnCreateNew"
android:layout_width="120px"
android:layout_height="wrap_content"
android:text="Create New"
android:layout_below="@id/listUsername"
android:layout_marginLeft="40px" />
<Button android:id="@+id/btnOK"
android:layout_width="120px"
android:layout_height="wrap_content"
android:text="OK"
android:layout_below="@id/listUsername"
android:layout_toRightOf="@id/btnCreateNew" />
</RelativeLayout>
Please help, i want to finish this project too…he9x..thx before…^^
If you want your whole app to have white background and black text you can set the theme for your app to
Theme.Light. Therefore you have to add the attributeandroid:theme="@android:style/Theme.Light"to the element of the manifest file.