的ShowDialog德precated。有什么替代方案? [英] showDialog deprecated. What's the alternative?

查看:163
本文介绍了的ShowDialog德precated。有什么替代方案?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有别的东西,应该叫什么名字?

Is there something else that should be called?

showDialog(TIME_DIALOG_ID);

这是在本教程但是他说的德precated 的Eclipse中。

It's in this tutorial but says deprecated in Eclipse.

推荐答案

从<一个href="http://developer.android.com/reference/android/app/Activity.html">http://developer.android.com/reference/android/app/Activity.html

公众最终无效的ShowDialog(INT ID)新增的API级别1

public final void showDialog (int id) Added in API level 1

此方法去precated在API层面13.使用新DialogFragment   类FragmentManager代替;这也适用于旧的   通过Android兼容包的平台。

This method was deprecated in API level 13. Use the new DialogFragment class with FragmentManager instead; this is also available on older platforms through the Android compatibility package.

中的ShowDialog(INT,捆绑),不采取任何简易版   参数。只是调用的ShowDialog(INT,捆绑)与空参数。

Simple version of showDialog(int, Bundle) that does not take any arguments. Simply calls showDialog(int, Bundle) with null arguments.

为什么

  • 在显示一个对话框窗口,漂浮在其活动的窗口顶部的片段。该片段包含一个对话的对象,它基于片段的状态显示为合适。对话框控制(决定何时显示,隐藏,关闭它)应通过API来完成这里,不与对话框上直接调用。
  • 在这里是一个很好的讨论 的Andr​​oid DialogFragment VS对话
  • 在另外一个不错的讨论 <一href="http://stackoverflow.com/questions/13765127/dialogfragment-advantages-over-alertdialog">DialogFragment在AlertDialog
  • 优点
  • A fragment that displays a dialog window, floating on top of its activity's window. This fragment contains a Dialog object, which it displays as appropriate based on the fragment's state. Control of the dialog (deciding when to show, hide, dismiss it) should be done through the API here, not with direct calls on the dialog.
  • Here is a nice discussion Android DialogFragment vs Dialog
  • Another nice discussion DialogFragment advantages over AlertDialog

如何解决?

  • <一个href="http://android-developers.blogspot.in/2012/05/using-dialogfragments.html">http://android-developers.blogspot.in/2012/05/using-dialogfragments.html

更多

  • <一个href="http://developer.android.com/guide/topics/fundamentals/fragments.html">http://developer.android.com/guide/topics/fundamentals/fragments.html
  • <一个href="http://developer.android.com/training/basics/fragments/index.html">http://developer.android.com/training/basics/fragments/index.html
  • http://developer.android.com/guide/topics/fundamentals/fragments.html
  • http://developer.android.com/training/basics/fragments/index.html

这篇关于的ShowDialog德precated。有什么替代方案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