Having trouble populating an ListView in a Fragment

Course Queries Syllabus Queries 3 years ago

3.62K 1 0 0 0

User submissions are the sole responsibility of contributors, with TuteeHUB disclaiming liability for accuracy, copyrights, or consequences of use; content is for informational purposes only and not professional advice.

Answers (1)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 3 years ago


I am passing an object from MainActivity to GradeListActivity. In GradeListActivity I have a Fragment (which contains a ListView). I am trying to populate this ListView but whenever my app runs, GradListActivity is blank.

I debugged my program to make sure the object is being passed to the GradeListActivity and ListViewfragment (the fragment class), and it is indeed being passed in. I think i might be not populating the list in the correct place, but any help or guidance will be much appreciated.

My MainActivity.java:

public class MainActivity extends Activity 
{
    public GradeCollection gc;  
    RatingBar GradeRatingBar;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        GradeRatingBar = (RatingBar) findViewById(R.id.ratingBar);

        gc = new GradeCollection();
        GradeData gd = new GradeData("Exam", 1, 85, "First Exam");
        GradeData gd2 = new GradeData("Homework", 1, 100, "Schedule");
        GradeData gd3 = new GradeData("Homework", 2, 100, "Hello goodbye");
        GradeData gd4= new GradeData("Quiz", 1, 0, "Syllabus");
        GradeData gd5 = new GradeData("Quiz", 2, 80, "Chapter 1");
        GradeData gd6 = new GradeData("Quiz", 3, 60, "Chapter 4");
        GradeData gd7 = new GradeData("Lab", 1, 100, "Hello yankees");
        GradeData gd8 = new GradeData("Lab", 2, 100, "Manifest and Different Screens");
        GradeData gd9 = new GradeData("Lab", 3, 100, "Internalization");
        GradeData gd10 = new GradeData("Lab", 4, 100, "Layout and Controls");
        GradeData gd11 = new GradeData("Lab", 5, 100, "Easy Fragment");
        GradeData gd12 = new GradeData(
                                                
0 views
0 shares

No matter what stage you're at in your education or career, TuteeHUB will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.

Similar Forum