сбой приложения Android с базой данных Java. (lang.IllegalArgumentException: учетная запись не может быть нулевой) - PullRequest
0 голосов
/ 03 октября 2018

Мне нужна помощь с моим кодом, так как он работает нормально, но вылетает при открытии списка избранного https://github.com/Alyaa87/PopularMoviesStage2 любые идеи ??

1 Ответ

0 голосов
/ 03 октября 2018

Журнал cat говорит:

Вызывается: android.view.InflateException: строка двоичного XML-файла # 20: ScrollView может содержать только одного прямого дочернего элемента. Причины: java.lang.IllegalStateException: ScrollView можетхост только один прямой ребенок

Так что измените свой activity_favorite.xml на этот, и он должен работать

<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:padding="16dp"
    tools:context=".Favorites">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <TextView
            android:id="@+id/no_movies_tv"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/no_fav_movies"
            android:visibility="invisible" />

        <TextView
            android:id="@+id/favorite_movie_tv"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

    </LinearLayout>

</ScrollView>

Если вы используете ScrollView, убедитесь, что внутри него этотолько один дочерний элемент, то вы можете добавить несколько дочерних элементов внутри.

...