我想知道当用户打开活动时是否有办法不收到相同的消息,在我的活动中,当它打开时,如果用户返回到我想要启动的同一个活动,你会看到一条带有 toast 的消息另一条消息的代码是:
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.q_050);
//--> Type mismatch: cannot convert from String to int
Bundle value = getIntent().getExtras();
int num = value.getString("sent").toString();
if(num){
Toast.makeText(getApplicationContext(), "next message", Toast.LENGTH_SHORT).show();
}
else{
Toast.makeText(getApplicationContext(), getApplicationContext().getString(R.string.checkpoint), Toast.LENGTH_SHORT).show();
}