I was trying with a timer when the timer ends i have to show a popup box but it is not working the activity goes back to the first activity where it called is there anyway to do this? i have also tried with alert box it also 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 you want to call Activity then call from here for 5 seconds it automatically call and your image disappear....
}
}, 10000);
}
layout of this 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>