Android App Is Stopping And Pointing Towards home_fragment

I have made an app that is stopping and pointing towards home_fragment line number 16

More Precise Logcat

java.lang.OutOfMemoryError: Failed to allocate a 285344364 byte allocation with 4194304 free bytes and 69MB until OOM at com.eco.hrmecoservices.home_fragment.onCreateView(home_fragment.java:16)

home_fragment.java

package com.eco.hrmecoservices;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

public class home_fragment extends Fragment {
    @Nullable
    @org.jetbrains.annotations.Nullable
    @Override
    public View onCreateView(@NonNull @org.jetbrains.annotations.NotNull LayoutInflater inflater, @Nullable @org.jetbrains.annotations.Nullable ViewGroup container, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_home, container,false);
        return rootView;
    }
}

fragment_home.xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scrollbars="none"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >

            

        <com.google.android.material.card.MaterialCardView
            android:id="@+id/home"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="8dp">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <!-- Media -->
                <ImageView
                    android:layout_width="match_parent"
                    android:layout_height="194dp"
                    app:srcCompat="@drawable/house"
                    android:scaleType="centerCrop"
                    android:contentDescription="Home Cleaning"
                    />

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:padding="16dp">

                    <!-- Title, secondary and supporting text -->
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Home Cleaning"
                        android:textAppearance="?attr/textAppearanceHeadline6"
                        />
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="8dp"
                        android:text="Full Home Cleaning"
                        android:textAppearance="?attr/textAppearanceBody2"
                        android:textColor="?android:attr/textColorSecondary"
                        />
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="16dp"
                        android:text="Lose the mop and we'll clean the slop"
                        android:textAppearance="?attr/textAppearanceBody2"
                        android:textColor="?android:attr/textColorSecondary"
                        />

                </LinearLayout>

                <!-- Buttons -->
                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_margin="8dp"
                    android:orientation="horizontal">
                    <com.google.android.material.button.MaterialButton
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginEnd="8dp"
                        android:text="Check This Out!!"
                        style="?attr/borderlessButtonStyle"
                        />
                </LinearLayout>

            </LinearLayout>

        </com.google.android.material.card.MaterialCardView>
        <com.google.android.material.card.MaterialCardView
            android:id="@+id/room"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="8dp">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <!-- Media -->
                <ImageView
                    android:layout_width="match_parent"
                    android:layout_height="194dp"
                    app:srcCompat="@drawable/room"
                    android:scaleType="centerCrop"
                    android:contentDescription="Room Cleaning"
                    />

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:padding="16dp">

                    <!-- Title, secondary and supporting text -->
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Room Cleaning"
                        android:textAppearance="?attr/textAppearanceHeadline6"
                        />
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="8dp"
                        android:text="Full Room Cleaning"
                        android:textAppearance="?attr/textAppearanceBody2"
                        android:textColor="?android:attr/textColorSecondary"
                        />
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="16dp"
                        android:text="Avoid A Dirty Scene, Keep This House Clean"
                        android:textAppearance="?attr/textAppearanceBody2"
                        android:textColor="?android:attr/textColorSecondary"
                        />

                </LinearLayout>

                <!-- Buttons -->
                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_margin="8dp"
                    android:orientation="horizontal">
                    <com.google.android.material.button.MaterialButton
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginEnd="8dp"
                        android:text="Check This Out!!"
                        style="?attr/borderlessButtonStyle"
                        />
                </LinearLayout>

            </LinearLayout>

        </com.google.android.material.card.MaterialCardView>
        <com.google.android.material.card.MaterialCardView
            android:id="@+id/sofa"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="8dp">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <!-- Media -->
                <ImageView
                    android:layout_width="match_parent"
                    android:layout_height="194dp"
                    app:srcCompat="@drawable/sofa"
                    android:scaleType="centerCrop"
                    android:contentDescription="Sofa Cleaning"
                    />

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:padding="16dp">

                    <!-- Title, secondary and supporting text -->
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Sofa Cleaning"
                        android:textAppearance="?attr/textAppearanceHeadline6"
                        />
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="8dp"
                        android:text="Full Sofa Cleaning"
                        android:textAppearance="?attr/textAppearanceBody2"
                        android:textColor="?android:attr/textColorSecondary"
                        />
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="16dp"
                        android:text="One Call. No Mess Is Too Small."
                        android:textAppearance="?attr/textAppearanceBody2"
                        android:textColor="?android:attr/textColorSecondary"
                        />

                </LinearLayout>

                <!-- Buttons -->
                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_margin="8dp"
                    android:orientation="horizontal">
                    <com.google.android.material.button.MaterialButton
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginEnd="8dp"
                        android:text="Check This Out!!"
                        style="?attr/borderlessButtonStyle"
                        />
                </LinearLayout>

            </LinearLayout>

        </com.google.android.material.card.MaterialCardView>
        <com.google.android.material.card.MaterialCardView
            android:id="@+id/kitchen"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="8dp">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <!-- Media -->
                <ImageView
                    android:layout_width="match_parent"
                    android:layout_height="194dp"
                    app:srcCompat="@drawable/kitchen"
                    android:scaleType="centerCrop"
                    android:contentDescription="Kitchen Cleaning"
                    />

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:padding="16dp">

                    <!-- Title, secondary and supporting text -->
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Kitchen Cleaning"
                        android:textAppearance="?attr/textAppearanceHeadline6"
                        />
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="8dp"
                        android:text="Full Kitchen Cleaning"
                        android:textAppearance="?attr/textAppearanceBody2"
                        android:textColor="?android:attr/textColorSecondary"
                        />
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="16dp"
                        android:text="Gift Yourself A Clean And Healthy Kitchen"
                        android:textAppearance="?attr/textAppearanceBody2"
                        android:textColor="?android:attr/textColorSecondary"
                        />

                </LinearLayout>

                <!-- Buttons -->
                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_margin="8dp"
                    android:orientation="horizontal">
                    <com.google.android.material.button.MaterialButton
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginEnd="8dp"
                        android:text="Check This Out!!"
                        style="?attr/borderlessButtonStyle"
                        />
                </LinearLayout>

            </LinearLayout>

        </com.google.android.material.card.MaterialCardView>

        <com.google.android.material.card.MaterialCardView
            android:id="@+id/carpet"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="8dp">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <!-- Media -->
                <ImageView
                    android:layout_width="match_parent"
                    android:layout_height="194dp"
                    app:srcCompat="@drawable/carpet"
                    android:scaleType="centerCrop"
                    android:contentDescription="Carpet Cleaning"
                    />

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:padding="16dp">

                    <!-- Title, secondary and supporting text -->
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Carpet Cleaning"
                        android:textAppearance="?attr/textAppearanceHeadline6"
                        />
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="8dp"
                        android:text="Full Carpet Cleaning"
                        android:textAppearance="?attr/textAppearanceBody2"
                        android:textColor="?android:attr/textColorSecondary"
                        />
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="16dp"
                        android:text="Your Carpets Have The Right To Remain Clean"
                        android:textAppearance="?attr/textAppearanceBody2"
                        android:textColor="?android:attr/textColorSecondary"
                        />

                </LinearLayout>

                <!-- Buttons -->
                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_margin="8dp"
                    android:orientation="horizontal">
                    <com.google.android.material.button.MaterialButton
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginEnd="8dp"
                        android:text="Check This Out!!"
                        style="?attr/borderlessButtonStyle"
                        />
                </LinearLayout>

            </LinearLayout>

        </com.google.android.material.card.MaterialCardView>
        <com.google.android.material.card.MaterialCardView
            android:id="@+id/car"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="8dp">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <!-- Media -->
                <ImageView
                    android:layout_width="match_parent"
                    android:layout_height="194dp"
                    app:srcCompat="@drawable/car"
                    android:scaleType="centerCrop"
                    android:contentDescription="Car Cleaning"
                    />

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:padding="16dp">

                    <!-- Title, secondary and supporting text -->
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Car Cleaning"
                        android:textAppearance="?attr/textAppearanceHeadline6"
                        />
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="8dp"
                        android:text="Full Car Cleaning"
                        android:textAppearance="?attr/textAppearanceBody2"
                        android:textColor="?android:attr/textColorSecondary"
                        />
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="16dp"
                        android:text="We’ve Got A Lust for Dust"
                        android:textAppearance="?attr/textAppearanceBody2"
                        android:textColor="?android:attr/textColorSecondary"
                        />

                </LinearLayout>

                <!-- Buttons -->
                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_margin="8dp"
                    android:orientation="horizontal">
                    <com.google.android.material.button.MaterialButton
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginEnd="8dp"
                        android:text="Check This Out!!"
                        style="?attr/borderlessButtonStyle"
                        />
                </LinearLayout>

            </LinearLayout>

        </com.google.android.material.card.MaterialCardView>
        <com.google.android.material.card.MaterialCardView
            android:id="@+id/bathroom"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="8dp">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <!-- Media -->
                <ImageView
                    android:layout_width="match_parent"
                    android:layout_height="194dp"
                    app:srcCompat="@drawable/bathroom"
                    android:scaleType="centerCrop"
                    android:contentDescription="Bathroom Cleaning"
                    />

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:padding="16dp">

                    <!-- Title, secondary and supporting text -->
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Bathroom Cleaning"
                        android:textAppearance="?attr/textAppearanceHeadline6"
                        />
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="8dp"
                        android:text="Full Bathroom Cleaning"
                        android:textAppearance="?attr/textAppearanceBody2"
                        android:textColor="?android:attr/textColorSecondary"
                        />
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="16dp"
                        android:text="You Have Better Things To Do"
                        android:textAppearance="?attr/textAppearanceBody2"
                        android:textColor="?android:attr/textColorSecondary"
                        />

                </LinearLayout>

                <!-- Buttons -->
                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_margin="8dp"
                    android:orientation="horizontal">
                    <com.google.android.material.button.MaterialButton
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginEnd="8dp"
                        android:text="Check This Out!!"
                        style="?attr/borderlessButtonStyle"
                        />
                </LinearLayout>

            </LinearLayout>

        </com.google.android.material.card.MaterialCardView>
        <com.google.android.material.card.MaterialCardView
            android:id="@+id/toilet"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="8dp">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <!-- Media -->
                <ImageView
                    android:layout_width="match_parent"
                    android:layout_height="194dp"
                    app:srcCompat="@drawable/toilet"
                    android:scaleType="centerCrop"
                    android:contentDescription="Toilet Cleaning"
                    />

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:padding="16dp">

                    <!-- Title, secondary and supporting text -->
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Toilet Cleaning"
                        android:textAppearance="?attr/textAppearanceHeadline6"
                        />
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="8dp"
                        android:text="Full Toilet Cleaning"
                        android:textAppearance="?attr/textAppearanceBody2"
                        android:textColor="?android:attr/textColorSecondary"
                        />
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="16dp"
                        android:text="We Create The Perfect Shine. Every time"
                        android:textAppearance="?attr/textAppearanceBody2"
                        android:textColor="?android:attr/textColorSecondary"
                        />

                </LinearLayout>

                <!-- Buttons -->
                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_margin="8dp"
                    android:orientation="horizontal">
                    <com.google.android.material.button.MaterialButton
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginEnd="8dp"
                        android:text="Check This Out!!"
                        style="?attr/borderlessButtonStyle"
                        />
                </LinearLayout>

            </LinearLayout>

        </com.google.android.material.card.MaterialCardView>
        </LinearLayout>
    </ScrollView>


</androidx.constraintlayout.widget.ConstraintLayout>


Read more here: https://stackoverflow.com/questions/68463658/android-app-is-stopping-and-pointing-towards-home-fragment

Content Attribution

This content was originally published by Krishna Wadhwani at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: