Unable to add window -- token android.os.BinderProxy - android

Below is my utility method for showing alert dialog in my application
private void displayInternetAlert(final Context context) {
if (!((GlobalActivity) context).isFinishing() && context instanceof GlobalActivity) {
((GlobalActivity) context).runOnUiThread(new Runnable() {
#Override
public void run() {
if (Validator.isNull(internetDialog)) {
internetDialog = new AlertDialog.Builder(Util.createCustomAlertDialog(context)).create();
internetDialog.setMessage(context.getString(R.string.internet_disable));
internetDialog.setButton(DialogInterface.BUTTON_NEUTRAL, context.getString(R.string.settings), new DialogInterface.OnClickListener() {
#Override
public void onClick(DialogInterface dialog, int which) {
/*
Don't need to write onactivity result now as we try to connect every time
*/
context.startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS));
dialog.dismiss();
}
});
internetDialog.setButton(DialogInterface.BUTTON_NEGATIVE, context.getString(R.string.ignore), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
internetDialog.setOnShowListener(new DialogInterface.OnShowListener() {
#Override
public void onShow(DialogInterface dialog) {
internetDialog.getButton(AlertDialog.BUTTON_NEUTRAL).setTextColor(context.getResources().getColor(R.color.dialog_cancel_button));
internetDialog.getButton(AlertDialog.BUTTON_NEUTRAL).setTypeface(null, Typeface.BOLD);
internetDialog.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(context.getResources().getColor(R.color.dialog_cancel_button));
}
});
}
if (!internetDialog.isShowing()) {
internetDialog.show();
}
}
});
}
}
and Below is my GlobalActivity class
public class GlobalActivity extends AppCompatActivity {
#Nullable
#Bind(R.id.adView)
public AdView adView;
public GlobalActivity() {
ExceptionHandler.getExceptionHandler().setActivity(this);
}
#Override
public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
super.onCreate(savedInstanceState, persistentState);
setContentView(R.layout.ad_system);
ButterKnife.bind(this);
}
#Override
protected void finalize() throws Throwable {
}
#Override
protected void onStart() {
super.onStart();
loadGoogleAdd();
}
#Override
protected void onResume() {
super.onResume();
if(Validator.isNotNull(adView)){
adView.resume();
}
}
#Override
protected void onPause() {
super.onPause();
if(Validator.isNotNull(adView)){
adView.pause();
}
Util.setSharedPreferences(this, Util.SHARED_PREFERENCE_PREFERENCES, Util.EXPOSE_GSON.toJson(Util.getPreferences(this)));
}
private void loadGoogleAdd() {
if (adView != null) {
AdRequest adRequest = new AdRequest.Builder().
addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.build();
adView.loadAd(adRequest);
}
}
public void loadErrorActivity() {
startActivity(new Intent(GlobalActivity.this, ErrorActivity.class));
}
#Override
protected void onDestroy() {
super.onDestroy();
if(Validator.isNotNull(adView)){
adView.destroy();
}
Request.getRequest().dismissProgressDialog(this);
}
}
from which I am extending all activities and in that activity I am replacing fragments although I made check for activity finishing.
But I'm still receiving this exception in SM-G935F (Samesung Galaxy s7 edge). I'm using appcompat 23.1.1. is it platform or device specific issue or whether I'm making any mistake please help me in finding solution for this.
Any help is appreiciated.

I don't think it possible to display dialog from background thread, with assumption method displayInternetAlert is called inside activity/fragment, you can display dialog directly like this:
private void displayInternetAlert(final Context context) {
if (!((GlobalActivity) context).isFinishing() && context instanceof GlobalActivity) {
if (Validator.isNull(internetDialog)) {
internetDialog = new AlertDialog.Builder(Util.createCustomAlertDialog(context)).create();
internetDialog.setMessage(context.getString(R.string.internet_disable));
internetDialog.setButton(DialogInterface.BUTTON_NEUTRAL, context.getString(R.string.settings), new DialogInterface.OnClickListener() {
#Override
public void onClick(DialogInterface dialog, int which) {
/*
Don't need to write onactivity result now as we try to connect every time
*/
context.startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS));
dialog.dismiss();
}
});
internetDialog.setButton(DialogInterface.BUTTON_NEGATIVE, context.getString(R.string.ignore), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
internetDialog.setOnShowListener(new DialogInterface.OnShowListener() {
#Override
public void onShow(DialogInterface dialog) {
internetDialog.getButton(AlertDialog.BUTTON_NEUTRAL).setTextColor(context.getResources().getColor(R.color.dialog_cancel_button));
internetDialog.getButton(AlertDialog.BUTTON_NEUTRAL).setTypeface(null, Typeface.BOLD);
internetDialog.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(context.getResources().getColor(R.color.dialog_cancel_button));
}
});
}
if (!internetDialog.isShowing()) {
internetDialog.show();
}
}
}

