Im fairly new to Android development. I have a custom ListView that is populated with data from a DatabaseTable. The ListView-items consist of CATEGORY, DATE, TITLE and AMOUNT.
Since you have a custom adapter, I assume you have a custom class where you store your list data maybe like this:
public class YourListData {
private String catagory;
private String date;
public YourListData(){
}
public void setCatagory(String cat){ this.catagory = cat; }
public void setDate(String date){ this.date = date; }
public String getCatagory(){ return this.catagory; }
public String getDate() { return this.date; }
}
Now in your onItemClick
method in your Activity
get the list data like this:
mYourListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView> parent, View view, int position, long id) {
YourListData data = (YourListData) parent.getItemAtPosition(position);
String cat = data.getCatagory();
String date = data.getDate();
//...
//Send data to your fragment
}
});