i just started learning android and i'm stuck at this if anyone could help me
this is a part of the code :
public class MainActivity extends Activity {
ListView listView;
SQLiteActivity db;
String [] x;
public void SHOW() {
db.Read();
String [] x = db.getAll();
db.close();
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.content_main);
listView = (ListView) findViewById(R.id.list);
db = new SQLiteActivity(this);
db.Write();
db.deleteAll();
db.insert("title1", "story1");
db.insert("title2","story2");
db.insert("title3", "story3");
db.close();
SHOW();
String[] adapter = new String[] { "a", "b", "c",};
ArrayAdapter<String> i = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, adapter);
listView.setAdapter(i);
so the task is to define the x in method SHOW. and put the x in the ArrayAdapter
Aucun commentaire:
Enregistrer un commentaire