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 ...
随机推荐
- 基于C语言的泛类型循环队列
循环队列多用于通信数据缓存中,尤其是在双方设备接收数据与处理数据不同步的情况下,使用循环队列先缓存通信数据,然后按照时间戳数据出队作出相应的处理,是一种比较合适的做法,在嵌入式编程中亦是如此.使用循环 ...
- 【EF Core】实体的主、从关系
假设有以下两个实体: public class Student { public int StuID { get; set; } public string? Name { get; set; } p ...
- Windows同时安装多个JDK
一.下载并安装JDK这一步选择你需要的JDK并下载安装,记得要记住安装的路径. 二.为JDK配置环境变量①找到系统环境变量 ②新建如下三个环境变量 第一个表示默认Java的home路径,以后在更改JD ...
- Hexo博客yilia主题文章添加目录
参考文章 添加目录的文章有一些是自己添加css文件和修主题配置 作者也更新了文章大体目录的功能 打开配置文件themes/yilia/_config.yml 你可以选择toc设置为1 或者2 toc: ...
- PlayWright(二十)- Pytest之conftest文件
1.介绍与使用场景 conftest.py 这个是什么呢? 顾名思义,他就是一个文件,那这个文件是干什么用的呢? 在我们上文中,用了fixture函数是直接在用例的文件里定义的,那不能我们所有 ...
- MAUI 框架开发 将 MAUI 嵌入到 WPF 控件里
本文将介绍如何将 MAUI 的底层替换为 WPF 框架层,且将 MAUI 的内容嵌入到 WPF 的一个控件里面,无 UI 框架嵌入的空域问题 本文是 MAUI 框架开发博客,而不是 MAUI 应用开发 ...
- PE结构总览
pe文件经历了从16位系统到32位系统的过度.因此32系统下的每一个PE文件都可以在16位系统下运行. 16位系统下的PE结构 在16位系统下,PE结构可以大致分为两个部分:DOS头和一些其他数据 # ...
- Django日志输出
# 自定义日志输出信息 LOGGING = { 'version': 1, 'disable_existing_loggers': True, 'formatters': { 'standard': ...
- [db2]数据备份与还原
前言 备份还原db2数据库一般有两种方式,一种是使用db2 backup + db2 restore,另一种是db2move + db2look.前者备份的数据库文件不能使用后者的方式进行还原. 实例 ...
- python将print的打印内容保存到日志
将python程序中的所有打印内容都输出到日志文件中,在程序执行完成后,方便查询程序运行过程是否出现异常. 1. 将打印内容输出到日志文件 1.1 代码实现: sys.stdout = open('s ...

android