show spinner before adding widget android - android

For a widget I am creating for the Android OS, I want the user to first select a certain option from a Spinner. Just like when you add a shortcut to the homescreen.
Is that possible or do you have to start an Activity?
If it is possible, can anyone explain how to do it?

Spinner widgets do not exist on their own -- you have to have them in an Activity. Android's app widget framework supports the notion of a configuration activity that is automatically launched when somebody chooses your widget. Just put your Spinner in there.

Related

Creating a Widget only application in Android?

To clarify the question:
I have seen multiple Apps in the Playstore that are widget only Apps without visible activities.
I tried to create one myself but I need to define a launcher Activity. Once I use the configuration Activity of the Widget as a launcher the app becomes visible in the app overview in Android.
https://i.imgur.com/lhx0TDG.png
If I dont define a launcher Activity I cant even deploy the app on the emulator.
The developerguide on https://developer.android.com/guide/topics/appwidgets/index.html about Widgets isnt really clear about how to handle this case.
Any help or directions where to find information is appreciated.
If you want to create a widget only android application without any activity. You don't have to declare any intents for your activity. Just pass the intent filter for android.appwidget.action.APPWIDGET_CONFIGURE It will make the activity load when the user adds it to their home screen. Now you can simply declare your configuration class with your widget layout xml file with android:configure attribute liking to the class file the widget runs on.
Hope this helps.

How can i make widget of any ListView item?

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.

A second home screen button to open a secondary activity?

I made an image viewer MyImageViewer, and I had to build a filemanager for it, called MyFileManager, as a class. I open MyFileManager from MyImageViewer through Intents perfectly.
It turns out that now I like MyFileManager more than the actual file manager that came with my Android (that is tooooo slow and tooooo limited). So I want to add a second launcher button to the Home Screen for MyFileManager class, besides the one I already have for MyImageViewer.
Is there an easy way to do this, besides using widgets? In general widgets keep 'listening' to triggers, and hence consume battery and resources. I just want a simple button to launch my MyFileManager.
If widgets are the only solution, do you have a link/code to implement a very lightweight widget to do what I want? Or is this lightweight enough: http://www.javacodegeeks.com/2013/05/modal-dialog-popup-from-android-widget-example.html
Thanks!!
L.

adding applications onto the widgets list present in home screen

Hie all ,
I am trying to create an simple application and i want that application to show in the widgets list, i.e on long press on the idle home screen it pops up a spinner for us , you can see it in the below figure,
in that you can see item called widgets which list some set of the applications, even you can see that in the next diagram.. My requirement is that i want my application to be listed there rather showing the general applications list.
thanks
datta
You need to create a widget application
see these tutorials
http://www.vogella.de/articles/AndroidWidgets/article.html

How to add widget configuration activity to launcher?

I have a widget with a configuration activity.
Currently the configuration launches when you click on the widget.
I want to add the configuration as an app icon to the launcher.
The problem is that when the configuration launches on click, I get a specific widget id , so each widget instance can have a different configuration.
What will happen if I start the activity from the launcher?
I wont be able to show multiple configurations on the same activity.
Thanks.
What will happen if I start the activity from the launcher? I wont be able to show multiple configurations on the same activity.
Correct. Your choices appear to be:
Display a list of app widgets -- perhaps you have a database table matching up app widget instance ID to some sort of display name
You don't have the activity in the launcher. For example, put a configuration icon in the app widget itself.

Categories

Resources