Hi all android developers! I want use Arc progress view in Widget to implement action progress circular timer. But, widget not support custom views. I found following way Android: AppWidget with custom view not working but always bitmap is null. Anybody know how to create custom view and get its bitmap without add it to window?
Asked
Active
Viewed 2,741 times
1
-
Have you found the solution? – Henry Apr 17 '16 at 08:32
-
Possible duplicate of ["Android: AppWidget with custom view not working"](https://stackoverflow.com/q/4062559/5742625) – Willie Chalmers III Jul 21 '17 at 20:57
1 Answers
2
CustomView view = new CustomView(context);
view.measure(250, 250);
view.layout(0, 0, 250, 250);
view.setDrawingCacheEnabled(true);
Bitmap bitmap = view.getDrawingCache();
remoteViews.setImageViewBitmap(R.id.myImageView, bitmap);
//PUSH WIDGET UPDATE

Naruto Uzumaki
- 2,019
- 18
- 37
-
1better do `view.measure(View.MeasureSpec.makeMeasureSpec(250, EXACTLY), View.MeasureSpec.makeMeasureSpec(250, EXACTLY))` – sulai Feb 07 '20 at 15:48