I have created one activity and i have stored my data in another class with encapsulation and from that class, I am not able to retrieve my data to the text field of another class. below is the code please help me so solve. when I run the app I am getting nothing on the screen.
Name.java
package com.example.voiceprescription;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.icu.text.IDNA;
import android.os.Bundle;
import android.speech.RecognizerIntent;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.Toast;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import java.util.ArrayList;
import java.util.Locale;
public class Name extends AppCompatActivity {
    EditText et_Nname,et_Nage,et_Nphone;
    RadioButton rb_Nmale,rb_Nfemale;
    Button btn_Nnext;enter code here
    ImageButton ib_Nvoice;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_name);
        et_Nphone=findViewById(R.id.et_Nphone);
        et_Nname=findViewById(R.id.et_Nname);
        et_Nage=findViewById(R.id.et_Nage);
        ib_Nvoice=findViewById(R.id.ib_Nvoice);
        rb_Nfemale=findViewById(R.id.rb_Nfemale);
        rb_Nmale=findViewById(R.id.rb_Nmale);
        btn_Nnext=findViewById(R.id.btn_Nnext);
        btn_Nnext.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String name=et_Nname.getText().toString().trim();
                String age=et_Nage.getText().toString().trim();
                String phone=et_Nphone.getText().toString().trim();
               PersonInfo personInfo=new PersonInfo();
               personInfo.setName(name);
               personInfo.setAge(age);
               personInfo.setPhone(phone);
               Intent intent=new Intent(Name.this,Symptoms.class);
               startActivity(intent);
            }
        });
    }
}
Personinfo.java
package com.example.voiceprescription;
public class PersonInfo {
    private String name;
    private String age;
    private String phone;
    private String gender;
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getAge() {
        return age;
    }
    public void setAge(String age) {
        this.age = age;
    }
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
    public String getGender() {
        return gender;
    }
    public void setGender(String gender) {
        this.gender = gender;
    }
}
symptoms.java
package com.example.voiceprescription;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;
public class Symptoms extends AppCompatActivity {
    TextView tv1;
    PersonInfo personInfo;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_symptoms);
        personInfo=new PersonInfo();
        tv1=findViewById(R.id.tv1);
        tv1.setText(personInfo.getName());
    }
}
 
    