SHARE
TWEET

Untitled

a guest Jun 26th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. final Handler handler = new Handler();
  2.  
  3.     final TelephonyManager.UssdResponseCallback callback = new TelephonyManager.UssdResponseCallback() {
  4.         @Override
  5.         public void onReceiveUssdResponse(TelephonyManager telephonyManager, String request, CharSequence response) {
  6.             super.onReceiveUssdResponse(telephonyManager, request, response);
  7.             //Log.e(TAG, response.toString());
  8.             //ussdScreen.setText(response.toString());
  9.         }
  10.  
  11.         @Override
  12.         public void onReceiveUssdResponseFailed(TelephonyManager telephonyManager, String request, int failureCode) {
  13.             super.onReceiveUssdResponseFailed(telephonyManager, request, failureCode);
  14.             String msg = "Ussd failed with code: " + failureCode + ", for request: " + request;
  15.             Log.e(TAG, msg);
  16.             //Toast.makeText(MainActivity.this, msg, Toast.LENGTH_LONG).show();
  17.         }
  18.     };
  19.  
  20.     dial = findViewById(R.id.dial);
  21.     dial.setOnClickListener(new View.OnClickListener() {
  22.         @Override
  23.         public void onClick(View v) {
  24.             dial.setEnabled(false);
  25.             dial(code.getText().toString(), callback, handler);
  26.         }
  27.     });
  28.  
  29.     ussdScreen = findViewById(R.id.ussdScreen);
  30.     code = findViewById(R.id.code);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top