retriving data from firebase and making listview with checkbox

General Tech Bugs & Fixes 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 Bugs & Fixes related to General Tech. 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

 

app is opening for view seconds then crashes. I am trying to fetch values from firebase and show in listview with checkbox.firebase contains three values that i am fetching. the values when i add from ListViewCheckboxesActivity manually like this

ArrayList<States> stateList = new ArrayList<States>();
States _states = new States("10","BHAWARKUA",false);
stateList.add(_states);

logcat error: ListViewCheckboxesActivity$1 cannot be cast to android.content.Context

Logcat error:

     Process: com.example.listview1, PID: 22931
java.lang.ClassCastException: 
     com.example.listview1.ListViewCheckboxesActivity$1 cannot be cast to android.content.Context
     at com.example.listview1.ListViewCheckboxesActivity$MyCustomAdapter.<init>(ListViewCheckboxesActivity.java:135)
     at com.example.listview1.ListViewCheckboxesActivity$1.onChildAdded(ListViewCheckboxesActivity.java:55)
    at com.google.android.gms.internal.firebase_database.zzbt.zza(Unknown Source:71)
    at com.google.android.gms.internal.firebase_database.zzgx.zzdr(Unknown Source:2)
    at com.google.android.gms.internal.firebase_database.zzhd.run(Unknown Source:71)
    at android.os.Handler.handleCallback(Handler.java:790)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:171)
    at android.app.ActivityThread.main(ActivityThread.java:6651)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal

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.