在我的代码中,我有一个广播接收器用于传入SMS。如果SMS来自特定发件人,我正在更改当前活动并启动一个新活动。 但问题是,即使我按下后退按钮时更改了活动,它也会将我带到之前的活动。如何停止将我带到之前的活动?
这是我的代码
if (message.startsWith("Welcome")) {
String[] splitArray = message.split(" "); // splits the string message from the spaces contains in it
String pin = splitArray[7]; // grab the 7th index since it contains the PIN
//Log.d("PINRead:", pin);
pin = pin.replace(".", "");
//Log.e("DotRemoved",pin);
SharedPreferences.Editor editor = PIN.edit();
editor.putString("PIN", pin);
editor.commit();
Intent i = new Intent(context, PINActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.putExtra("PIN", pin); // Pass the pin to next Activity
context.startActivity(i);
}