I want to display data in list view. Data comes from activity to fragment. 
Data get from database in activity while the adapter in fragment how to set 
the data in list item. please help me.
Here is my code:
on menu click call activity

ase R.id.action_student_add: {
    Intent intent = new Intent(getBaseContext(), StudentsActivity.class);
    intent.putExtra("SelectMode", true);
    startActivityForResult(intent, REQUEST_CODE_STUDENTS_SELECTION);
    return true;
}

 request code:

case REQUEST_CODE_STUDENTS_SELECTION: {
        ClassDetailsFragment fragment = (ClassDetailsFragment) 
getFragmentManager().findFragmentByTag(FRAGMENT_TAG_CLASS_DETAILS);
        ArrayList<Long> selectedStudentIds = (ArrayList<Long>) 
data.getSerializableExtra("StudentIds");
        DbHelper dbHelper = new DbHelper(getBaseContext());
        for (int i = 0; i < selectedStudentIds.size(); i++) {
            boolean addStudent = true;
            for (int j = 0; j < classStudents.size(); j++) {
                if (classStudents.get(j).student.id == 
selectedStudentIds.get(i)) {
                    addStudent = false;
                    break;
                }
            }
            if (addStudent) {
                data get from database
                classStudents.add(classStudent);
            }
        }
        fragment.newAddedStudents(classStudents);
       // adapterClassStudents.notifyDataSetChanged();
        dbHelper.close();
       // getListViewSize();
        break;
    }


here newAddedStudents function in frament.


public  void newAddedStudents(ArrayList<ClassStudent> classStudents){
for (ClassStudent classStudentObject : classStudents){

    Log.e("Function Perform", ""+classStudentObject.student.firstName);
    adapterEventStudents.notifyDataSetChanged();
}


}


i d'nt know how to set that classStudents in list item.

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/dbb1ce20-f6d7-419f-aaea-47b2a0975b15%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to