Android :: How To Create A Widget?
Apr 27, 2009Somebody knows a tutorial that shows how to create a widget?
View 2 RepliesSomebody knows a tutorial that shows how to create a widget?
View 2 RepliesI can create a static widget without thinking, I can even create a widget like the analogue clock widget that will update itself, however, I can not for the life of me figure out how to create a widget that reacts to when a user clicks on it. Here is the best code sample that the developer documentation gives to what a widget activity should contain (the only other hint being the API demos, which only creates a static widget):
public class ExampleAppWidgetProvider extends AppWidgetProvider {
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
final int N = appWidgetIds.length;
// Perform this loop procedure for each App Widget that belongs to this provider
for (int i=0; i<N; i++) {
int appWidgetId = appWidgetIds[i];
// Create an Intent to launch ExampleActivity
Intent intent = new Intent(context, ExampleActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
// Get the layout for the App Widget and attach an on-click listener to the button
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.appwidget_provider_layout);
views.setOnClickPendingIntent(R.id.button, pendingIntent);................
I am trying to find a way to create a widget and the program on the same app so that i can give the user the choice to add to the home screen either the dynamic widget or the normal program, same functionality for both except that the widget would run a service to update every x hours and the program won't. Similar to what "bbc news" and "weather bug" have done. I am guessing that something needs to be added to the manifest but i have not found any documentation for it. Can anyone help on this?
View 6 Replies View RelatedI am a new developer in android, and I see some examples about activity, but I don't know How can I create the widget dynamically?
View 2 Replies View RelatedI am looking to create an android widget for my application. It is a static widget, meaning it does not periodically update itself with new data (like google search widget)? If that is the case, do I still need to create a service like the Word Widget sample in the android sdk?
View 1 Replies View RelatedI have read the LabelView example in APIDemo which show how to create a custom widget.However, what if I want to create a custom widget which is a composite of existing android widget?I know my custom widget need to be inherited from view, but if i do that, I can't do 'setContentView()' in my custom widget class (since that is an Activity method).so how can I apply the above xml to my custom widget class?
View 4 Replies View RelatedI would like to create a button with circular or rectangular background, text and an image below or above the text.I would like to create a CustomButton object with methods setText() and setImage() which would change the button text and image and place multiple CustomButtons into main layout.Does anyone know how to create a custom layout, place it into another layout(main) and modify its elements from the activity which is bound to main layout?
View 2 Replies View RelatedI need to create something like a JTree for my app and have been looking at ExpandableListView, but it only allows two levels. Does anyone know if it's possible to extend this to an arbitrary number of levels? I need a single top level and, below that, several second levels, each of which may contain their own levels. I would expect that one could set a second-level (child) item to be an ExpandableListView of it's own, but it doesn't seem possible. Thanks for any help on this, as it's holding up my entire project.
View 5 Replies View RelatedIn ApiDemo, there is a progressBar demo. It creates a horizontal progress bar with a xml.
<ProgressBar android:id="@+id/progress_horizontal" style="?android:attr/progressBarStyleHorizontal" android:layout_width="200dip" android:layout_height="wrap_content" android:max="100" android:progress="50" android:secondaryProgress="75" />
But how to create one programmatically? If just new ProgressBar(fContext), it is Default ProgressBar style.
I tried out Flyscreen the other day and found its card-based flipping through rss/facebook/twitter/weather to be very fluid and pretty. The trouble is, I don't really want that as my lockscreen (besides which, it doesn't seem to truly lock the screen). Does anyone know of a similar app that creates a widget I can flip through in a similar way on a homescreen?
View 1 Replies View RelatedI'm trying to create a tabbed view in my widget configure activity. I'm using a tab activity as my activity type and I have the following code..................
View 2 Replies View RelatedI'm looking at best way of creating Accordion-style widget such as on this page http://is.gd/1GNI3 What would be the best way of achieving same effect using standard Android toolkit or do I need to build custom widget? If so - which one would you recommend extending if any?
View 5 Replies View RelatedHow to create an HTTP request object of POST type in android? Which class need to be extend or what method need to implement? How to establish connection to a server? Actually i want to connect to a microsoft exchange server, and then i have to send a request to it using HTTP.
View 8 Replies View Relatedwill the device wake up if there is a widget instance on the homepage but the widget provider or receiver is disabled?If I have a widget instance on the home page, but if I were to disable the widget provider from receiving messages by disabling the component, and if I have no components receiving the messages targeted for that widget, will Android still wake up the device?
View 5 Replies View RelatedOne of the things I liked about Sense (I'm rooted now and running the Second Wave ROM) was the HTC weather animations when the screen was unlocked. After installing Widget Locker, I noticed an option to turn them on and now I have them back! I also installed the Weather & Toggle Widget and installed the weather skin that looks just like the Sense weather with the flip clock.The annoying part is that when it's sunny, or partly sunny, the "sun animation" from Sense doesn't perfectly align with the Weather & Toggle Widget weather icon. I know, I know, it's a minor problem and goes away when the animation is done, but the lack of symmetry sometimes annoys the hell out of me.
View 1 Replies View RelatedI am writing my first application and am trying to get my widget to load a different image when it is added to the home screen based on the state of the notification volume.It is detecting the notification state fine and the proper Toast messages appear when I add the widget, but I'm not getting any icon.I just get an empty button.I'm using the same code to change the icon in my onReceive() method to do other things and that works fine.Is this the proper way to accomplish that?
View 3 Replies View RelatedI am trying to pass the same touch events on one widget to the other so they both scroll at the same time and in same way. I have two Gallery widgets one above and one below. If the above one is scrolled then I want to pass the same touch event to the bottom widget so it also scrolls the same way.I have tried to use dispatchtouchevent events but I am facing an issue where in if the bottom gallery widget has some edit text then the edit text gets the key event and both widgets doesnt scroll anymore.I have tried to set focussable and editable to false on edittext even then it gets the touch events.I think I am going in the right direction. However I need some assistance in doing the right way.
View 3 Replies View RelatedI'm not understanding this whole weather app & widget thing...I'd like to have a nice looking widget on my desktop that flows with my theme. Not the one that the weather channel app has.
View 5 Replies View RelatedI basically want a widget which has a simlar layout as the twitter widget.As you can see the tweet text nicely wraps around the AUTHOR element. This can be done with one TextView using the following method: http://developer.android.com/guide/appendix/faq/commontasks.html#sele.The problem is that its a widget and i only have access to the ui elements using the RemoteViews.I was thinking of using a layout manager for this, but its impossible because textviews are always rectangular.So how do i do this? I know you helped twitter build their application.
View 4 Replies View RelatedI'm looking for a call log widget and a voicemail widget which look like the default mail app widget.That is, a simple small widget which show me the number of missed calls (if it's the call log widget) or the number of voicemails received (if it's the voicemail widget), just like the mail widget shows the number of emails received.
View 2 Replies View Relatedall my contacts are google contacts with several linked to Facebook accounts.When I access my contacts through the People widget, all's good, I only see the google contacts (I've deselected Facebookers in the view menu). However when I access the Messages widget all my contacts are doubled up for some reason. I realise this list is also showing facebook contacts as well as google contacts but even the non-facebook contacts are doubled up.
View 1 Replies View Relatedmy new Homescreen TAB CONTACT WIDGET.MY CONTACTS WIDGET ALBRAndroid Blog..In the market now " My Contacts widget".
View 15 Replies View Relatedbesides the power widget is there one you can download that just for gps that actually works and is problem free on the droid?.
View 3 Replies View RelatedI prefer using Launcher Pro but I lose the HTC News feed widget. Anyone have a good replacement for the News Feed widget or a good ESPN widget?
View 1 Replies View RelatedI've been looking for an agenda tool/widget for my Android phone. I've narrowed it down to these two (PLEASE don't post suggesting other alternatives!! And note that I don't mean the Pure Grid version!). I've been searching for half an hour, but I can not find anything that compares these 2 apps or shows any diffs between them. The best I've seen is comments like " beats hands down", with no explanation as to WHY.As far as I can see, for my purposes (using Google Calendar & Astrid), the only difference between the 2 is the PRICE! Both come in numerous widget sizes, both integrate with Astrid & Google, both are scrollable, both are skinnable. So why choose one over the other? (Or, really, why choose Pure Calendar over Android Agenda, given that the latter is free?) I wish I could just test both out but the Pure widget series has no demos
View 3 Replies View RelatedI have two gallery widgets in same screen. If user flings on top gallery widget I would like to replicate the same fling motion on the other gallery widget thats beneath the first one. Is there a way I can possibly achieve this.
View 2 Replies View RelatedI loaded the Fox News widget. Didn't like it. Uninstalled. On my home screen, in it's place, I now have a big widget that says "problem loading widget." How do I get rid of this?
View 5 Replies View RelatedIs there any calendar widget or app that closely resembles the HTC Calendar Widget?I'd like the full screen month view. Also, is there a slide-to-unlock app or screen to replace the default lock screen on 1.6?
View 3 Replies View RelatedWe have developed an widget and installed it on Nexus 10. It installed successfully but the widget didn't appear in widgets section. If I go to settings-apps I can see the widget installed properly. I can also remove it from the device without any issues. Developer options are turned on and unknown sources installation is also on.
I tried the widget onto Motorola Xoom and able to launch it without any issues.
I posted this question sort of embedded in the "show us your Droid X screen" but I think it got buried with all the "what is that widget?" questions.I see on some screens the picture widget picture is big. Mine is only about 1 inch by 1/2 inch.I can barely even get 1/2 a face in the picture.How do you get a bigger picture?I'm running LauncherPro, is that effecting it?Since I couldn't get a bigger picture, I decided to try and add the slide show widget. But when I try, it says Widget Conflict only one photo slideshow per home screen. I don't have any other slideshow widgets on my screen. Any ideas?
View 2 Replies View Related