I am trying to send data from one activity to another activity using POJO class object. but if I call the get() methods the app doesn't run without the get methods the app runs package com.example.user.bankemployee;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
public class Employee implements Serializable{
private String employeeName;
private String employeeId;
private String age;
private String gender;
private String phone;
private String email;
private String city;
private List<String>skill=new ArrayList<>();
public Employee() {
}
public Employee(String employeeName, String employeeId, String age) {
this.employeeName = employeeName;
this.employeeId = employeeId;
this.age = age;
}
public String getEmployeeName() {
return employeeName;
}
public String getEmployeeId() {
return employeeId;
}
public String getAge() {
return age;
}
public List<String> getSkill() {
return skill;
}
public void setSkill(List<String> skill) {
this.skill = skill;
}
public String getGender() {
return gender;
}
public void Next(View view) {
this is the intent code
Employee employee=new Employee(empName,empId,age);
Intent intent=new Intent(this,Step2.class);
intent.putExtra("step1",employee);
startActivity(intent);
}
and this is the main activity
public class EmployeeList extends AppCompatActivity {
String empName,empId,age,Gender,phone,email,city;
List<String> skill=new ArrayList<>();
TextView tb;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_employee_list);
tb=findViewById(R.id.TB);
Employee employee=(Employee) getIntent().getSerializableExtra("step1");
empName=employee.getEmployeeName();
empId=employee.getEmployeeId();
age=employee.getAge();
if i do this it doesnt show any error other wise it the app keeps stopping
public class EmployeeList extends AppCompatActivity {
String empName,empId,age,Gender,phone,email,city;
List<String> skill=new ArrayList<>();
TextView tb;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_employee_list);
tb=findViewById(R.id.TB);
Employee employee=(Employee)
getIntent().getSerializableExtra("step1");
//empName=employee.getEmployeeName();
//empId=employee.getEmployeeId();
//age=employee.getAge();