Advertisement
Guest User

Untitled

a guest
Jul 26th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.61 KB | None | 0 0
  1. Process: in.arnavvohra.arry2, PID: 31290
  2. java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference
  3.  
  4. RadioButton subChannelRadioBtn= new RadioButton(getActivity());
  5.  
  6. at in.arnavvohra.arry2.Fragments.ChannelDiscussionsFragment$2.onChildAdded(ChannelDiscussionsFragment.java:129)
  7.  
  8. mSubChannelRef.addChildEventListener(new ChildEventListener() {
  9.  
  10. @Override
  11. public void onChildAdded(DataSnapshot dataSnapshot, String s) {
  12.  
  13. //Triggered once for each existing child & triggered again whenever a child is added to this path.
  14. Map<String, String> subChannelNameMap = (HashMap<String, String>) dataSnapshot.getValue();
  15.  
  16. String key=dataSnapshot.getKey();
  17. String subChannelName=subChannelNameMap.values().toString();
  18.  
  19. RadioButton subChannelRadioBtn= new RadioButton(getActivity());
  20.  
  21. subChannelRadioBtn.setText(subChannelName);
  22. //Setting a tag on the radio btn so that it can be deleted from radioGroup when onChildRemoved is called i.e a subChannel is deleted
  23. subChannelRadioBtn.setTag(key);
  24. subChannelRadioBtn.setChecked(true);//debate this, if I want to add noices in home screen
  25.  
  26. mSubChannelRadioGrp.addView(subChannelRadioBtn);
  27. }
  28.  
  29. @Override
  30. public void onChildChanged(DataSnapshot dataSnapshot, String s) {}
  31.  
  32. @Override
  33. public void onChildRemoved(DataSnapshot dataSnapshot) {
  34. String key2= dataSnapshot.getKey();
  35. mSubChannelRadioGrp.removeView(mSubChannelRadioGrp.findViewWithTag(key2));
  36. //Remove the corresponding radioBtn from the radioGrp when the subChannel is removed from the db.
  37. }
  38.  
  39. @Override
  40. public void onChildMoved(DataSnapshot dataSnapshot, String s) {}
  41.  
  42. @Override
  43. public void onCancelled(DatabaseError databaseError) {}
  44. });
  45.  
  46. E/AndroidRuntime: FATAL EXCEPTION: main
  47. Process: in.arnavvohra.arry2, PID: 31290
  48. java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference
  49. at android.view.ViewConfiguration.get(ViewConfiguration.java:383)
  50. at android.view.View.<init>(View.java:3700)
  51. at android.view.View.<init>(View.java:3797)
  52. at android.widget.TextView.<init>(TextView.java:690)
  53. at android.widget.Button.<init>(Button.java:111)
  54. at android.widget.CompoundButton.<init>(CompoundButton.java:85)
  55. at android.widget.RadioButton.<init>(RadioButton.java:65)
  56. at android.widget.RadioButton.<init>(RadioButton.java:61)
  57. at android.widget.RadioButton.<init>(RadioButton.java:57)
  58. at android.widget.RadioButton.<init>(RadioButton.java:53)
  59. at in.arnavvohra.arry2.Fragments.ChannelDiscussionsFragment$2.onChildAdded(ChannelDiscussionsFragment.java:129)
  60. at com.google.android.gms.internal.zzahh.zza(Unknown Source)
  61. at com.google.android.gms.internal.zzajh.zzctc(Unknown Source)
  62. at com.google.android.gms.internal.zzajk$1.run(Unknown Source)
  63. at android.os.Handler.handleCallback(Handler.java:739)
  64. at android.os.Handler.dispatchMessage(Handler.java:95)
  65. at android.os.Looper.loop(Looper.java:135)
  66. at android.app.ActivityThread.main(ActivityThread.java:5930)
  67. at java.lang.reflect.Method.invoke(Native Method)
  68. at java.lang.reflect.Method.invoke(Method.java:372)
  69. at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1405)
  70. at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1200)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement