Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Process: in.arnavvohra.arry2, PID: 31290
- java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference
- RadioButton subChannelRadioBtn= new RadioButton(getActivity());
- at in.arnavvohra.arry2.Fragments.ChannelDiscussionsFragment$2.onChildAdded(ChannelDiscussionsFragment.java:129)
- mSubChannelRef.addChildEventListener(new ChildEventListener() {
- @Override
- public void onChildAdded(DataSnapshot dataSnapshot, String s) {
- //Triggered once for each existing child & triggered again whenever a child is added to this path.
- Map<String, String> subChannelNameMap = (HashMap<String, String>) dataSnapshot.getValue();
- String key=dataSnapshot.getKey();
- String subChannelName=subChannelNameMap.values().toString();
- RadioButton subChannelRadioBtn= new RadioButton(getActivity());
- subChannelRadioBtn.setText(subChannelName);
- //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
- subChannelRadioBtn.setTag(key);
- subChannelRadioBtn.setChecked(true);//debate this, if I want to add noices in home screen
- mSubChannelRadioGrp.addView(subChannelRadioBtn);
- }
- @Override
- public void onChildChanged(DataSnapshot dataSnapshot, String s) {}
- @Override
- public void onChildRemoved(DataSnapshot dataSnapshot) {
- String key2= dataSnapshot.getKey();
- mSubChannelRadioGrp.removeView(mSubChannelRadioGrp.findViewWithTag(key2));
- //Remove the corresponding radioBtn from the radioGrp when the subChannel is removed from the db.
- }
- @Override
- public void onChildMoved(DataSnapshot dataSnapshot, String s) {}
- @Override
- public void onCancelled(DatabaseError databaseError) {}
- });
- E/AndroidRuntime: FATAL EXCEPTION: main
- Process: in.arnavvohra.arry2, PID: 31290
- java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference
- at android.view.ViewConfiguration.get(ViewConfiguration.java:383)
- at android.view.View.<init>(View.java:3700)
- at android.view.View.<init>(View.java:3797)
- at android.widget.TextView.<init>(TextView.java:690)
- at android.widget.Button.<init>(Button.java:111)
- at android.widget.CompoundButton.<init>(CompoundButton.java:85)
- at android.widget.RadioButton.<init>(RadioButton.java:65)
- at android.widget.RadioButton.<init>(RadioButton.java:61)
- at android.widget.RadioButton.<init>(RadioButton.java:57)
- at android.widget.RadioButton.<init>(RadioButton.java:53)
- at in.arnavvohra.arry2.Fragments.ChannelDiscussionsFragment$2.onChildAdded(ChannelDiscussionsFragment.java:129)
- at com.google.android.gms.internal.zzahh.zza(Unknown Source)
- at com.google.android.gms.internal.zzajh.zzctc(Unknown Source)
- at com.google.android.gms.internal.zzajk$1.run(Unknown Source)
- at android.os.Handler.handleCallback(Handler.java:739)
- at android.os.Handler.dispatchMessage(Handler.java:95)
- at android.os.Looper.loop(Looper.java:135)
- at android.app.ActivityThread.main(ActivityThread.java:5930)
- at java.lang.reflect.Method.invoke(Native Method)
- at java.lang.reflect.Method.invoke(Method.java:372)
- at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1405)
- at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1200)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement