I have created a widget for an application. And widget is displaying along with the name under widget tab. When I drag the widget onto the home screen, the name below the widget is missing.
I have already set the label property for the <receiver></receiver>.
Is there anything else I need to do or any other configuration to change?
Regards.
You can set the name of your app widget to be displayed in the widget
picker by adding android:label="the name of my appwidget" to the
receiver that handles appwidget related intents in
AndroidManifest.xml. It is documented in a somewhat obscure place:
http://developer.android.com/reference/android/appwidget/AppWidgetProviderInfo.html#label
How do I give a Android App Widget a Label/Name
Sorry to say that, it is not possible, because widgets name will be shown in only widgets menu not on home screen in many launchers, But you can use Shortcuts.
Shortcuts show the name with icon, they are simple, all data (icon, label, intent) is static, determined at creation time. They can't be updated dynamically, or resized, or scroll. But they match the launcher styling (and can be placed inside folders or the dock) and use less resources than AppWidgets.
As #kevin TeslaColl suggested, you should use Shortcuts
If you want a label to appear bellow the widget when its placed on the home screen, just place a TextView on your widget xml layout with the label you want
Related
The app I am wrorking on has three widgets right now. Each of these widgets has a different size and a fix layout file.
Now I've developed a new widget which is resizable and adaptive. It loads a fitting layoutfile according to its size.
Now with the next update with my app I would like to achieve the following:
List only the new adaptive widget in the widget drawer, so the old widgets cannot be created
Already existing widgets shall use the logic of the new widget to update their views
Right now I think that these two goals contradict each other. When I delete or disable the widget receiver from the manifest the widget disappears from the widget drawer but on the same time the existing widget on the homescreen breaks.
When I let the existing widget provider use the new logic the old widgets behave like the new one but on the widget drawer I've got four times the same widget.
Is there a way to achieve my goals? If not, is it possible to hide the old widgets for new users while they will be there for extings users who are updating their app?
Thanks a lot for your answers!
There is no solution to this. When you move the package name of the widget provider the widget gets deleted.
I settled on using one provider of my old widgets which got migrated to the new one. The other three were deleted.
I am working on the Note's application. In my appication i want to add the functionality like ColorNotes and Notes app. When i long click to any listview item then it should become the widget on main screen.
How can i build such functionality ?
you can use below link to Learn App Widget
https://developer.android.com/guide/topics/appwidgets/index.html
Use this Example for Sample this will help you to understand how will use list in Widget
https://github.com/commonsguy/cw-advandroid/tree/master/AppWidget/LoremWidget
I am going to assume that those are screenshots of Android home screens, showing some app widgets.
You cannot cause an app widget to be added to the home screen. After all, not all home screens offer app widgets. The user would have to set up the app widget themselves.
Given that the user set up the app widget, you are welcome to populate it based on a long-click of a list row in one of your activities. Use AppWidgetManager and updateAppWidget() to push a new RemoteViews to the app widget based on what the user long-clicked on.
I want to create an android widget like CNN app widget. Let me explain you the follow of widget. I set on variable on shared preference to store category value if its null than open one activity which has list to select category and than load the data according to that category in widget. I put my code on onUpdate even in widget it will load data according to the category its working fine but my problem is when i am going to set my widget i just click on it and it will open the activity after i select the category it will close category activity but widget is not set on home screen so for that i have to again to the widget menu have to pic the widget and drop on the homescreen.
so i want to open my category selection activity when user drop the widget on home screen. I google a lot but not find any solution for it. please help me out. Thank you in advance.
You need to set the configure Activity to the widgets's xml file like this:
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:configure="your.package.your.activity"
.... />
Here is the official documentation regarding this topic:
https://developer.android.com/guide/topics/appwidgets/index.html#Configuring
I've problem, that i want to create a home screen widget with listview inside, which should be scrollable. I read on docs page, that listview is only supported in remoteview from 3.0 android.
But still i think, this is not completely true, or i am missing something. Ok, when i tried do add listview to my home screen diget, i get error: class not allowed to be inflated android.widget.listview. BUT on my phone i have android 2.2.3 and i am able to add home screen widget (its some email application widget) which shows SCROLLABLE list of my emails, look here:
http://i50.tinypic.com/2gslq2q.png
And my question is: How is this possible and how to do it, in which way? Im googling few hours, but have absolutely no idea how is this possible (maybe dynamically generate items int vertical linear layout and create manualy scroller on right side, but it sound terrible complicated).![enter image description here][1]
EDIT: maybe its possible to generate long list of items into linear layout and detecting, if user is moving up or down with finger...
I read on docs page, that listview is only supported in remoteview from 3.0 android.
Correct.
i am able to add home screen widget (its some email application widget) which shows SCROLLABLE list of my emails
That is not an app widget. That is a feature of that home screen implementation.
maybe its possible to generate long list of items into linear layout and detecting, if user is moving up or down with finger...
No, sorry.
I am building a home screen widget and I want to add an advertisement to it. Currently the advertises SDK provides a custom view widget which I tried to embed in my home screen widget. But when I add it, it says problem loading widget. I'm guessing I can't add custom views to a widget? Could someone clarify or tell me how I could add an advertisement to my home screen widget.
Thank you
Home screen widgets support very limited number of standard widgets. You can't use custom widgets for them. See App Widgets.