我有一系列通知,一次出现两个以显示一系列总共 6-10 条指令(取决于 Web 服务调用的结果)。这部分代码运行良好。问题是当通过通知周期单击 BACKWARDS 时(如果您单击两个显示的通知中的任何一个,它将显示前两个通知)它在第 5 步被挂断并且不显示第 5 个通知,我遇到了一些麻烦确定原因。
截屏:
http://datasettings.site90.net/Screenshot_2013-10-03-11-37-20.png
具体来源:
private void setNotificationStrings(Bundle extras) {
TelephonyManager tm = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
// The code below sets the values of the current (field and value),
// previous, and beforePrevious
// Those hold the strings to display in the 2 notifications and the
// strings to go back to
// if the user decides to back track
if (i == count) {
done = true;
}
if (extras != null) {
if (((tm.getSimOperator()).equals(getString(R.string.numeric_tmo)))) {
Log.w(TAG, "Extras not null");
previousValue = extras.getString(getString(R.string.config_name_label));
value = extras.getString(getString(R.string.apn_label));
if (previousValue != null && value == null) {
previousField = getString(R.string.config_name_label);
previousValue = valuez.getAsString("name");
Log.w("previousValue", previousValue);
beforePreviousField = "step1";
beforePreviousValue = "> New APN";
//
field = getString(R.string.apn_label);
value = valuez.getAsString("apn");
extras.clear();
currentStep = 2;
if (i == 1) {
j++;
}
Log.d("currentStep = ", " 2");
} else {
previousValue = extras.getString(getString(R.string.apn_label));
if (proxyArr.size() > 0)// if proxy and port are not null
value = extras.getString(getString(R.string.proxy_label));
else {
value = extras.getString(getString(R.string.mmsc_label));
}
if (previousValue != null && value == null) {
previousField = getString(R.string.apn_label);
beforePreviousField = getString(R.string.config_name_label);
beforePreviousValue = valuez.getAsString("name");
if (proxyArr.size() > 0) {
field = getString(R.string.proxy_label);
value = valuez.getAsString("proxy");
} else {
field = getString(R.string.mmsc_label);
value = valuez.getAsString("mmsc");
}
extras.clear();
currentStep = 3;
Log.d("currentStep = ", " 3");
} else {
if (proxyArr.size() > 0) {// if proxy and port are not
// null
previousValue = extras.getString(getString(R.string.apn_label));
value = extras.getString(getString(R.string.port_label));
if (previousValue != null && value == null) {
previousField = getString(R.string.apn_label);
beforePreviousField = getString(R.string.config_name_label);
beforePreviousValue = valuez.getAsString("name");
field = getString(R.string.port_label);
value = valuez.getAsString("port");
extras.clear();
currentStep = 4;
Log.d("currentStep = ", " 4");
} else {
previousValue = extras.getString(getString(R.string.port_label));
value = extras.getString(getString(R.string.mmsc_label));
if (previousValue != null && value == null) {
previousField = getString(R.string.port_label);
beforePreviousField = getString(R.string.proxy_label);
beforePreviousValue = valuez.getAsString("proxy");
field = getString(R.string.mmsc_label);
value = valuez.getAsString("mmsc");
extras.clear();
currentStep = 5;
Log.d("currentStep = ", " 5");
} else {
previousValue = extras.getString(getString(R.string.port_label));
if (mmsproxyArr.size() > 0) {// if mmsproxy
// and
// mmsport
// are not
// null
value = extras.getString(getString(R.string.mms_proxy_label));
} else {
value = extras.getString(getString(R.string.type_label));
}
if (previousValue != null && value == null) {
previousField = getString(R.string.mmsc_label);
beforePreviousField = getString(R.string.port_label);
beforePreviousValue = valuez.getAsString("port");
if (mmsproxyArr.size() > 0) {
field = getString(R.string.mms_proxy_label);
value = valuez.getAsString("mmsproxy");
} else {
field = getString(R.string.type_label);
value = getString(R.string.type);
}
extras.clear();
currentStep = 6;
if (i < nameArr.size() - 1 && currentStep == 6) {
i++;
Log.d("currentStep = ", " 6");
} else {
if (mmsproxyArr.size() > 0) {// if
// mmsproxy
// and
// mmsport
// are
// not
// null
previousValue = extras.getString(getString(R.string.mms_proxy_label));
value = extras.getString(getString(R.string.mms_port_label));
if (previousValue != null && value == null) {
previousField = getString(R.string.mms_proxy_label);
beforePreviousField = getString(R.string.mmsc_label);
beforePreviousValue = valuez.getAsString("mmsc");
field = getString(R.string.mms_port_label);
value = valuez.getAsString("mmsport");
extras.clear();
currentStep = 7;
Log.d("currentStep = ", " 7");
} else {
previousValue = extras.getString(getString(R.string.mms_port_label));
value = extras.getString(getString(R.string.type_label));
if (previousValue != null && value == null) {
previousField = getString(R.string.mms_port_label);
beforePreviousField = getString(R.string.mms_proxy_label);
beforePreviousValue = valuez.getAsString("mmsproxy");
field = getString(R.string.type_label);
value = getString(R.string.type);
extras.clear();
currentStep = 8;
Log.d("currentStep = "," 8");
完整来源:
https://docs.google.com/document/d/1EjAo4bpnEjj6jExt7RY28EiA-fZIa1ExMBOfxzdGc3I/edit?usp=sharing