When i click on a listview item, the app crashes, instead of opening up another activity

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 have MainActivity.Java that has a button. When the button is clicked, it opens the GradeListActivity.java which shows a ListView(I am using Fragment here). When I click on a ListView Item, my app crashes. Any help or guidance would be much appreciated. Thank You :)

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 gd15 = new GradeData("Exam", 2, 94, "Second 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("Lab", 6
                                                
                                                
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.