Hi,
I'm new to android. I'm trying to create a widget which has an ImageView along with other stuff.
I want to know how can i access that ImageView in my widget class, not the activity, because in activity its easy.
thanks
What do you have so far? Do you have a loop over the appWidgetIds and get the remote views of the widget?
If not then check out http://developer.android.com/guide/topics/appwidgets/index.html for the basic widget setup.
But specifically what you are looking for I think is:
views.setImageViewResource(R.id.widget_image, R.drawable.new_image);
Related
Hello all,
I am trying to add a couple of digital clocks to my Xoom home page but I cannot seem to add it. I setup the parameters I want but cannot seem to get it on the home page. Is there anything special I need to do?
Thanks,
Steve
Provide more information please. What widget are you using and how are you adding them?
is it possible? I have created a unique sort of clock as an AppWidget that has horizontal bars that should indicate minutes and hours. How could I change the width of the LinearLayout used as a bar from the onUpdate() method? I tried RemoteViews but that Views seems to lack a setWidth() method...
appwidgets are unlike anything else in android. they cannot directly alter, add, or remove items from a layout. the only thing that can be altered is text in a textView, the visibility of a view inside the layout, and the value of any of the views inside the layout, like int, bool, float, images, progress bars.
you can however change the view entirely, as in change to another layout.xml
you'll have to be creative to be able to find a way for your widget to change. i think the setViewVisibility() method could help. if you layout every piece that you need and selectively set their visibility based on the state of your widget.
here is a kinda related topic
http://stackoverflow.com/questions/...-dynamically-in-an-android-widget-api-level-3
Hmm, so if I would do 60 linearlayouts and place them next to each other, and say the clock is 13:30, I set the first 30 layouts visible? How would that many views affect performance???
Not sure. Probably wouldn't be good with that many.
This is where you'll have to be creative. Might be good to have one image view and have a bunch of images of the bar at different stages. Though that would require alot of images.
Just remember you can change the content of a view but you cant add another view "on the fly". Its a tricky thing to deal with in an appwidget. Ive been trying to make a widget that displays a tag cloud of your gmail inbox and ive had to use a textView as a wrapper to display the generated html for the cloud instead of adding new textViews for each tag.
From something awesome
Can anyone give me an example of using a Stack Widget and being able to remove and add views dynamically.
Here is an example.
1) Widget loads and you add 4 views to the widget
2) User loads and activity within the same widget package and uses a button to delete one of the 4 views.
I need an example how to do that.
Thanks for the help!!
Im trying to give my application the feel of still being on the homescreen.
To do this, I want to make the transition into the application seamless
by keeping the homescreen background, and having a ViewPager to navigate
from screen to screen within my activity.
How would I achieve this transition?
Hi there.
I am trying to create a widget that displays some text that is updated from tasker. I would like the text to be colored by some logic defined in tasker. So in tasker I have a variable %Text1 that contains the following "[c=#FFAAAA]Mytext[/c]".
I have a task that updates my rich text box with the text above: Zooper Widget Pro Variable: Configuration #TTEXT1# = %Text1
Now I expected to see a pink "Mytext" in my widget but instead I see "[c=#FFAAAA]Mytext[/c]".
If I copy the text manually into Zooper Widget, it displays correctly.
What am I doing wrong?
Regards, Jesper.
Try to use c=#ffffaaaa or c=ffffaaaa sometimes zooper acts very strange if there is no alpha.
Thanks for your reply, sadly it didnĀ“t seem to make any difference..
It seems like Zooper only parses the text fields once, so any codes from tasker are not parsed. That meant I had to split up my text into several text boxes and use advanced parameters for coloring.