this is how i catch data from database
private void populateFromDatabaselst() {
applications.clear();
Cursor cursor = G.database.rawQuery("SELECT * FROM app group by app_phoneNumber", null);
while (cursor.moveToNext()) {
structapplication application = new structapplication();
application.name = cursor.getString(cursor.getColumnIndex("app_name"));
application.text = cursor.getString(cursor.getColumnIndex("app_text"));
application.page = cursor.getInt(cursor.getColumnIndex("app_page"));
application.season = cursor.getString(cursor.getColumnIndex("app_season"));
application.star = cursor.getInt(cursor.getColumnIndex("app_star"));
applications.add(application);
}
cursor.close();
adapter.notifyDataSetChanged();
then i use name and season to fill the items in listview
public void fill(final ArrayAdapter<structapplication> adapter, final structapplication item, final int position) {
txttitle.setText(item.name);
txtdescription.setText(item.season);
layoutRoot.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
G.selectedApplication = item;
Intent intent = new Intent(G.currentActivity, matnasli.class);
G.currentActivity.startActivity(intent);
}
});
}
}
i grouped data in listview with this code ("SELECT * FROM app group by app_phoneNumber") but in the activity after listview is where my problems begin i cant use this code in the next activity it doesnt work properly
txtAuthor.setText(G.selectedApplication.season);
txtname.setText(G.selectedApplication.name);
txtDescription.setText(G.selectedApplication.text);
i mean for ex when u click in first item in listview i need it to show u the first coloum in the db but it shows some other column that i cant control, i need each group of datas to show its first field in the database and after that i can use a button to go to its next field in database.
Aucun commentaire:
Enregistrer un commentaire