aliaa agina
aliaa agina

Reputation: 31

android app crash with data base java.(lang.IllegalArgumentException: Account cannot be null)

I need some help with my code as the is working fine but crashes when opening the Favorite list https://github.com/Alyaa87/PopularMoviesStage2 any Ideas ??

Upvotes: 0

Views: 136

Answers (1)

Skizo-ozᴉʞS ツ
Skizo-ozᴉʞS ツ

Reputation: 20636

Log cat says :

Caused by: android.view.InflateException: Binary XML file line #20: ScrollView can host only one direct child Caused by: java.lang.IllegalStateException: ScrollView can host only one direct child

So change your activity_favorite.xml to this one and it should work

<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>

If you are using ScrollView make sure that inside of it it's only one child, then you can add multiple child inside.

Upvotes: 1

Related Questions