Я хочу создать приложение с USSD-кодом, но не знаю, как взять и показать USSD-ответ в форме TextView
.
Я пробовал этот toturial: Использование IExtendedNetworkService для получения ответа USSD в Android< /а>
Я сделал все классы в этой теме, как показано ниже:
Затем я создал следующее MainActivity
:
public class MainActivity extends ActionBarActivity {
private EditText cartnumber_edittext,cartpass_edittext;
private Button ussd_btn;
private String cartnumber,cartpass;
private TextView uss_response_txt;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
cartnumber_edittext=(EditText) findViewById(R.id.cartnumber_edittext);
cartpass_edittext=(EditText) findViewById(R.id.cartpass_edittext);
ussd_btn=(Button) findViewById(R.id.ussd_btn);
uss_response_txt=(TextView) findViewById(R.id.uss_response_txt);
ussd_btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
cartnumber=cartnumber_edittext.getText().toString();
cartpass=cartpass_edittext.getText().toString();
USSDDumbExtendedNetworkService.mActive = false;
String USSD_code = "tel:" + "*720*2*1*2*0*"+cartnumber+"*"+cartpass+"#";
//Toast.makeText(getApplicationContext(), USSD_code, Toast.LENGTH_SHORT).show();
Intent launchCall = new Intent(Intent.ACTION_CALL,
Uri.parse("tel:" + Uri.encode(USSD_code)));
launchCall.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
launchCall.addFlags(Intent.FLAG_FROM_BACKGROUND);
startActivity(launchCall);
USSDDumbExtendedNetworkService.mActive = true;
USSDDumbExtendedNetworkService.mRetVal = null;
}
});
}
}
Не знаю как взять и показать USSD ответ в TextView
по String
. Может кто-нибудь мне помочь?