Related

Disposing Interface Implementation On Fragment Destroy

I have a background service that broadcasts to MainActivity the internet connection status.
private BroadcastReceiver mReceiver = new BroadcastReceiver() {
#Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(mBroadcastBooleanAction)) {
boolean isConnectedToInternet = intent.getBooleanExtra("Data", false);
if (internetConnectionInterface == null) return;
internetConnectionInterface.connectedToInternet(isConnectedToInternet);
}
}
};
Then on the MainActivity, I have a navGraph that navigates between fragments by using Navigation.findNavController.
I created an interface in the MainActivity to pass data from the MainActivity to its fragments
public class MainActivity extends BaseActivity{
public interface InternetConnectionInterface {
void connectedToInternet(boolean isConnected);
}
}
Then when I navigate to a different fragment, I implement this interface like so
public class MainMenuFragment extends Fragment
implements MainActivity.InternetConnectionInterface {
#Override
public void onCreate(Bundle savedInstanceState) {
((MainActivity)getActivity()).setInternetConnectionInterface(this);
OnBackPressedCallback callback = new OnBackPressedCallback(true) {
#Override
public void handleOnBackPressed() {
AlertDialog.Builder builder= new AlertDialog.Builder(getContext());
builder.setMessage("Are you sure you want to exit the Entry Transaction Module?");
builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
#Override
public void onClick(DialogInterface dialogInterface, int i) {
try {
requireActivity().onBackPressed();
} catch (Exception e) {
showErrorAlert("Go back", e.getMessage());
}
}
});
builder.setNegativeButton("No", null);
builder.show();
}
};
requireActivity().getOnBackPressedDispatcher().addCallback(this, callback);
}
....
}
public class EntryFragment extends Fragment
implements MainActivity.InternetConnectionInterface {
#Override
public void onCreate(Bundle savedInstanceState) {
((MainActivity)getActivity()).setInternetConnectionInterface(this);
OnBackPressedCallback callback = new OnBackPressedCallback(true) {
#Override
public void handleOnBackPressed() {
AlertDialog.Builder builder= new AlertDialog.Builder(getContext());
builder.setMessage("Are you sure you want to exit the Entry Transaction Module?");
builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
#Override
public void onClick(DialogInterface dialogInterface, int i) {
try {
requireActivity().onBackPressed();
} catch (Exception e) {
showErrorAlert("Go back", e.getMessage());
}
}
});
builder.setNegativeButton("No", null);
builder.show();
}
};
requireActivity().getOnBackPressedDispatcher().addCallback(this, callback);
}
...
}
Both of these fragments overrides the interface as so
#Override
public void connectedToInternet(boolean isConnected) {
Log.i("LOGGER", "THIS IS CALLED");
}
and both are running fine. My problem is when I go back to the MainMenuFragment, the implementation of the interface in the EntryFragment still functions.

Android AlertDialog not visible

When alertDialog.show gets called, it does pop up a dialog but it remains invisible. I have to tap on the screen until I happen to click the "OK" button that's on the alert even though it is not visibly showing.
public class RecordSignals extends Activity {
private ImageView pulseOxImage;
static AlertDialog poDialog;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(saveInstanceState);
pulseOxImage = new ImageView(this);
pulseOxImage.setImageDrawable(ContextCompat
.getDrawable(this,R.drawable.pulse_ox_animation));
poDialog = new AlertDialog.Builder(this).create();
...
}
final Runnable callback = new Runnable() {
#Override
public void run() {
Thread thread = new Thread() {
#Override
public void run() {
...
runOnUiThread(new Runnable() {
#Override
public void run() {
if (pulseOxArtifact >= 2 || pulseOxOutOfTrack >= 2 || pulseOxSensorAlarm >= 2) {
pulseOxStatus();
pulseOxImage.setVisibility(View.VISIBLE);
poDialog.show();
}
}
});
}
};
}
};
public void pulseOxStatus() {
poDialog.setView(pulseOxImage);
poDialog.setButton("OK", new DialogInterface.OnClicklistener() {
#Override
public void onClick(DialogInterface dialog, int which) {
poDialog.dismiss();
}
});
}
}

