10

i made a extended a View, overwrote the 3 View Contructors and tried to insert it on my xml of a widget.

The Exception is:

java.lang.ClassNotFoundException: com.mypackage.myView in loader dalvik.system.PathClassLoader@4001e710

is it possible to use custom views in Widgets?

2 Answers 2

12

is it possible to use custom views in Widgets?

If by "Widgets" you mean "app widgets", then, no. You cannot use custom View classes in app widgets.

Sign up to request clarification or add additional context in comments.

Comments

2

But you could use an ImageView which is supported in a widget:

  1. Create a Bitmap and draw with a Canvas on it:
Bitmap mBitmap = Bitmap.createBitmap(mWidht, mHeight, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(mBitmap);
canvas.drawText("test", 0, 30, new Paint());
  1. Assign this bitmap to ImageView in the widget by using
remoteViews.setImageBitmap(viewID, mBitmap);

See this post for more information

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.