我试图从recyclerView的意图中获取更多内容,并详细显示它,但是当我尝试时,出现了一个
java.lang.NullPointerException错误:尝试调用虚拟 null上的方法'java.lang.String java.lang.Object.toString()' 对象引用
public class NotifDetailAct extends AppCompatActivity {
DatabaseReference reference;
TextView xdeskripsi;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_notif_detail);
xdeskripsi = (TextView) findViewById(R.id.xdeskripsi);
Bundle bundle = getIntent().getExtras();
final String tittle_baru = bundle.getString("tittle");
reference = FirebaseDatabase.getInstance().getReference().child("notif").child(tittle_baru);
reference.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
xdeskripsi.setText(dataSnapshot.child("isi_notif").getValue().toString());
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
}
java.lang.NullPointerException错误:尝试调用虚拟 null上的方法'java.lang.String java.lang.Object.toString()' 对象引用