0

I decided to add a App Widget to my application , I follow this guide on official Android developer page (link). Done everything what they have there and still I get this error:

enter image description here

I have my app-widget provider in /res/xml. Having widget layout in /layout folder and having AppWidgetProvider.java in Java folder.

So everything should be fine. Also I am using latest Android Studio with latest SDK (23) and latest build tools (23.0.2) and also using appcompat-v7 suppport library.

I pasted code from the page, just to be sure everything is in order. Seems like it's not.

I am frustrated after several hours of trying everything. My appplication is long term project, I am almost at the code version 200, so I have some experience, but not with this. I also read almost the whole thing.

PS: Any code would be useless to post in here, since it's the same code from that official Android Developer page. I wanted to do "prototype", which I can then customize to my needs. I never worked with widgets.

halfer
  • 19,824
  • 17
  • 99
  • 186
Michal Žídek
  • 464
  • 2
  • 17
  • 1
    The sample widget layout consists of a FrameLayout containing a LinearLayout. Your IDE really can't render that? – Bö macht Blau Nov 15 '15 at 17:08
  • No and even on my phone it does not work, I have it in different language but it says: "Widget cannot be added" or something along those lines. It's a greay area with black text. What's weird, that if I define android:configure="com.example.android.someActivity in app-widget provider it works, just not the widget itself. And logcat doesn't show any problems. So I really don't what to do.And I checked the code 1000x times, it's really frustrating. – Michal Žídek Nov 15 '15 at 17:13
  • 1
    Ok, so there are two possibilities.1) you have a mistake somewhere. Typo,... whatever. 2) for some reason the sample does not work in your environment. Maybe it's better to emulate Lollipop and try another sample. If you like, I'll look for a link tomorrow (don't have access to my PC right now) Or you still can put your whole project somewhere so people can take a look. – Bö macht Blau Nov 15 '15 at 17:35
  • I can't since is for bussinesss with lots of my code which I don't want to share and nobody in the cmompany don't work as a programmer. Of course, I could say to someone "do me a simple widget", but than again I don't know where to find these guys. Typo would probably be highlited as and error, so thats unlikely, but still a possibility, but thanks to my 21:9 monitor I have enoguh space to go line to line with my browser and AS side by side and check what has been written there. And if you can post me a link tomorrow, it would be much appreciated. Thanks! – Michal Žídek Nov 15 '15 at 17:40
  • 1
    This [(solved) SO question](http://stackoverflow.com/questions/31713373) contains a link to a Github repository with a code sample. Other samples can be found [here](https://github.com/commonsguy/cw-omnibus/tree/master/AppWidget) Good luck! – Bö macht Blau Nov 16 '15 at 08:28

0 Answers0