The method dismissDialog(int) from the type Activity is deprecated
|
The method
What's the reason? and how to solve it? |
|
7down voteaccepted
|
What's the reason? http://developer.android.com/reference/android/app/Activity.html#showDialog(int) Android DialogFragment vs Dialog How to solve it? Use the new DialogFragment class with FragmentManager instead; this is also available on older platforms through the Android compatibility package. http://android-developers.blogspot.in/2012/05/using-dialogfragments.html |
|
Google recommends that we use |
||||
|
Yes use With regards handling events in your fragment there would be various ways of doing it but I simply define a message In the dialog hold a message and instantiate it in the constructor:
Implement the `onClickListener' in your dialog and then call the handler as appropriate:
Edit And as
Then in
|
|||||||||||||||||||||
|
|
I would recommend using Sure, creating a "Yes/No" dialog with it is pretty complex considering that it should be rather simple task, but creating a similar dialog box with (Activity lifecycle makes it complicated - you must let The nice thing is that you can usually build your own abstraction on top of |
|||||||||||||||||
|
Use DialogFragment over AlertDialog:
|
|||
|
You can create generic DialogFragment subclasses like YesNoDialog and OkDialog, and pass in title and message if you use dialogs a lot in your app.
Then call it using the following:
And handle the result in |
|||||||||||||||||||||
|
The method dismissDialog(int) from the type Activity is deprecated的更多相关文章
- hibernate3和4中 HibernateSessionFactory中不同之处 The method applySettings(Map) from the type ServiceRegistryBuilder is deprecated - The type ServiceRegistryBuilder is deprecated
hibernate3和4中 HibernateSessionFactory中不同之处 //serviceRegistry = new ServiceRegistryBuilder().applySet ...
- .replace(R.id.container, new User()).commit();/The method replace(int, Fragment) in the type FragmentTransaction is not app
提示错误:The method replace(int, Fragment) in the type FragmentTransaction is not applicable for the arg ...
- 错误:The method replace(int, Fragment) in the type FragmentTransaction is not applicable for the arguments (int, MyFragment)
Fragment newfragment =new MyFragment();fragmentTransaction.replace(R.layout.activity_main,newfragmen ...
- The method replace(int, Fragment, String) in the type FragmentTransaction is not applicable for the arguments (int, SettingFragment, String)
The method replace(int, Fragment, String) in the type FragmentTransaction is not applicable for the ...
- The method setPositiveButton(int, DialogInterface.OnClickListener) in the type AlertDialog.Builder is not applicable for the arguments
The method setPositiveButton(int, DialogInterface.OnClickListener) in the type AlertDialog.Builder i ...
- The method makeText(Context, CharSequence, int) in the type Toast is not applicable for the arguments (new View.OnClickListener(){}, String, int)
package comxunfang.button; import android.support.v7.app.ActionBarActivity; import android.os.Bundle ...
- delete attempted to return null from a method with a primitive return type (int)
今天被自己给蠢死了 今天在代码中遇到这个错误, 百度翻译一下:映射方法,从一org.system.mapper.child.chmorganizationexaminationmapper.delet ...
- attempted to return null from a method with a primitive return type (int).
java接口文件 package com.cyb.ms.mapper; import org.apache.ibatis.annotations.Param; public interface Acc ...
- The method setPositiveButton(int, DialogInterface.OnClickListener) in the type AlertDialog.Builder i
参考资料: http://blog.csdn.net/competerh_programing/article/details/7377950 在创建Dialog的时候,出现: The method ...
- Mapper method 'com.xxxx.other.dao.MyDao.getNo attempted to return null from a method with a primitive return type (int)
使用myBatis调用存储过程的返回值,提示错误信息: org.apache.ibatis.binding.BindingException: Mapper method 'com.xxxx.othe ...
随机推荐
- Python编程和数据科学中的机器学习:如何处理和可视化具有噪声和干扰的数据
目录 随着数据科学和机器学习的快速发展,处理和分析具有噪声和干扰的数据成为了一个日益重要的挑战.在数据科学和机器学习中,噪声和干扰通常来自于各种因素,例如随机性和非随机性,数据缺失,数据集中的错误或错 ...
- css学习(一)
css引入 内联样式 <div style="color: red; font-size: 30px;">我是div元素</div> 2.内部样式 < ...
- 使用 Sa-Token 实现不同的登录模式:单地登录、多地登录、同端互斥登录
一.需求分析 如果你经常使用腾讯QQ,就会发现它的登录有如下特点:它可以手机电脑同时在线,但是不能在两个手机上同时登录一个账号. 同端互斥登录,指的就是:像腾讯QQ一样,在同一类型设备上只允许单地点登 ...
- CentOS 30分钟部署免费在线客服系统
前段时间我发表了一系列文章,开始介绍基于 .net core 的在线客服系统开发过程.期间有一些朋友希望能够给出 Linux 环境的安装部署指导,本文基于 CentOS 7.9 来安装部署. 我详细列 ...
- 硬件管理平台 - 公共项目搭建(Nancy部分)
项目变更 之前使用的是Nancy库进行项目搭建的,使用的Nuget版本及其他引用如下 <?xml version="1.0" encoding="utf-8&quo ...
- 基于 Habana Gaudi 的 Transformers 入门
几周前,我们很高兴地 宣布 Habana Labs 和 Hugging Face 将开展加速 transformer 模型的训练方面的合作. 与最新的基于 GPU 的 Amazon Web Servi ...
- asset module type 替代 loader 处理图片字体等文件资源
前面文章中 体验了webpack的打包 .解析css资源 ,接下来看看项目中常用到的图片.字体.文件该怎么处理吧~ 项目路径如下,在上一篇 解析css资源 项目基础上增加了一些文件 demo ├─ s ...
- Apache solr XML 实体注入漏洞(CVE-2017-12629)
描述: Apache Solr 是一个开源的搜索服务器.Solr 使用 Java 语言开发,主要基于 HTTP 和 Apache Lucene 实现.原理大致是文档通过Http利用XML加到一个搜索集 ...
- 《CUDA编程:基础与实践》读书笔记(1):CUDA编程基础
1. GPU简介 GPU与CPU的主要区别在于: CPU拥有少数几个快速的计算核心,而GPU拥有成百上千个不那么快速的计算核心. CPU中有更多的晶体管用于数据缓存和流程控制,而GPU中有更多的晶体管 ...
- BUUCTF Reverse-[FlareOn6]Overlong-动态调试
没有什么问题,直接进 三个函数,字符串也没啥特殊的 应该是个加密 返回上面分析 数据很大,你忍一下 也就是说它会找28位加密 然后我们接着分析 这个提示刚好28位 也就是说28位对应这个框 如果我们修 ...

android