Click twice on play button of videoview for resume video

This is my VideoplayerActivity:
public class VideoPlayerActivity extends Activity {
CustomVideoView video_player_view;
DisplayMetrics dm;
SurfaceView sur_View;
MediaController media_Controller;
AlertDialog alertDialog;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.video_view);
if (getIntent().getData() != null && getIntent().getData().getPath() != null) {
getInit(getIntent().getData().getPath());
}
if (getIntent().hasExtra("file_path")) {
getInit(getIntent().getStringExtra("file_path"));
}
}
public void getInit(String file_path) {
video_player_view = (CustomVideoView) findViewById(R.id.video_player_view);
media_Controller = new MediaController(this);
video_player_view.setPlayPauseListener(new CustomVideoView.PlayPauseListener() {
#Override
public void onPlay() {
if (alertDialog != null) {
alertDialog.dismiss();
}
}
#Override
public void onPause() {
alertDialog = new AlertDialog.Builder(VideoPlayerActivity.this).create();
alertDialog.setMessage("Video has been paused");
alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
alertDialog.dismiss();
}
});
alertDialog.show();
}
});
video_player_view.setMediaController(media_Controller);
video_player_view.setVideoPath(file_path);
video_player_view.start();
}
}
and here is my CustomVideoView
public class CustomVideoView extends VideoView {
private PlayPauseListener mListener;
public CustomVideoView(Context context) {
super(context);
}
public CustomVideoView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public CustomVideoView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public void setPlayPauseListener(PlayPauseListener listener) {
mListener = listener;
}
#Override
public void pause() {
super.pause();
if (mListener != null) {
mListener.onPause();
}
}
#Override
public void resume() {
super.resume();
if (mListener != null) {
mListener.onPlay();
}
}
#Override
public void start() {
super.start();
if (mListener != null) {
mListener.onPlay();
}
}
public static interface PlayPauseListener {
void onPlay();
void onPause();
}
}
the problem is that when i click to resume video at first it dismiss alert dialog and after second time i clicked it resume my video.
I want it to be happen on single click , kindly help me through this.
This I tested and seems to work! from this post
public void getInit(String file_path) {
video_player_view = (CustomVideoView) findViewById(R.id.video_player_view);
media_Controller = new MediaController(this);
video_player_view.setPlayPauseListener(new CustomVideoView.PlayPauseListener() {
#Override
public void onPlay() {
if (alertDialog != null) {
alertDialog.dismiss();
}
}
#Override
public void onPause() {
alertDialog = new AlertDialog.Builder(VideoPlayerActivity.this).create();
alertDialog.setMessage("Video has been paused");
alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
alertDialog.dismiss();
}
});
alertDialog.getWindow()
.setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
alertDialog.getWindow()
.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
alertDialog.show();
}
});
video_player_view.setMediaController(media_Controller);
video_player_view.setVideoPath(file_path);
video_player_view.start();
}
So I'm not sure of a way to show an alert dialog and allow the user to click on ui elements not in the foreground. What you can do is add a dismiss listener that will be called if the user dismisses the dialog on an outside touch and start playback from there.
public void getInit(String file_path) {
video_player_view = (CustomVideoView) findViewById(R.id.video_player_view);
media_Controller = new MediaController(this);
video_player_view.setPlayPauseListener(new CustomVideoView.PlayPauseListener() {
#Override
public void onPlay() {
if (alertDialog != null) {
alertDialog.dismiss();
}
}
#Override
public void onPause() {
alertDialog = new AlertDialog.Builder(VideoPlayerActivity.this).create();
alertDialog.setMessage("Video has been paused");
alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
alertDialog.dismiss();
video_player_view.start();
}
});
.setOnCancelListener(new DialogInterface.OnCancelListener() {
#Override
public void onCancel(DialogInterface dialog) {
video_player_view.start();
}
});
alertDialog.show();
}
});
video_player_view.setMediaController(media_Controller);
video_player_view.setVideoPath(file_path);
video_player_view.start();
}

Is there a way to show AlertDialog in AsyncTask commonly?

