Creating a Widget only application in Android? - 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.

Related

How can I install an activity with my widget?

I have created a widget, but I'd like to add an activity to be installed in the phone as well, like a configuration screen, what's the best method to accomplish that with a widget? thanks!
I need an activity that I can access anytime without having to re-create to setup an alarm, which is an extra feature in the widget, does it work for my approach?
In addition to setting up your activity to be a configuration activity for the app widget, you can include other <intent-filter> elements as needed in your manifest for other scenarios, such as the standard MAIN/LAUNCHER <intent-filter> to make the activity appear in home screen launchers.
Just beware that these activities are started in different ways, and so you may wish to use getIntent() and examine how your activity was launched to adjust your behavior accordingly.

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.

Android Application Help

Hi I have made a Task Reminder application and it runs. However I am having trouble implementing a widget for said application. This is my application view or main menu.
http://img545.imageshack.us/i/widget1.jpg/
The list you see are just names of tasks that I have saved as a test.
I would like the list to be viewable on the widget and when a user clicks on the widget it takes them to the main application above.
I have read many guides on widgets but I am not sure what to change? I have done the layout and edited the manifest file. It's the widget.java file that I am having trouble with.
Thanks.
Take a look at this android sample : http://developer.android.com/resources/samples/WeatherListWidget/index.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.

show spinner before adding widget 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.

Categories

Resources