问题描述
我在USSD号码使用此调用
I am calling on USSD number using this
字符串USSD code =*+123+ Uri.en code(#);
String ussdCode = "*" + "123" + Uri.encode("#");
startActivity(新的意向书(android.intent.action.CALL,Uri.parse(电话:+ USSD code)));
startActivity(new Intent("android.intent.action.CALL", Uri.parse("tel:" + ussdCode)));
但它显示在屏幕上的响应消息。我怎样才能清除屏幕??
But it shows the response message on screen .How can I clear these messages from the screen??
在此先感谢
推荐答案
这是不是我的解决方案。它是从这里。如果你知道俄罗斯你可以阅读整篇文章出现。不过这里是他们的孤子:
This is not my solution. It is taken from here. If you know Russian you can read the whole article there. However here is their solition:
import com.example.android.UssdMessage.USSD;
public class UssdmessageActivity extends Activity implements OnClickListener {
/** Called when the activity is first created. */
private TextView view;
private AutoCompleteTextView number;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button button = (Button) findViewById(R.id.button1);
button.setOnClickListener(this);
this.view = (TextView) findViewById(R.id.Text2);
this.number = (AutoCompleteTextView) findViewById(R.id.Text1);
}
@Override
public void onClick(View arg0) {
String encodedHash = Uri.encode("#");
call("*" + number.getText() + encodedHash);
this.view.setText("");
}
protected void call(String phoneNumber) {
try {
startActivityForResult(
new Intent("android.intent.action.CALL", Uri.parse("tel:"
+ phoneNumber)), 1);
} catch (Exception eExcept) {
this.view.append("\n\n " + "\n" + eExcept.toString());
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
USSD ussd = new USSD(4000,4000); // передается два параметра, задержка до и после (ms) создания сообщения
if (ussd.IsFound())
this.view.append("\n"+ussd.getMsg());
else
this.view.append(""+R.string.error_ussd_msg);
}
}
他们依靠此类以USSD解析。
执行这项活动后,您可以清除与USSD消息TextView的。或者,你可以完成一个活动。
After implementing this activity you can clear the TextView with the ussd message. Or you can finish an activity.
这篇关于从画面清晰USSD响应消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!