为了账号安全,请及时绑定邮箱和手机立即绑定

android Drawable转换成Bitmap失败

android Drawable转换成Bitmap失败

慕侠2389804 2019-04-14 11:28:51
错误代码:08-0706:42:30.48228497-28497/app.tianxiayouE/AndroidRuntime﹕FATALEXCEPTION:mainProcess:app.tianxiayou,PID:28497java.lang.RuntimeException:UnabletostartactivityComponentInfo{app.tianxiayou/app.tianxiayou.AppInfoActivity}:java.lang.ClassCastException:android.graphics.drawable.VectorDrawablecannotbecasttoandroid.graphics.drawable.BitmapDrawableatandroid.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)atandroid.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)atandroid.app.ActivityThread.access$800(ActivityThread.java:151)atandroid.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)atandroid.os.Handler.dispatchMessage(Handler.java:102)atandroid.os.Looper.loop(Looper.java:135)atandroid.app.ActivityThread.main(ActivityThread.java:5257)atjava.lang.reflect.Method.invoke(NativeMethod)atjava.lang.reflect.Method.invoke(Method.java:372)atcom.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)atcom.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)Causedby:java.lang.ClassCastException:android.graphics.drawable.VectorDrawablecannotbecasttoandroid.graphics.drawable.BitmapDrawableatapp.tianxiayou.AppInfoActivity.initAppInfo(AppInfoActivity.java:70)atapp.tianxiayou.AppInfoActivity.onCreate(AppInfoActivity.java:52)atandroid.app.Activity.performCreate(Activity.java:5990)atandroid.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)atandroid.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)            atandroid.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)            atandroid.app.ActivityThread.access$800(ActivityThread.java:151)            atandroid.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)            atandroid.os.Handler.dispatchMessage(Handler.java:102)            atandroid.os.Looper.loop(Looper.java:135)            atandroid.app.ActivityThread.main(ActivityThread.java:5257)            atjava.lang.reflect.Method.invoke(NativeMethod)            atjava.lang.reflect.Method.invoke(Method.java:372)            atcom.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)            atcom.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)方法中的代码AppInfotempInfo=newAppInfo();//获取应用名字tempInfo.setAppName(packageInfo.applicationInfo.loadLabel(getPackageManager()).toString());//ICONicondrawable=packageInfo.applicationInfo.loadIcon(getPackageManager());bitmapDrawable=(BitmapDrawable)icondrawable;tempInfo.setAppIcon(bitmapDrawable.getBitmap());求大神指导
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 341 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信