Java problem, run time error, maybe problem occurs on numbers activity.xml file, please help, tried to configure problem but still app is not working

  android, android-studio, java, kotlin

MainActivity.java

package com.example.marathiiseasy;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import static com.example.marathiiseasy.R.id.numbers_textview;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        TextView number = (TextView) findViewById(numbers_textview);
        number.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent numberintent = new Intent(MainActivity.this, numbersActivity.class);
                startActivity(numberintent);
            }
        });
    }

activity_main.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"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">
    <TextView
        android:id="@+id/numbers_textview"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Numbers"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintHorizontal_bias="0.09"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.087"
       
        />
</androidx.constraintlayout.widget.ConstraintLayout>`

(Inside number activity .java)

package com.example.marathiiseasy;

import android.os.Bundle;
import android.util.Log;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import java.util.ArrayList;

public class numbersActivity extends AppCompatActivity {


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_numbers);


        ArrayList<String> numberswords = new ArrayList<String>();
        numberswords.add("one");
        numberswords.add("two");
        numberswords.add("three");
        numberswords.add("four");
        numberswords.add("five");
        numberswords.add("six");
        numberswords.add("seven");
        numberswords.add("eight");
        numberswords.add("nine");
        numberswords.add("ten");
        Log.v("numbersActivity","wprd at index 0"+ numberswords.get(0));
        //to connect numbers method in main xml file to this numberactivity.xml file
        LinearLayout numbersrootview;
        numbersrootview = (LinearLayout) findViewById(R.id.numbers_roottextview);

        for (int index =0;index<numberswords.size(); index++){
            TextView numobj = new TextView(this);
            numobj.setText(numberswords.get(index));
            numbersrootview.addView(numobj);
        }
    }
}

***(Inside number activity . 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"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".numbersActivity"
    android:id="@+id/numbers_roottextview">
</androidx.constraintlayout.widget.ConstraintLayout>

numbersactivity.java file

numbersactivity.xml file

mainactivity.java file
mainactivity.xml file

Help me find the problem please it may be simple error but don’t know which
Please find the run time error I want to move forward with this app.
Please help, please.

Source: Android Questions

LEAVE A COMMENT