I want to create an application with USSD Code, but I don't know how to take and show the USSD response in a TextView
.
I've tried this toturial: Using IExtendedNetworkService to get USSD response in Android
I made all Classes that topic said like as below:
Then I created the following 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;
}
});
}
}
I don't know how to take and show USSD response in TextView
by String
.
Can any one help me?