我的应用程序说它已不幸停止工作(android 应用程序)
My app says that it has unfortunately stopped working(android app)
这是第一个屏幕的代码,我已经为两个屏幕使用了所有导入语句。我有一个条件语句,用于检查 editText 框或 ratingBar 是否为空。
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();
}
}
});
}
}
这是下一个屏幕的代码。所以基本上有一个将你从一个屏幕带到另一个屏幕的意图,但我在我的模拟器上收到一条错误消息 "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();
}
}
});
}
}
我在我的日志中得到了这个:
是的,我解决了这个问题....基本上意图没有问题
这是第一个屏幕的代码,我已经为两个屏幕使用了所有导入语句。我有一个条件语句,用于检查 editText 框或 ratingBar 是否为空。
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();
}
}
});
}
}
这是下一个屏幕的代码。所以基本上有一个将你从一个屏幕带到另一个屏幕的意图,但我在我的模拟器上收到一条错误消息 "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();
}
}
});
}
}
我在我的日志中得到了这个:
是的,我解决了这个问题....基本上意图没有问题