anh chị xem giúp em với, e sửa không còn lỗi nào nữa rồi mà nó vẫn không chạy được
Nếu không phiền thì có thể teamviewer máy em huhu :<
Đây là code ở MainActivity ạ:
public class MainActivity extends AppCompatActivity {
static final String tag="vong doi";
//String tenTrangThai;
//TextView txtHello;
Button btnSub1,btnSub2;
// SharedPreferences preferences;
//SharedPreferences.Editor editor;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btnSub1=findViewById(R.id.btManHinhPhu1);
btnSub2=findViewById(R.id.btManHinhPhu2);
btnSub1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent1=new
Intent (MainActivity.this,SubActivity1.class);
startActivity(intent1);
}
});
btnSub2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent2=new Intent(MainActivity.this,SubActivity2.class);
startActivity(intent2);
}
});
}
@Override
protected void onStart() {
super.onStart();
Log.i(tag,"onStart");
Toast.makeText(this,"onStart",Toast.LENGTH_LONG).show();
}
@Override
protected void onRestart() {
super.onRestart();
Log.i(tag,"onStart");
Toast.makeText(this,"onRestart",Toast.LENGTH_LONG).show();
// txtHello.setText(tenTrangThai);
}
@Override
protected void onStop() {
super.onStop();
Log.i(tag,"onStop");
Toast.makeText(this,"onStop",Toast.LENGTH_LONG).show();
}
@Override
protected void onPause() {
super.onPause();
Log.i(tag, "onPause: ");
Toast.makeText(this,"onPause",Toast.LENGTH_LONG).show();
// preferences=getSharedPreferences("Mydata",MODE_PRIVATE);
// editor=preferences.edit();
// editor.putString("ten",tenTrangThai);
// editor.commit();
}
@Override
protected void onResume() {
super.onResume();
Log.i(tag, "onResume: ");
Toast.makeText(this,"onResume",Toast.LENGTH_LONG).show();
}
@Override
protected void onDestroy() {
super.onDestroy();
Log.i(tag, "onDestroy: ");
Toast.makeText(this,"onDestroy",Toast.LENGTH_LONG).show();
}
@Override
protected void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
// outState.putString("ten",tenTrangThai);
Log.i(tag,"onsaveinstanceState");
Toast.makeText(this,"onSaveInstancestate",Toast.LENGTH_LONG).show();
}
@Override
protected void onRestoreInstanceState(@NonNull Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
// tenTrangThai=savedInstanceState.getString("ten");
Log.i(tag,"onRestoreInstanceState");
// Toast.makeText(this,"onRetoreInstanceState"+tenTrangThai,Toast.LENGTH_LONG).show();
}}