search

Home  >  Q&A  >  body text

android6.0方法弃用

这个方法被弃用了
怎么解决
我在百度上看到是用math来替代 但是Match.sqrt返回的是double类型不能强转成float啊

天蓬老师天蓬老师2839 days ago694

reply all(4)I'll reply

  • 高洛峰

    高洛峰2017-04-17 15:05:20

    http://stackoverflow.com/questions/32065160/method-floatmath-sqrt-not-found
    http://bbs.mob.com/thread-17165-1-1.html
    Answer Everyone said it should be changed to:

    (float)Math.sqrt(...)
    

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 15:05:20

    Give me a solution that is not particularly good, but can solve the problem:

    Double.valueOf(Math.sqrt(4.0)).floatValue();

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-17 15:05:20

    You select the deprecated method and press F3 to see what the deprecated method is replaced with

    reply
    0
  • 高洛峰

    高洛峰2017-04-17 15:05:20

    Although it is not completely related, but also mention it
    https://github.com/android-cn/android-discuss/issues/291

    reply
    0
  • Cancelreply