Popupbox/Dialog from timer in android -


i trying timer when timer ends have show popup box not working activity goes first activity called there anyway this? have tried alert box not working

 timer t = new timer();         t.schedule(new timertask() {              @override             public void run() {                 //alrt();                 final dialog mydialog1 = new dialog(getapplicationcontext());                 mydialog1.setcontentview(r.layout.register);                 mydialog1.setcancelable(false); mydialog1.show();                 // if want call activity call here 5 seconds automatically call , image disappear....             }         }, 10000);     } 

layout of acticity

<?xml version="1.0" encoding="utf-8"?> <android.support.constraint.constraintlayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="match_parent"     tools:context="appsmash.keralapschelper.questionlist">     <include layout="@layout/content_main"       android:layout_marginleft="0dp"       app:layout_constraintleft_toleftof="parent"       android:id="@+id/include"       app:layout_constrainttop_totopof="parent"       app:layout_constraintbottom_tobottomof="parent" />    <textview       android:id="@+id/textview3"       android:layout_width="wrap_content"       android:layout_height="wrap_content"       android:text="textview"       app:layout_constraintbottom_tobottomof="parent"       android:layout_marginbottom="8dp"       app:layout_constrainttop_totopof="parent"       android:layout_margintop="8dp"       android:layout_marginleft="310dp"       app:layout_constraintleft_toleftof="@+id/include"       app:layout_constraintvertical_bias="0.039" /> </android.support.constraint.constraintlayout> 

use

new countdowntimer(10000, 1000) {      @override     public void ontick(long millisuntilfinished) {         // todo auto-generated method stub      }      @override     public void onfinish() {         // todo auto-generated method stub          final dialog mydialog1 = new dialog(getapplicationcontext());         mydialog1.setcontentview(r.layout.register);         mydialog1.setcancelable(false);         mydialog1.show();     } }.start(); 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -