xamarin.android - Can't close AlertDialog using timer, custom view and Xamarin -


i want make splash screen using alertdialog.builder, custom view , timer.

i'm using xamarin.android - don't have 'dismiss' method seems, can call 'dispose' alertdialog view not close.

example code below:

public class splashdialog {     private readonly alertdialog.builder _alert;     private readonly view _view;       public splashdialog(context context)     {         _alert = new alertdialog.builder(context);          var layoutinflater = (layoutinflater)context.getsystemservice(context.layoutinflaterservice);         _view = layoutinflater.inflate(resource.layout.splash, null);         _alert.setview(_view);      }      public void show()     {         _alert.show();        /*         new thread(() =>         {             thread.sleep(3000);             _view.dispose();             _alert.dispose();          }).start();          * */          new handler().postdelayed(() =>             {                 _view.dispose();                 _alert.dispose();              }, 3000);     } } 

it true alertdialog.builder doesn't have dismiss() method, when call _alert.show(), returns alertdialog instance has dismiss() method. need keep instance somewhere , call when need it, this

private alertdialog _dialog;  public void dismiss() {     _dialog.dismiss(); } 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -