Android几秒后自动关闭dialog
代码改变世界
Android几秒后自动关闭dialog

AlertDialog.Builder builder = new AlertDialog.Builder(v.getContext());
builder.setTitle("发送成功!");
builder.setMessage("2秒后自动关闭!");
builder.setCancelable(true);
final AlertDialog dlg = builder.create();
dlg.show();
final Timer t = new Timer();
t.schedule(new TimerTask() {
public void run() {
Intent intent1 = new Intent();
intent1.setClass(InquirySheetListActivity.this, MainActivity.class);
startActivity(intent1);
finish();
dlg.dismiss();
t.cancel();
}
}, 2000);
AlertDialog.Builder builder = new AlertDialog.Builder(v.getContext());
builder.setTitle("发送成功!");
builder.setMessage("2秒后自动关闭!");
builder.setCancelable(true);
final AlertDialog dlg = builder.create();
dlg.show();
final Timer t = new Timer();
t.schedule(new TimerTask() {
public void run() {
Intent intent1 = new Intent();
intent1.setClass(InquirySheetListActivity.this, MainActivity.class);
startActivity(intent1);
finish();
dlg.dismiss();
t.cancel();
}
}, );
Android几秒后自动关闭dialog的更多相关文章
- Duilib 实现右下角弹出像QQ新闻窗口,3秒后自动关闭(一)
转载:https://blog.twofei.com/667/ 自绘或子类化控件时,有时需要处理鼠标进入(MouseEnter)/鼠标离开(MouseLeave)/鼠标停留(MouseHover)消息 ...
- js5秒后自动关闭本页面及5秒钟后自动跳转指定页面的方法
5秒钟后自动关闭 <!DOCTYPE HTML> <html> <head> <title>倒计时自动关闭/跳转页面</title> < ...
- easyui messager alert 三秒后自动关闭提示
$.messager.alert(' ','<font size=\"2\" color=\"#666666\"><strong>数据库 ...
- js-弹框倒计时三秒后,自动关闭???
效果: js: //弹出窗,三秒倒计时 countdown(){ //点击发布按钮后,三秒倒计时开始 $(".btn-pub").click(function(){ var cou ...
- android 页面停几秒后跳转
<span style="white-space:pre"> </span>//实现等待几秒后跳转,方法一 new Handler().pos ...
- js弹框3秒后自动消失
开发中有时候会需要最出弹框后,过几秒自动消失的效果,下面给大家分享一下我自己做的一个小案例. 案例中的弹框使用的是bootstrap里面的模态框,实现自动消失则用的是js中的setInterval方法 ...
- android 8种对话框(Dialog)使用方法汇总
1.写在前面 Android提供了丰富的Dialog函数,本文介绍最常用的8种对话框的使用方法,包括普通(包含提示消息和按钮).列表.单选.多选.等待.进度条.编辑.自定义等多种形式,将在第2部分介绍 ...
- Android开发——你真的了解Dialog、Toast和Snackbar吗
0. 前言 今天给大家带来一篇简单易懂的关于Android提醒小功能的文章.Dialog和Toast我们都不陌生,而Snackbar是Design Support库中提供的新控件,有些朋友可能还不了解 ...
- 【Android】设置android:maxLines="1"后,android:imeOptions="actionSearch"失效
android:singleLine在API LEVEL 3已经废弃,可以用android:maxLines="1"代替. 但是测试的时候发现设置android:maxLines= ...
随机推荐
- Java类的静态块の二
在上一篇Java类的静态块の一中介绍到:类的静态块在类加载时候执行,执行早于构造函数,并且只执行一次. 但是在下面的例子中却发现JVM并不是把把所有的static模块都执行完成再执行其他(Java果然 ...
- uvm_pkg——老板,打包带走
Thus spake the master programmer: “After three day without programming, life becomes meaningless.” 编 ...
- shell中的-z
-z 字符串为"null",即是指字符串长度为零.
- [总结].net操作MongoDb通用基础类1:
public class MongoDBHelper { //定义Mongo服务 private MongoServer mongo = null; //获取databaseName对应的数据库,不存 ...
- 洛谷 P2947 [USACO09MAR]仰望Look Up
题目描述 Farmer John's N (1 <= N <= 100,000) cows, conveniently numbered 1..N, are once again stan ...
- UVA 1625 Color Length 颜色的长度 (预处理+dp)
dp[i][j]表示前一个序列拿了i个颜色,后一个序列拿了j个颜色的最小花费. 转移的时候显然只能向dp[i+1][j],或dp[i][j+1]转移,每增加拿走一个颜色,之前已经出现但没结束的颜色个数 ...
- Velocity模板语法说明
Velocity基本语法 "#"用来标识Velocity的关键字,包括#set.#if .#else.#end.#foreach.#end.#include.#parse.#mac ...
- POI写入word docx 07 的两种方法
下载最新jar包:http://poi.apache.org/download.html 以及API 1.写入word 1.1 直接通过XWPFDocument生成 在使用XWPFDocument写d ...
- Bootstrap 网格系统(Grid System)
Bootstrap 网格系统(Grid System) Bootstrap提供了一套响应式,移动设备优先的流式网格系统,随着屏幕或视口(viewport)尺寸的增加,系统会自动分为最多12列. 什么是 ...
- vue新手入坑之mounted和created的区别(生命周期)
这几个月用vue框架新做了一个项目,也算是边学习边实践吧.学习中也看过一些别人的开源项目,起初对mounted和created有一些疑惑,查询相关资料发现,这和vue的生命周期有关,在此也就做一个总结 ...