Получение ошибки: «Невозможно передать ноль для аргумента pathString в дочернем ()» в Android Studio ⇐ JAVA
-
Anonymous
Получение ошибки: «Невозможно передать ноль для аргумента pathString в дочернем ()» в Android Studio
I am trying to fetch the postid from the Real-Time Database for my Android application. However, I am not able to do so and keep encountering error. [ Can't pass null for argument 'pathString' in child() ] inside my isLiked function. The code looks like: `public void onBindViewHolder(@NonNull PostAdapter.ViewHolder holder, int position) { firebaseUser = FirebaseAuth.getInstance().getCurrentUser(); Post post = mPost.get(position);
if(post.getPostId()!=null); isLiked(post.getPostId(), holder.like);
private void isLiked(String postid, final ImageView imageView) { final FirebaseUser firebaseUser = FirebaseAuth.getInstance().getCurrentUser();
if (firebaseUser != null ) { DatabaseReference reference = FirebaseDatabase.getInstance().getReference() .child("Likes") .child(postid);` The real time database looks like: real time database for postid
I tried to bound the child with different if-else conditions, but it is not working. As we can see from the above code, I am attempting to check before getting into the isLiked function. Still, I see no progress.
Источник: https://stackoverflow.com/questions/781 ... in-android
I am trying to fetch the postid from the Real-Time Database for my Android application. However, I am not able to do so and keep encountering error. [ Can't pass null for argument 'pathString' in child() ] inside my isLiked function. The code looks like: `public void onBindViewHolder(@NonNull PostAdapter.ViewHolder holder, int position) { firebaseUser = FirebaseAuth.getInstance().getCurrentUser(); Post post = mPost.get(position);
if(post.getPostId()!=null); isLiked(post.getPostId(), holder.like);
private void isLiked(String postid, final ImageView imageView) { final FirebaseUser firebaseUser = FirebaseAuth.getInstance().getCurrentUser();
if (firebaseUser != null ) { DatabaseReference reference = FirebaseDatabase.getInstance().getReference() .child("Likes") .child(postid);` The real time database looks like: real time database for postid
I tried to bound the child with different if-else conditions, but it is not working. As we can see from the above code, I am attempting to check before getting into the isLiked function. Still, I see no progress.
Источник: https://stackoverflow.com/questions/781 ... in-android
Мобильная версия