Получение ошибки: «Невозможно передать ноль для аргумента pathString в дочернем ()» в Android StudioJAVA

Программисты JAVA общаются здесь
Ответить
Anonymous
 Получение ошибки: «Невозможно передать ноль для аргумента pathString в дочернем ()» в Android Studio

Сообщение Anonymous »


I am trying to fetch the postid from a Real-Time Database for my Android application. However, I am not able to do so and keep encountering an error inside my isLiked() function:

Can't pass null for argument 'pathString' in child() My Code:

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); // Remaining part of the code left out intentionally } // Remaining part of the code left out intentionally } 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
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «JAVA»