I checking when the activity starts up whether Location Services are turned on or not, if not I am opening a dialog that starts the "Enable Location Activity" intent. Once I am returning from it I am checking if the location has really been enabled or not, if so I am dismissing the alert dialog.
In theory this should work, but when my activity resumes and call dialog.dismiss() absolutely nothing happens.
My code is as follows-:
public class LocationUtils {
private static AlertDialog dialog_ = null;
public static void checkAndEnableLocationServices(final Activity context) {
LocationManager lm = (LocationManager) context.getSystemService(context.LOCATION_SERVICE);
boolean gps_enabled = false;
boolean network_enabled = false;
try {
gps_enabled = lm.isProviderEnabled(LocationManager.GPS_PROVIDER);
} catch (Exception ex) {
ex.printStackTrace();
}
try {
network_enabled = lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
} catch (Exception ex) {
ex.printStackTrace();
}
System.out.println("gps_enabled = " + gps_enabled);
System.out.println("network_enabled = " + network_enabled);
if (!gps_enabled && !network_enabled) {
// notify user
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setMessage("Location services are disabled");
builder.setPositiveButton("Enable Location Services", new DialogInterface.OnClickListener() {
#Override
public void onClick(DialogInterface paramDialogInterface, int paramInt) {
// TODO Auto-generated method stub
Intent myIntent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
context.startActivity(myIntent);
//get gps
}
});
builder.setNegativeButton("Exit", new DialogInterface.OnClickListener() {
#Override
public void onClick(DialogInterface paramDialogInterface, int paramInt) {
context.finish();
}
});
//For future reference.
AlertDialog dialog = builder.create();
dialog_ = dialog;
dialog.show();
} else {
if(dialog_!=null) {
dialog_.dismiss();
}
}
}
}
In my main activity I have a onResume callback that does the following-:
#Override
protected void onResume() {
super.onResume();
System.out.println("Activity resume()");
LocationUtils.checkAndEnableLocationServices(this);
}
What am I missing ? Why is this is dialog not closing ? The code is not throwing any errors. This a WTF moment for me.
Your are calling alertDialog.show method for the local alert dialog.
Replace code,
AlertDialog dialog = builder.create();
dialog_ = dialog;
with
dialog_ = builder.create();
dialog_.show
and onResume()
if(dialog_!=null) {
dialog_.dismiss();
}
Yo can dismiss dialog when positive button clicked and show it in OnResume if Location Service not enambled
Related
I want to show a notification or dialog (when app opens) if the current installed app is not the Updated Version (available in play store).
How can i do that?
add this dependency to your gradle file..
com.github.rampo.updatechecker:library:2.1.8
And try this code in your Activity..
public static String NEW_VERSION = "1.1.0";
public void checkForAppUpdate () {
try {
if (!((Activity) context).isFinishing()) {
UpdateChecker.setNotice(Notice.NOTIFICATION);
UpdateChecker.setNoticeIcon(R.drawable.your_notification_logo);
String s = "Hello User, New version of this application is now available on play store.";
if (Comparator.isVersionDownloadableNewer((Activity) context, NEW_VERSION)){
SharedPreferences pref = context.getSharedPreferences(UpdateChecker.PREFS_FILENAME, 0);
boolean b = pref.getBoolean(UpdateChecker.DONT_SHOW_AGAIN_PREF_KEY + NEW_VERSION, false);
if (!b) {
displayAlertDialogforPlayStore(context, "Update Available", s);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
And Function displayAlertDialogforPlayStore() is...
public void displayAlertDialogforPlayStore(final Context context, String title,
String message) {
try {
final AlertDialog.Builder alert = new AlertDialog.Builder(context);
alert.setIcon(R.drawable.your_notification_logo);
if (title != null) {
alert.setTitle(title);
}
alert.setMessage(message);
alert.setPositiveButton("Update Now", new DialogInterface.OnClickListener() {
#Override
public void onClick(DialogInterface dialog, int which) {
final String appPackageName = context.getPackageName();
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=" + appPackageName));
context.startActivity(intent);
}
});
alert.setNegativeButton("Later", new DialogInterface.OnClickListener() {
#Override
public void onClick(DialogInterface dialog, int which) {
}
});
alert.show();
} catch (Exception e) {
e.printStackTrace();
}
}
This code display both notification and alertDailog for update.
You can use Firebase notifications as described here. You can choose your segment (e.g. app version) as described here.
I`m getting the GPS coordination of the device inside an AsyncTask class (by getLocation method) but, If the GPS is disable, I open a dialog that able the user to transfer to the "setting" area and turn the GPS "on" or cancel. The App crash every time the the dialog alert has open before the user even press at one of the buttons. How can I solve it ?
public class StarTask extends AsyncTask<Void,Void,ArrayList<Song>>{
final int k_ThreadSleepTime = 3000;
final int k_MaxThreadTries = 7;
double latitude = 0;
double longitude = 0;
GPSTracker gps;
TestMain client;
#Override
protected void onPreExecute() {
super.onPreExecute();
gps = new GPSTracker(getApplication());
}
#Override
protected ArrayList<Song> doInBackground(Void... params) {
ArrayList<Song> list = new ArrayList();
client = new TestMain();
int tries = 0;
String o;
getLocation();
String url = builtURL();
try {
String jsonPageStr = client.doGetRequest(url);
JSONObject obj = new JSONObject(jsonPageStr);
userId = obj.getJSONObject("info").getInt("user_id");
isWait = (wait.equals("true"));
while (isWait && tries < k_MaxThreadTries) {
url = builtURL();
jsonPageStr = client.doGetRequest(url);
obj = new JSONObject(jsonPageStr);
if (!(obj.equals("") || obj.equals(null))) {
isWait = (wait.equals("true"));
}
tries++;
try {
Thread.sleep(k_ThreadSleepTime);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
if(tries == k_MaxThreadTries) {
//exit the App
onMyDestroy();
}
}
private String builtURL() {}
private void getLocation() {
if (gps.canGetLocation()) {
latitude = gps.getLatitude();
longitude = gps.getLongitude();
} else {
// can't get location
// GPS or Network is not enabled
// Ask user to enable GPS/network in settings
//gps.showSettingsAlert();
showSettingsAlert();
}
gps.stopUsingGPS();
}
public void showSettingsAlert(){
runOnUiThread(new Runnable() {
#Override
public void run() {
final AlertDialog.Builder alertDialog = new AlertDialog.Builder(MainActivity.this);
// Setting Dialog Title
alertDialog.setTitle("GPS is settings");
// Setting Dialog Message
alertDialog.setMessage("GPS is not enabled. Do you want to go to settings menu?");
// On pressing Settings button
alertDialog.setPositiveButton("Settings", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int which) {
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
MainActivity.this.startActivity(intent);
hasBeenNoGps = true;
}
});
// on pressing cancel button
alertDialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
hasBeenNoGps = true;
onMyDestroy();
}
});
// Showing Alert Message
alertDialog.show();
}
});
}
#Override
protected void onPostExecute(ArrayList<Song> aVoid) {
super.onPostExecute(aVoid);
You're doing UI operations on showSettingsAlert() which is called during doInBackground() of your AsyncTask. The allowed approach is to keep all operations involving UI away from doInBackground(). Here you could remove the else condition from getLocation() and rather implement it onPreExecute(). Like this,
public class StarTask extends AsyncTask<Void,Void,ArrayList<Song>>{
final int k_ThreadSleepTime = 3000;
final int k_MaxThreadTries = 7;
double latitude = 0;
double longitude = 0;
GPSTracker gps;
TestMain client;
#Override
protected void onPreExecute() {
super.onPreExecute();
gps = new GPSTracker(getApplication());
if (!gps.canGetLocation()) {
showSettingsAlert();
}
}
#Override
protected ArrayList<Song> doInBackground(Void... params) {
ArrayList<Song> list = new ArrayList();
client = new TestMain();
int tries = 0;
String o;
getLocation();
String url = builtURL();
try {
String jsonPageStr = client.doGetRequest(url);
JSONObject obj = new JSONObject(jsonPageStr);
userId = obj.getJSONObject("info").getInt("user_id");
isWait = (wait.equals("true"));
while (isWait && tries < k_MaxThreadTries) {
url = builtURL();
jsonPageStr = client.doGetRequest(url);
obj = new JSONObject(jsonPageStr);
if (!(obj.equals("") || obj.equals(null))) {
isWait = (wait.equals("true"));
}
tries++;
try {
Thread.sleep(k_ThreadSleepTime);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
if(tries == k_MaxThreadTries) {
//exit the App
onMyDestroy();
}
}
private void getLocation() {
if (gps.canGetLocation()) {
latitude = gps.getLatitude();
longitude = gps.getLongitude();
}
gps.stopUsingGPS();
}
You are trying to run a UI thread in a background thread (inside your AsyncTask), what you can do is create a global dialog in your AsyncTask class and show it on doInBackground method and then close it onPostExecute(). You will need a Context for your dialog.
I get push notifications, using this message create a Dialog to get the availability. Here I get push notification in Dialog form if the app is already open, if the app is not open, push notification comes and Dialog is not coming, How may I get the Dialog even the app is not open. Here is my Code.
private final BroadcastReceiver mHandleMessageReceiver = new BroadcastReceiver() {
#Override
public void onReceive(Context context, Intent intent) {
String newMessage = intent.getExtras().getString(EXTRA_MESSAGE);
String[] msg = newMessage.split(",");
latitude = Double.parseDouble(msg[0]);
longitude = Double.parseDouble(msg[1]);
glat = msg[0];
glon = msg[1];
ambNo = msg[3];
currIncId = msg[4];
// Waking up mobile if it is sleeping
WakeLocker.acquire(getApplicationContext());
if(newMessage!=null)
{
showAlertDialog(context, msg[2]+" AT", getMyLocationAddress(latitude, longitude), false);
return;
}
WakeLocker.release();
}
};
and this is my Dialog Code:
public void showAlertDialog(final Context context, String title, String message,
Boolean status)
{
dist = String.valueOf(distanceFrom(lat, lon, latitude, longitude));
Log.i("DISTANCE TO MES FOM AMB", dist);
final GPSTracker gps = new GPSTracker(context);
final AlertDialog.Builder alertDialog = new AlertDialog.Builder(context);
alertDialog.setTitle(title);
alertDialog.setMessage(message);
alertDialog.setCancelable(false);
// Setting Positive "Yes" Button
alertDialog.setPositiveButton("RESPOND", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int which) {
mRegisterTask = new AsyncTask<Void, Void, Void>() {
#Override
protected Void doInBackground(Void... params){
stat = ServerUtilities.updatestatus(context, ambNo, String.valueOf(gps.getLatitude()), String.valueOf(gps.getLongitude()), "1", currIncId);
return null;
}
#Override
protected void onPostExecute(Void result) {
mRegisterTask = null;
}
};
mRegisterTask.execute(null, null, null);
Intent mrAc = new Intent(context,MapRouteActivity.class);
startActivity(mrAc);
}
});
// Setting Negative "NO" Button
alertDialog.setNegativeButton("DECLINE", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
mRegisterTask = new AsyncTask<Void, Void, Void>() {
#Override
protected Void doInBackground(Void... params) {
ServerUtilities.updatestatus(context, MainActivity.ambNo, MainActivity.glat, MainActivity.glon, "0",MainActivity.currIncId);
return null;
}
#Override
protected void onPostExecute(Void result) {
mRegisterTask = null;
}
};
mRegisterTask.execute(null, null, null);
dialog.cancel();
}
});
final AlertDialog dlg = alertDialog.create();
alertDialog.show();
// Showing Alert Message
//alertDialog.setIcon(R.drawable.counter);
final Timer t = new Timer();
t.schedule(new TimerTask() {
public void run() {
dlg.dismiss(); // when the task active then close the dialog
t.cancel(); // also just top the timer thread, otherwise, you may receive a crash report
}
}, SPLASH_TIME_OUT); // after 2 second (or 2000 miliseconds), the task will be active.
}
hope to get some good idea.
Dialogs need to have an Activity content. Just giving the application content doesn't work. You will need to start an Activity that looks like a dialog. See Android Activity as a dialog
I want to open alert dialog box after successfully submitted data.
I am using following code but not work.
dialog = ProgressDialog.show(TanantDetails.this, "", "Please Wait...", true);
new Thread(new Runnable() {
public void run() {
String response;
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
SharedPreferences sp=getSharedPreferences("login",MODE_WORLD_READABLE);
try {
Utility utility=new Utility();
//
new_url=url+mobile_no.getText().toString();
response = utility.getResponse(utility.urlEncode(new_url));
dialog.dismiss();
if (response.equals("Success"))
{
AlertDialog alertbox = new AlertDialog.Builder(getBaseContext())
//.setIcon(R.drawable.no)
.setTitle("Submit successfully")
.setMessage("“Police will verify documents between preferred timing")
.setPositiveButton("ok", new DialogInterface.OnClickListener() {
// do something when the button is clicked
public void onClick(DialogInterface arg0, int arg1) {
TanantDetails.this.finish();
Intent i=new Intent(getApplicationContext(),MainActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivity(i);
}
})
.show();
}
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// Toast.makeText(getApplicationContext(), response, Toast.LENGTH_LONG).show();
}
}).start();
}
toast show the message response success.
I am new to android
Simple Alert Dialog
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Alert")
.setTitle("Warning");
AlertDialog alert =builder.create();
alert.show();
If you want to add ok, cancel buttons then add
builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// User clicked OK button
}
});
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// User clicked cancel button
}
});
Try this code:
new AlertDialog.Builder(this)
.setTitle("Your title")
.setMessage("Your message")
.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// Your code
}
})
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// do nothing
}
})
.show();
Your alert dialog needs to be displayed on the UI thread. The code you are running is on a separate thread. In most cases when you want to update a UI element while in a separate thread it is done by using runOnUiThread()
Please see the code below
if (response.equals("Success"))
{
runOnUiThread(new Runnable() {
#Override
public void run() {
AlertDialog alertbox = new AlertDialog.Builder(getBaseContext())
//.setIcon(R.drawable.no)
.setTitle("Submit successfully")
.setMessage("“Police will verify documents between preferred timing")
.setPositiveButton("ok", new DialogInterface.OnClickListener() {
// do something when the button is clicked
public void onClick(DialogInterface arg0, int arg1) {
TanantDetails.this.finish();
Intent i=new Intent(getApplicationContext(),MainActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivity(i);
}
}).show();
}
});
}
I'm trying to display an alert message for the users in a catch block. The difference is that my try/catch is inside the onCreate() from the main activity, so it's executed as soon as the application is opened.
I've tried this (I have an OnClick() for Dialogs in the end of the Activity with dialog.dismiss() and this.finish() after):
catch (SQLException e) {
AlertDialog.Builder builder = new AlertDialog.Builder(this)
.setTitle(getString(R.string.label_title_error))
.setIcon(R.drawable.error_icon)
.setMessage(getString(R.string.msg_error_sql))
.setPositiveButton(getString(R.string.label_ok), this);
AlertDialog dialogSQL = builder.create();
dialogSQL.show();
e.printStackTrace();
}
and I also tried this:
catch (NumberFormatException e) {
AlertDialog.Builder dialog = new AlertDialog.Builder(this);
dialog.setTitle(getString(R.string.label_title_error));
dialog.setIcon(R.drawable.error_icon);
dialog.setMessage(getString(R.string.msg_error_numberformat));
dialog.setNeutralButton(getString(R.string.label_ok), null);
dialog.create().show();
e.printStackTrace();
}
Forced the exceptions while debugging and I can see that it simply catches the exception, displays in the LogCat (as warning) and keep with the flow until it hits another untreated exception and then display that default "Sorry!/Force Close" Android dialog. And there are no other exceptions related to the dialog in the LogCat.
Why it does not display my custom AlertDialogs for the catch? I thought about the context that the Builder needs, but if the super() from onCreate() is before this code so why it does displays the message?
Thanks Everyone.
UPDATE: Ok, as requested, here goes more code.
public class PinActivity extends Activity implements OnClickListener, android.content.DialogInterface.OnClickListener{
private Facade facade = null;
public static int INSERT_SAL = 0;
public static int INSERT_OK = 1;
public static int INSERT_CANCEL = 2;
EditText edtIniPin;
TextView txtSelecPin;
TextView txtCancPin;
int pinMaxLengthInt;
private String[] serviceNames;
#Override
protected void onCreate(Bundle savedInstanceState) {
Log.v("FLUXO", "PIN -->> ON CREATE");
super.onCreate(savedInstanceState);
facade = Facade.getInstance();
try {
serviceNames = facade.loadApplication(this);
facade.loadParameters(0);
setContentView(R.layout.pin_screen);
//Instanciando Views da Tela
edtIniPin = (EditText) findViewById(R.id.editTextPin);
txtSelecPin = (TextView) findViewById(R.id.btn_select_pin);
txtCancPin = (TextView) findViewById(R.id.btn_cancel_pin);
pinMaxLengthInt = Facade.getInstance().getPinSize();
InputFilter[] FilterArray = new InputFilter[1];
FilterArray[0] = new InputFilter.LengthFilter(pinMaxLengthInt);
edtIniPin.setFilters(FilterArray);
edtIniPin.addTextChangedListener(new TextWatcher() {
#Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (edtIniPin.getText().length() > 0) {
txtCancPin.setText(getString(R.string.btn_clean));
}
else if (edtIniPin.getText().length() == 0){
txtCancPin.setText(getString(R.string.btn_exit));
}
else if (edtIniPin.getText().length() == Facade.getInstance().getPinSize()){
edtIniPin.setEnabled(false);
}
}
#Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
#Override
public void afterTextChanged(Editable s) {
}
});
} catch (SQLException e) {
AlertDialog.Builder builder = new AlertDialog.Builder(this)
.setTitle(getString(R.string.label_title_error))
.setIcon(R.drawable.error_icon)
.setMessage(getString(R.string.msg_error_sql))
.setPositiveButton(getString(R.string.label_ok), this);
AlertDialog dialogSQL = builder.create();
dialogSQL.show();
e.printStackTrace();
} catch (CorruptedAppException e) {
AlertDialog.Builder builder = new AlertDialog.Builder(this)
.setTitle(getString(R.string.label_title_error))
.setIcon(R.drawable.error_icon)
.setMessage(getString(R.string.msg_error_corrupted))
.setPositiveButton(getString(R.string.label_ok), this);
AlertDialog dialogCorrupted = builder.create();
dialogCorrupted.show();
e.printStackTrace();
} catch (NoServiceAvailableException e) {
AlertDialog.Builder builder = new AlertDialog.Builder(this)
.setTitle(getString(R.string.label_title_error))
.setIcon(R.drawable.error_icon)
.setMessage(getString(R.string.msg_error_noservice))
.setPositiveButton(getString(R.string.label_ok), this);
AlertDialog dialogNoService = builder.create();
dialogNoService.show();
e.printStackTrace();
} catch (NumberFormatException e) {
AlertDialog.Builder dialog = new AlertDialog.Builder(this);
dialog.setTitle(getString(R.string.label_title_error));
dialog.setIcon(R.drawable.error_icon);
dialog.setMessage(getString(R.string.msg_error_numberformat));
dialog.setNeutralButton(getString(R.string.label_ok), null);
dialog.create().show();
e.printStackTrace();
}
}
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Log.v("FLUXO", "PIN -->> ON ACTIVITY RESULT");
if (resultCode == INSERT_OK) {
String[] initCode = (String[]) data.getSerializableExtra("init_code");
try {
Facade.getInstance().insertInitCode(serviceNames[0], initCode, this);
} catch (NumberFormatException e) {
AlertDialog.Builder builder = new AlertDialog.Builder(this)
.setTitle(getString(R.string.label_title_error))
.setIcon(R.drawable.error_icon)
.setMessage(getString(R.string.msg_error_numberformat))
.setPositiveButton(getString(R.string.label_ok), this);
AlertDialog dialog = builder.create();
dialog.show();
e.printStackTrace();
} catch (SQLException e) {
AlertDialog.Builder builder = new AlertDialog.Builder(this)
.setTitle(getString(R.string.label_title_error))
.setIcon(R.drawable.error_icon)
.setMessage(getString(R.string.msg_error_sql))
.setPositiveButton(getString(R.string.label_ok), this);
AlertDialog dialog = builder.create();
dialog.show();
e.printStackTrace();
} catch (CorruptedAppException e) {
AlertDialog.Builder builder = new AlertDialog.Builder(this)
.setTitle(getString(R.string.label_title_error))
.setIcon(R.drawable.error_icon)
.setMessage(getString(R.string.msg_error_corrupted))
.setPositiveButton(getString(R.string.label_ok), this);
AlertDialog dialog = builder.create();
dialog.show();
e.printStackTrace();
}
}
else if (resultCode == INSERT_CANCEL){
this.finish();
}
}
#Override
protected void onStart() {
Log.v("FLUXO", "PIN -->> ON START");
super.onStart();
txtSelecPin.setOnClickListener(this);
txtCancPin.setOnClickListener(this);
}
#Override
protected void onResume() {
Log.v("FLUXO", "PIN -->> ON RESUME");
super.onResume();
if (!facade.isInitialized(serviceNames[0], this)) {
Intent itInicial = new Intent(this, InitialActivity.class);
startActivityForResult(itInicial, INSERT_SAL);
}
}
#Override
protected void onStop() {
Log.v("FLUXO", "PIN -->> ON STOP");
super.onStop();
}
#Override
protected void onPause() {
Log.v("FLUXO", "PIN -->> ON PAUSE");
super.onPause();
}
#Override
public void onBackPressed() {
Log.v("FLUXO", "PIN -->> ON BACK KEY PRESSED");
super.onBackPressed();
moveTaskToBack(true);
}
#Override
protected void onDestroy() {
Log.v("FLUXO", "PIN -->> ON DESTROY");
super.onDestroy();
}
/**
* Método chama próxima tela
*/
private void nextScreen(){
Log.v("FLUXO", "PIN -->> NEXT SCREEN");
Intent it = new Intent(this, ValueActivity.class);
startActivity(it);
}
#Override
public void onClick(View v) {
//lots of stuff (...)
}
#Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
System.exit(0);
}
}
AlertDialog generally needs its parent Context to be visible to work correctly (in my experience; someone correct me if I'm wrong). Barring other errors (hard to tell without the full code) you could probably make that work right if you move it into your onResume() function.
It was a problem with the life cicle of the Activity!
Heres what I did:
} catch (NumberFormatException e) {
showDialog(
R.string.label_title_error,
R.drawable.error_icon,
R.string.msg_error_noservice,
R.string.label_ok);
error = true;
e.printStackTrace();
}
and this:
#Override
protected void onResume() {
Log.v("FLUXO", "PIN -->> ON RESUME");
super.onResume();
if (!error) {
if (!facade.isInitialized(serviceNames[0], this)) {
Intent itInicial = new Intent(this, InitialActivity.class);
startActivityForResult(itInicial, INSERT_SAL);
}
}
}