I want to show AlertDialog which is in other class in AsyncTask.
Example>
public class WardListAsyncTask extends AsyncTask<HashMap<String, String>, String, Object> {
#Override
protected void onPreExecute() {
super.onPreExecute();
}
#Override
protected Object doInBackground(HashMap<String, String>... params) {
...
}
#Override
protected void onPostExecute(Object result) {
ConfirmAlertDialog(ez_WardList.this,"HI?");
//this method is in another Class & I want to use this method another Asynctask also..
}
and ConfirmAlertDialog is...
Context g_ctx;
String g_content;
public void ez_ConfirmAlertDialog(Context ctx, String content) {
this.g_ctx=ctx;
this.g_content=content;
runOnUiThread(new Runnable() {
#Override
public void run() {
AlertDialog.Builder builder = new AlertDialog.Builder(g_ctx, AlertDialog.THEME_HOLO_LIGHT);
builder.setMessage(g_content).setPositiveButton(getString(R.string.kor_confirm),
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
}
});
AlertDialog alertDialog = builder.create();
alertDialog.show();
alertDialog.getWindow().setLayout(displayWidth / 2, LayoutParams.WRAP_CONTENT);
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.rgb(10, 174, 239));
}
});
}
I think g_ctx.class.runonuiThread ... but I can't call runonuithread...
How can I solve it?
runOnUiThread method is present in Activity class. So should pass Activity into your class.
Example:
public class MyClass{
public void ez_ConfirmAlertDialog(Activity activity, String content) {
this.g_ctx=ctx;
this.g_content=content;
if(activity == null){
return;
}
activity.runOnUiThread(new Runnable() {
#Override
public void run() {
AlertDialog.Builder builder = new AlertDialog.Builder(g_ctx, AlertDialog.THEME_HOLO_LIGHT);
builder.setMessage(g_content).setPositiveButton(getString(R.string.kor_confirm),
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
}
});
AlertDialog alertDialog = builder.create();
alertDialog.show();
alertDialog.getWindow().setLayout(displayWidth / 2, LayoutParams.WRAP_CONTENT);
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.rgb(10, 174, 239));
}
});
}
}
You can call it in main thread using handler
new Handler(Looper.getMainLooper()).post(new Runnable() {
#Override
public void run() {
// Your code here
}
});

Android - How to make some validations in sequence

