Having trouble populating an ListView in a Fragment

Course Queries Syllabus Queries 2 years ago

0 1 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Syllabus Queries related to Course Queries. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (1)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 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.