package com.example.androidtest2;

import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;

import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private EditText editText;
private ImageView imageView;
private ProgressBar progressBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button button = (Button) findViewById(R.id.Button);
editText =(EditText) findViewById(R.id.edit_text);
imageView = (ImageView) findViewById(R.id.image_view);
progressBar = (ProgressBar) findViewById(R.id.progress_bar);
button.setOnClickListener(this);
}
public void onClick(View v){
switch (v.getId()){
case R.id.Button:
int progress = progressBar.getProgress();
progress = progress+10;
AlertDialog.Builder dialog = new AlertDialog.Builder(MainActivity.this);
dialog.setTitle("有个超级重要的信息");
dialog.setMessage("大家手里还有硬币吗?");
dialog.setCancelable(false);
dialog.setPositiveButton("都给你", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {

}
});
dialog.show();
//这里写逻辑
break;
default:
break;
}

}
}

Android studio 使用dialog提示信息的更多相关文章

  1. 好看的dialog,sweet Alert Dialog 导入Android Studio

    系统自带的dialog实在是丑到无法忍受.所以找到了一款比较好的第三方dialog. github 地址如下:https://github.com/pedant/sweet-alert-dialog ...

  2. Android studio使用android:style/Theme.Dialog报错:You need to use a Theme.AppCompat theme (or descendant) with this activity. at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)

    查找原因是在activity java代码部分继承了compatactivity public class DialogActivity extends AppCompatActivity 但是在An ...

  3. Android Studio快速开发之道

    概述 现如今开发越来越追求效率和节奏,节省出时间做更多的事情,除了开发技术上的封装等,开发工具的使用技巧也是很重要的,今天就根据自己的经验来给大家介绍一下Android Studio快速开发之道. P ...

  4. Android Studio各种快捷功能及好用的插件

    转载:http://www.jianshu.com/p/c439605a4364 概述 现如今开发越来越追求效率和节奏,节省出时间做更多的事情,除了开发技术上的封装等,开发工具的使用技巧也是很重要的, ...

  5. [原]在AMD机器上使用android studio

    amd机器上使用android studio进行调试.因为amd的cpu不支持IntelVT,所以可能会有如下错误提示   我们有几个选择: 1. 使用真机调试 2. 配合genymotion 3. ...

  6. android studio 各种问题

    1.dexDebug ExecException finished with non-zero exit value 2 全bug日志如下: (Error:Execution failed for t ...

  7. eclipse项目迁移到android studio(图文最新版)

    前言 最近Android studio(下文简称AS)官方发布了正式版,目前火得不行.个人认为主要是因为android是google自家的产品,AS也是他自己搞的IDE,以后的趋势android开发肯 ...

  8. android studio遇到的问题(记录总结)

    SDK 无法更新解决方案 这个问题不是Android Studio的问题,而且由一些一些众所周知的原因导致的,我们这里说下解决办法. 打开SDK Manager,停止更新连接:在界面上方找Tools- ...

  9. 在Android Studio中使用shareSDK进行社会化分享(图文教程)

    [声明] 欢迎转载,但请保留文章原始出处→_→ 生命壹号:http://www.cnblogs.com/smyhvae/ 文章来源:http://www.cnblogs.com/smyhvae/p/4 ...

  10. android studio使用说明

    一.学习的基本配置文档,搞好各种参数的基本配置,熟练使用. C:\Program Files\Java\jdk1.7.0_09\bin   二.problems meet in weather and ...

随机推荐

  1. The Nine Arches Bridge

  2. 2022-11-19学习内容-Server端代码编写-Client端代码编写

    1.Server端代码编写 1.1UserDBHelper.java package com.example.chapter07_server.database; import android.con ...

  3. torch& tensorflow

    #torchimport torch import torch.nn as nn import torch.nn.functional as F class Net(nn.Module): def _ ...

  4. C#中检测代码执行时间

    使用System.Diagnostics.Stopwatch, using System; using System.Diagnostics; using System.Threading; clas ...

  5. JSON::ParserError - 416: unexpected token at

    rm -rf ~/.cocoapods/repos/Spec_Lockandrm -rf ~/.cocoapods/repos/trunk/

  6. <<运算?&=、|=、 ^=、<<=、>>=的意思? 十六进制前缀是 0x。

    <<运算? a<<b 表示把a转为二进制后左移b位(在后面添加 b个0).例如100的二进制表示为1100100,100左移2位后(后面加2个零):1100100<< ...

  7. ONOS-2.2在IntelliJ IDEA进入调试模式

    转载https://blog.csdn.net/fsdgfsf/article/details/90369709 在ONOS2.2中使用IDEA打开并支持断点调试 1.让环境变量生效 . /etc/p ...

  8. 最简单的asp验证码

    <%Public Function BornVerifyCode()         Randomize '设置随机因子         BornVerifyCode=Mid((Rnd * 10 ...

  9. Vite项目打包配置详解

    一:vite构建项目 配置base 1.base配置打包公共路径 打开package.json 做项目时可以不去掉 好了,在以上你构建了vite,并配置了最简单的操作后,你准备配置vite.confi ...

  10. Lecture 2. Fundamental Concepts and ISA - Carnegie Mellon - Computer Architecture 2015 - Onur Mutlu

    并不只有冯诺依曼模型,按照控制流顺序执行指令 还有 data flow 模型,按照数据流顺序执行指令 冯诺依曼模型和数据流模型的编程语言的一个对比 Control-driven 编程模型和 data- ...