I need to do some validations sequentially and some of them involve complex database operations.
So, I need to do this in a separated thread of UI Thread, ok?
But some validations show messages to user, what need confirmation and
when user confirm, the next validation should be call.
This code example explains what I want to implement:
void makeValidation1(){
if(condition1Valid()){
makeValidation2();
}else{
DialogInterface.OnClickListener onClick = new DialogInterface.OnClickListener() {
#Override
public void onClick(DialogInterface dialog, int which) {
makeValidation2();
}
};
AlertDialog.Builder builder = new AlertDialog.Builder(this)
.setMessage("really want to do this?")
.setPositiveButton("Yes", onClick);
builder.create().show();
}
}
void makeValidation2(){
if(condition2Valid()){
}else{
//...
}
}
boolean condition1Valid() {
// complex database Operations
return false;
}
boolean condition2Valid() {
//complex database Operations
return false;
}
//...
void makeValidation9(){
//...
}
My question is: What the best way/pattern to implement this?
1 - Create one asyncTask for each validation? (I cant create only one AsyncTask, because confirmation messages can stop flux).
2 - Create a Runnable for each validation and create thread to run that when need call next validation?
3 - ???
edit
I tested this code #BinaryBazooka, but isnt work. Any help?
public class MainActivity extends Activity implements OnClickListener {
Thread mThread;
ProgressDialog mProgressDialog;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Button button = new Button(this);
button.setText("Start");
setContentView(button, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
button.setOnClickListener(this);
}
#Override
public void onClick(View v) {
mThread = new Thread(new Runnable() {
#Override
public void run() {
validations();
}
});
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Start Thread?");
builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
#Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
mProgressDialog = new ProgressDialog(MainActivity.this);
mProgressDialog.show();
mThread.run();
}
});
builder.create().show();
}
void validations(){
//this method go on separated thread
validation1();
validation2();
validation3();
}
void validation1(){
if(true){
final AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setMessage("Validation 1 failed. Go validation 2?");
builder.setPositiveButton("Go", new DialogInterface.OnClickListener() {
#Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
mProgressDialog.show();
//if user confirm, continue validation thread
mThread.notify();
}
});
builder.setOnCancelListener(new OnCancelListener() {
#Override
public void onCancel(DialogInterface dialog) {
//if user cancel, stop validation thread
mThread.interrupt();
}
});
runOnUiThread(new Runnable() {
#Override
public void run() {
mProgressDialog.hide();
builder.create().show();
}
});
try {
synchronized (mThread) {
//wait for user confirmation
mThread.wait();
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
private void validation2() {
if(true){
final AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setMessage("validacao 2 failed. Go validation 3?");
builder.setPositiveButton("Go", new DialogInterface.OnClickListener() {
#Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
mProgressDialog.show();
mThread.notify();
}
});
builder.setOnCancelListener(new OnCancelListener() {
#Override
public void onCancel(DialogInterface dialog) {
mThread.interrupt();
}
});
runOnUiThread(new Runnable() {
#Override
public void run() {
mProgressDialog.hide();
builder.create().show();
}
});
try {
synchronized (mThread) {
mThread.wait();
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
private void validation3() {
Log.i("TAG", "<<<<<<<<<< >>>>>>>>>>>>");
runOnUiThread(new Runnable() {
#Override
public void run() {
Toast.makeText(MainActivity.this, "finished", Toast.LENGTH_SHORT);
}
});
}
}
I would create a new thread and sleep it during these dialog calls, you can access the UI directly from within your runnable with..
runOnUiThread(new Runnable() {
public void run() {}
});
So something like..
Thread someThread = new Thread(new Runnable() {
#Override
public void run(){
runOnUiThread(new Runnable() {
public void run()
{
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setMessage(R.string.msg);
builder.setPositiveButton(R.string.btn_ok, new DialogInterface.OnClickListener() {
#Override
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
someThread.notify();
}
});
AlertDialog alert = builder.create();
alert.show();
}
});
}
someThread.wait();
Works with AsyncTask. Ty.
Code:
public class MainActivity extends Activity implements OnClickListener {
//Thread mThread;
ProgressDialog mProgressDialog;
private ValidationsAsyncTask async;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Button button = new Button(this);
button.setText("Start");
setContentView(button, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
button.setOnClickListener(this);
}
#Override
public void onClick(View v) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Start Thread?");
builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
#Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
mProgressDialog = new ProgressDialog(MainActivity.this);
mProgressDialog.show();
async = new ValidationsAsyncTask();
async.execute();
}
});
builder.create().show();
}
void validation1(){
if(true){
runOnUiThread(new Runnable() {
#Override
public void run() {
final AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setMessage("Validation 1 failed. Go validation 2?");
builder.setPositiveButton("Go", new DialogInterface.OnClickListener() {
#Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
mProgressDialog.show();
//if user confirm, continue validation thread
synchronized (async) {
async.notify();
}
}
});
builder.setOnCancelListener(new OnCancelListener() {
#Override
public void onCancel(DialogInterface dialog) {
//if user cancel, stop validation thread
async.cancel(true);
}
});
mProgressDialog.hide();
builder.create().show();
}
});
Log.i("TAG - validation1", Thread.currentThread().getName());
try {
synchronized (async) {
//wait for user confirmation
async.wait();
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
private void validation2() {
if(true){
runOnUiThread(new Runnable() {
#Override
public void run() {
final AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setMessage("validacao 2 failed. Go validation 3?");
builder.setPositiveButton("Go", new DialogInterface.OnClickListener() {
#Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
mProgressDialog.show();
synchronized (async) {
async.notify();
}
}
});
builder.setOnCancelListener(new OnCancelListener() {
#Override
public void onCancel(DialogInterface dialog) {
async.cancel(true);
}
});
mProgressDialog.hide();
builder.create().show();
}
});
try {
synchronized (async) {
async.wait();
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
private void validation3() {
runOnUiThread(new Runnable() {
#Override
public void run() {
mProgressDialog.dismiss();
Toast.makeText(MainActivity.this, "finished", Toast.LENGTH_SHORT).show();
}
});
}
class ValidationsAsyncTask extends AsyncTask<Void, Void, Void>{
#Override
protected Void doInBackground(Void... params) {
validation1();
validation2();
validation3();
return null;
}
#Override
protected void onCancelled() {
Toast.makeText(MainActivity.this, "cancelled", Toast.LENGTH_LONG).show();
}
}
}

Categories

Resources