This is the code for the first screen and I have used all import statements for both the screens. I have a conditional statement which check if the editText Boxes or the ratingBar is empty or not.
public class BasicDetails extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.basic_details_screen);
TextView textClass = (TextView)findViewById(R.id.textClass);
TextView textSchool = (TextView)findViewById(R.id.textSchool);
TextView textPhoto = (TextView)findViewById(R.id.textPhoto);
TextView textabtYear = (TextView)findViewById(R.id.textabtYear);
final EditText editClass = (EditText)findViewById(R.id.editClass);
final EditText editSchool = (EditText)findViewById(R.id.editSchool);
final EditText abtyear = (EditText)findViewById(R.id.abtYear);
//Button buttonPhoto = (Button)findViewById(R.id.buttonPhoto);
Button buttonBnext = (Button)findViewById(R.id.buttonBnext);
buttonBnext.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Performs action on click
if ((editClass.getText().length() != 0) && (editSchool.getText().length() != 0) && (abtyear.getText().length() != 0)) {
Intent intent = new Intent(BasicDetails.this, PortfolioDetails.class);
startActivity(intent);
//opens the portfolio details class
} else {
Toast.makeText(BasicDetails.this, "Please enter all the details!!!", Toast.LENGTH_LONG).show();
}
}
});
}
}
And this is the code for the next screen. So basically there is an intent which takes you from one screen to the other but I get a error message on my emulator that"My app(or GoPort)has unfortunately stopped working"
public class PortfolioDetails extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.porfolio_details_screen);
TextView textAchievements = (TextView)findViewById(R.id.textAchievements);
TextView textProgress = (TextView)findViewById(R.id.textProgress);
TextView textFeedback = (TextView)findViewById(R.id.textFeedback);
final EditText editAchievements = (EditText)findViewById(R.id.editAchievements);
final EditText editFeedback = (EditText)findViewById(R.id.editFeedback);
final RatingBar ratingBar = (RatingBar)findViewById(R.id.ratingBar);
Button buttonCnext = (Button)findViewById(R.id.buttonCNext);
buttonCnext.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Performs action on click
if ((editAchievements.getText().length() != 0) && (editFeedback.getText().length() != 0)) {
ratingBar.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener() {
public void onRatingChanged(RatingBar ratingBar, float rating,
boolean fromUser) {
// place intent for new activity
Intent intent = new Intent(PortfolioDetails.this, SlamDetails.class);
startActivity(intent);
//opens the portfolio details class
}
});
} else {
Toast.makeText(PortfolioDetails.this, "Please enter all the details!!!", Toast.LENGTH_LONG).show();
}
}
});
}
}