public class ProgressCircleActivity extends AppCompatActivity {
private ProgressDialog progressBar;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.progress_circle_activity);
progressBar = new ProgressDialog(ProgressCircleActivity.this);
progressBar.setMessage("Please wait ...");
progressBar.setCancelable(true);
progressBar.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progressBar.setProgress(0);
progressBar.setMax(100);
progressBar.show();
new Thread(new Runnable() {
#Override
public void run() {
try {
Thread.sleep(3*1000);
Intent i=new Intent(ProgressCircleActivity.this,PhoneNumberLogin.class);
startActivity(i);
//Remove activity
finish();
} catch (InterruptedException e) {
e.printStackTrace();
}
progressBar.dismiss();
}
}).start();
}
}
Here is my logcat
10-05 16:12:22.577 27797-27797/? E/SELinux: [DEBUG] get_category: variable seinfo: default sensitivity: NULL, cateogry: NULL
10-05 16:12:32.397 27797-27797/com.example.dis015.meetdax2danish E/WindowManager: android.view.WindowLeaked: Activity com.example.dis015.meetdax2danish.ProgressCircleActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{25b6bc4a V.E..... R......D 0,0-501,174} that was originally added here
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:520)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:287)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
at android.app.Dialog.show(Dialog.java:325)
at com.example.dis015.meetdax2danish.ProgressCircleActivity.onCreate(ProgressCircleActivity.java:25)
at android.app.Activity.performCreate(Activity.java:6575)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1134)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3143)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3300)
at android.app.ActivityThread.access$1000(ActivityThread.java:211)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1705)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6946)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
This is my splashScreenActivity when i open the app is getting crash.But in some mobiles the app is not crashing.I dont know what is the issue please help me to sort out
You did not dismiss the progressbar so it is showing that leaked window message.
Before finishing the activity please dismiss the progressbar dialog.
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.progress_circle_activity);
progressBar = new ProgressDialog(ProgressCircleActivity.this);
progressBar.setMessage("Please wait ...");
progressBar.setCancelable(true);
progressBar.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progressBar.setProgress(0);
progressBar.setMax(100);
progressBar.show();
new Thread(new Runnable() {
#Override
public void run() {
try {
Thread.sleep(3*1000);
Intent i=new Intent(ProgressCircleActivity.this,PhoneNumberLogin.class);
startActivity(i);//dismiss the progressdialog
progressBar.dismiss();
//Remove activity
finish();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}).start();
}
Related
This question already has answers here:
What is a NullPointerException, and how do I fix it?
(12 answers)
Closed 5 years ago.
My application has a Progress Dialog for login process and when the orientation is changed while dialog box is open, app crashes.This all works fine, except when screen orientation changes while the dialog is up. At this point the app crashes. I am figuring out this issue from the last 3 nights but not able to get it, please help.
My fragment:
public class Example extends Fragment {
private static final String TAG = "LoginActivity";
private static final int REQUEST_SIGNUP = 0;
Unbinder unbinder;
#BindView(R.id.input_email) EditText _emailText;
#BindView(R.id.input_password) EditText _passwordText;
#BindView(R.id.btn_login) Button _loginButton;
#BindView(R.id.link_signup) TextView _signupLink;
#Override
public void onDestroyView() {
super.onDestroyView();
// unbind the view to free some memory
unbinder.unbind();
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.Example, container, false);
unbinder=ButterKnife.bind(this,rootView);
_loginButton.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
login();
}
});
_signupLink.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view)
{
Intent create= new Intent(getActivity(),NewAccount.class);
startActivity(create);
}
});
return rootView;
}
public void login() {
Log.d(TAG, "Login");
if (!validate()) {
onLoginFailed();
return;
}
_loginButton.setEnabled(false);
final ProgressDialog progressDialog = new ProgressDialog(getActivity(),
R.style.AppTheme_Dark_Dialog);
progressDialog.setIndeterminate(true);
progressDialog.setMessage("Authenticating...");
progressDialog.show();
//new YourAsynTask(getActivity()).execute();
String email = _emailText.getText().toString();
String password = _passwordText.getText().toString();
// TODO: Implement your own authentication logic here.
new android.os.Handler().postDelayed(
new Runnable() {
public void run() {
// On complete call either onLoginSuccess or onLoginFailed
onLoginSuccess();
// onLoginFailed();
progressDialog.dismiss();
}
}, 3000);
}
#Override
public void onPause() {
Log.e("DEBUG", "OnPause of loginFragment1");
super.onPause();
}
public void onLoginSuccess() {
_loginButton.setEnabled(true);
Intent i=new Intent(getActivity(),SuccessLogin.class);
startActivity(i);
}
public void onLoginFailed() {
Toast.makeText(getActivity(), "Login failed", Toast.LENGTH_LONG).show();
_loginButton.setEnabled(true);
}
public boolean validate() {
boolean valid = true;
String email = _emailText.getText().toString();
String password = _passwordText.getText().toString();
if (email.isEmpty() || !android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches()) {
_emailText.setError("enter a valid email address");
valid = false;
} else {
_emailText.setError(null);
}
if (password.isEmpty() || password.length() < 4 || password.length() > 10) {
_passwordText.setError("between 4 and 10 alphanumeric characters");
valid = false;
} else {
_passwordText.setError(null);
}
return valid;
}
Logcat output:
11-16 19:20:10.955 4022-4022/com.example.a1332931.login_application E/WindowManager: android.view.WindowLeaked: Activity com.example.a1332931.login_application.TabActivity has leaked window com.android.internal.policy.PhoneWindow$DecorView{42b6135 V.E...... R......D 0,0-683,232} that was originally added here
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:375)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:299)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:85)
at android.app.Dialog.show(Dialog.java:319)
at com.example.a1332931.login_application.Example.login(Example.java:156)
at com.example.a1332931.login_application.Example$1.onClick(Example.java:67)
at android.view.View.performClick(View.java:5201)
at android.view.View$PerformClick.run(View.java:21163)
at android.os.Handler.handleCallback(Handler.java:746)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
11-16 19:20:10.957 4022-4095/com.example.a1332931.login_application E/Surface: getSlotFromBufferLocked: unknown buffer: 0xb8aa6c60
11-16 19:20:12.512 4022-4022/com.example.a1332931.login_application E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.a1332931.login_application, PID: 4022
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setEnabled(boolean)' on a null object reference
at com.example.a1332931.login_application.Example.onLoginSuccess(Example.java:200)
at com.example.a1332931.login_application.Example$3.run(Example.java:168)
at android.os.Handler.handleCallback(Handler.java:746)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
Add this configuration change in your Android manifest activity:
<activity
android:name="YourActivity"
android:configChanges="orientation|keyboardHidden|screenSize"/>
I have an AlertDialog it works fine but I noticed that it marks me an error in the line where I put dialog.show (); I do not know how I could solve it.
IngresarAdmin.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
final AlertDialog.Builder mBuilder=new AlertDialog.Builder(InicioSesion_Principal.this);
View Mview= getLayoutInflater().inflate(R.layout.zona_restrigida,null);
final EditText claveAdmin=(EditText)Mview.findViewById(R.id.Clave_proveedor);
Button EntrarClaveAdmin=(Button)Mview.findViewById(R.id.Ingresar_clave_proovedor);
EntrarClaveAdmin.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
if (!claveAdmin.getText().toString().isEmpty()){
Intent intent=new Intent(getApplicationContext(), menu_administrador.class);
startActivity(intent);
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
finish();
}
else {
Toast.makeText(InicioSesion_Principal.this,"Clave incorrecta",Toast.LENGTH_SHORT).show();
}
}
});
mBuilder.setView(Mview);
AlertDialog dialog=mBuilder.create();
dialog.show();
}
});
This is the error that shows me in the dialog.show();
It does not close the application at any time, but how can I fix it?
android.view.WindowLeaked: Activity com.tienda.app.aplicaciontienda.Iniciar_Sesion_3.InicioSesion_Principal has leaked window com.android.internal.policy.PhoneWindow$DecorView{245d004 V.E...... R......D 0,0-683,503} that was originally added here
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:375)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:299)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:85)
at android.app.Dialog.show(Dialog.java:319)
at com.tienda.app.aplicaciontienda.Iniciar_Sesion_3.InicioSesion_Principal$3.onClick(InicioSesion_Principal.java:119)
at android.view.View.performClick(View.java:5201)
at android.view.View$PerformClick.run(View.java:21163)
at android.os.Handler.handleCallback(Handler.java:746)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
try using dialog.create().show();
I had the same problem.
You need to call .dismiss();
if(dialog != null)
dialog.dismiss();
im trying to make a splash screen, the codes showing no errors, build succesfully, but when it started,it shows this message at the apps
and when i check the log on android monitor, it show these messages
08-07 05:41:23.709 16344-16344/com.android.andika.soundsmart E/WindowManager: android.view.WindowLeaked: Activity com.android.andika.soundsmart.SplashS has leaked window DecorView#e044f4c[] that was originally added here
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:418)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:331)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:94)
at android.app.Dialog.show(Dialog.java:329)
at android.app.AlertDialog$Builder.show(AlertDialog.java:1112)
at android.app.Activity.performStart(Activity.java:6723)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2662)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2766)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1507)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6236)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:891)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:781)
this is the code from my splashscreen class
public class SplashS extends AppCompatActivity {
ProgressBar progressBar;
int status = 0;
int proses = 0;
Handler handle = new Handler();
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash_s);
getSupportActionBar().setTitle("SPLASHSREEN");
ActionBar ab = getSupportActionBar();
ab.hide();
progressBar = (ProgressBar) findViewById(R.id.tunggu);
new Thread(new Runnable() {
#Override
public void run() {
while(status<100){
status = loading();
handle.post(new Runnable() {
#Override
public void run() {
progressBar.setProgress(status);
}
});
}
handle.post(new Runnable() {
#Override
public void run() {
Intent pindah = new Intent(SplashS.this,MenuS.class);
startActivity(pindah);
finish();
}
});
}
private int loading() {
try{
Thread.sleep(45);
}
catch(InterruptedException ie){
ie.printStackTrace();
}
return ++proses;
}
}).start();
}
}
i debug the app via an android phone with android N 7.1 OS.
i'll appreciate any answer, advice, or response. thanks :)
i think that error related to showing dialog where the activity is dismissed , but your code does not showing any dialogs so check if you are using 3rd party libraries which can do that
hi I am using google license checker on my app it works on API 19 and below but crashes on lollipop. I saw the code that has to be add to my license check code but I don't know where to put this code or what should I edit. here is my code
log:
java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.android.vending.licensing.ILicensingService }
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.android.vending.licensing.ILicensingService }
at android.app.ContextImpl.validateServiceIntent(ContextImpl.java:1674)
at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1773)
at android.app.ContextImpl.bindService(ContextImpl.java:1751)
at android.content.ContextWrapper.bindService(ContextWrapper.java:538)
at com.google.android.vending.licensing.LicenseChecker.checkAccess(LicenseChecker.java:150)
at appinventor.ai_drsalmanshah165.Clinical_Examination.Splash.doCheck(Splash.java:103)
at appinventor.ai_drsalmanshah165.Clinical_Examination.Splash.onCreate(Splash.java:51)
at android.app.Activity.performCreate(Activity.java:5933)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
... 10 more
Java code:
public class Splash extends Activity {
MyLicenseCheckerCallback mLicenseCheckerCallback;
LicenseChecker mChecker;
byte[] SALT = new byte[] {
my salt no. };
//Handler mHandler;
String BASE64_PUBLIC_KEY="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoxvDF3HGQtrRch14wCPN6nAxasak8X4shJM6bCumNS+6xRXTnRZOSyAvHNa1145KlE/i1sy/";
Context mContext;
IBinder serviceBinder;
String deviceId;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.splash);
mLicenseCheckerCallback = new MyLicenseCheckerCallback();
deviceId = Secure.getString(getContentResolver(), Secure.ANDROID_ID);
// Construct the LicenseChecker with a policy.
mChecker = new LicenseChecker(
this, (Policy) new ServerManagedPolicy(Splash.this, new AESObfuscator(SALT, getPackageName(), deviceId)),
BASE64_PUBLIC_KEY);
doCheck();
}
private class MyLicenseCheckerCallback implements LicenseCheckerCallback {
#Override
public void allow(int reason) {
// TODO Auto-generated method stub
if (isFinishing()) {
// Don't update UI if Activity is finishing.
return;
}
// Toast.makeText(Splash.this, "License Verified", Toast.LENGTH_SHORT).show();
Intent intent=new Intent(Splash.this,Home.class);
startActivity(intent);
finish();
// Should allow user access.
// so do nothing
}
#Override
public void dontAllow(int reason) {
// TODO Auto-generated method stub
if (isFinishing()) {
// Don't update UI if Activity is finishing.
return;
}
// Toast.makeText(Splash.this, "License Verification Failed", Toast.LENGTH_SHORT).show();
createDialog();
}
#Override
public void applicationError(int errorCode) {
// TODO Auto-generated method stub
}
}
#Override
protected void onDestroy() {
super.onDestroy();
mChecker.onDestroy();
}
private void doCheck() {
// mCheckLicenseButton.setEnabled(false);
setProgressBarIndeterminateVisibility(true);
/// mStatusText.setText(R.string.checking_license);
mChecker.checkAccess(mLicenseCheckerCallback);
}
public void createDialog(){
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("PIRACY WARNING");
builder.setMessage("This application is not licensed. Please purchase it from Android Market. If you received this message in error, please contact Support.");
builder.setPositiveButton("Buy Now", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(
"http://market.android.com/details?id=" + getPackageName()));
startActivity(marketIntent);
}
});
builder.setNegativeButton("Quit", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
finish();
}
});
AlertDialog dialog = builder.create();
dialog.show();
}
}
and here is the other code which I got that this can solve my problem. but don't know where to put it.
Intent serviceIntent = new Intent(
new String(Base64.decode("Y29tLmFuZHJvaWQudmVuZGluZy5saWNlbnNpbmcuSUxpY2Vuc2luZ1NlcnZpY2U=")));
serviceIntent.setPackage("com.android.vending");
boolean bindResult = mContext
.bindService(
serviceIntent,
this, // ServiceConnection.
Context.BIND_AUTO_CREATE);
Waiting for an official solution, the current solution consists in patching Google's LicenseChecker class
com.google.android.vending.licensing.LicenseChecker.checkAccess(LicenseChecker.java:150)
like this:
new String(
- Base64.decode("Y29tLmFuZHJvaWQudmVuZGluZy5saWNlbnNpbmcuSUxpY2Vuc2luZ1NlcnZpY2U="))),
+ Base64.decode("Y29tLmFuZHJvaWQudmVuZGluZy5saWNlbnNpbmcuSUxpY2Vuc2luZ1NlcnZpY2U=")))
+ .setPackage("com.android.vending"), // this fix the 'IllegalArgumentException: Service Intent must be explicit'
this, // ServiceConnection.
Adding package name with statement setPackage("com.android.vending") makes the Intent explicit, i.e., 'safe' (as requested by Android Lollipop )
Note:
Please pay attention as after modifying LicenseChecker class you must change the min sdk version from 3 to 4 (thanks russellhoff)
Source:
https://code.google.com/p/android/issues/detail?id=78505#c19
I try to intercept outgoing calls and open a pop up
(Receiver --> FragmentActivity --> PopUpFragment)
Im using roboguice for android
however my code crashes with this error:
01-01 10:32:41.396 13265-13265/com.example.stopcall.app E/﹕ mali: REVISION=Linux-r3p2-01rel3 BUILD_DATE=Fri Mar 21 13:52:50 KST 2014
01-01 10:32:41.931 13265-13265/com.example.stopcall.app E/ActivityThread﹕ Performing stop of activity that is not resumed: {com.example.stopcall.app/com.example.stopcall.app.activities.MainActivity}
java.lang.RuntimeException: Performing stop of activity that is not resumed: {com.example.stopcall.app/com.example.stopcall.app.activities.MainActivity}
at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:3463)
at android.app.ActivityThread.handleStopActivity(ActivityThread.java:3550)
at android.app.ActivityThread.access$1200(ActivityThread.java:175)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1335)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5602)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
here is my code:
public class OutgoingCallReceiver extends RoboBroadcastReceiver {
public static final String ABORT_PHONE_NUMBER = "0055";
private static final String OUTGOING_CALL_ACTION = "android.intent.action.NEW_OUTGOING_CALL";
private static final String INTENT_PHONE_NUMBER = "android.intent.extra.PHONE_NUMBER";
#Override
protected void handleReceive(Context context, Intent intent) {
super.handleReceive(context, intent);
Intent i = new Intent(context, PopupActivity.class);
i.putExtra(Constants.DIALED_PHONE, phoneDal.getItem(phoneNumber));
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
setResultData(null);
}
and
public class PopupActivity extends RoboFragmentActivity implements
YesNoDialogFragment.YesNoDialogFragmentListener {
#Inject PhoneDal phoneDal;
public Phone phone;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_main);
//
// btnEditName = (Button) findViewById(R.id.btn_edit);
// txtName = (TextView) findViewById(R.id.txt_name);
//
// btnEditName.setOnClickListener(this);
phone = getIntent().getParcelableExtra(Constants.DIALED_PHONE);
exportDatabase(Constants.DB_NAME);
showYesNoDialog();
}
// The dialog fragment receives a reference to this Activity through the
// Fragment.onAttach() callback, which it uses to call the following methods
// defined by the NoticeDialogFragment.NoticeDialogListener interface
#Override
public void onDialogPositiveClick() {
persistNumberIsAllowed();
SendDialIntent();
finish();
}
private void SendDialIntent() {
Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel" + phone.phone));
startActivity(intent);
}