How to build an Android home screen widget? - android

So I'm looking to build a widget that sits on the homescreen and take up as much of the screen as is possible for a widget to get the most screen space. I have experience building normal apps and already starting building this app as a non-widget. How difficult would it be for me to either re-build or change it into a widget?
Would I be able to use the same basic code from my original app with modifications so that it could function as a widget on the home screen?

Related

Android home screen widget - how to add option to launch apps from the widget

I have a nicely working widget.
I have an idea to add an option for the users to launch any (previously installed) app from the widget by pressing the dedicated button. So I want users to be able to choose 1-2 apps from their installed apps in the widget configuration part and be able to launch them from the widget.
Is there any way to add this functionality without declaring this widget a launcher?
If yes, could I get any hints, maybe some tuts, please?
I really appreciate any help you can provide.
Adam

Create Android Widget inside App

I'd like to link to my app widget configuration activity from inside my app. I know it's possible to launch the Android widget picker but can I bypass that step and let my users create a widget on their home screen from inside my app?
can I bypass that step and let my users create a widget on their home screen from inside my app?
No. For example, the user's home screen may not support app widgets (Android TV, Chrome OS, specialty home screen implementations, etc.).

Transparent activity that really clear other Activities

I have a small android machine that has android and other native process at same time.
Because the graphic of native is below, android app should be transparent.
I read many sources, made transparent activity and it works.
But it is special app for my machine, thus it should act like Launcher.
The thing is... if I back to my app after launch another app, the screen still shows another app's image.
Ex: My app(Home) - Other non-transparent app - (back/home) - My app shows previous other app's image, because my app is transparent.
So I want to make my app to clear all screens and be transparent to show native's graphic. I don't mean finish others. I want to clear or turn off visibility of other apps only.
FYI, I can't wrap the native to android app with JNI. The native process is old and big legacy. :(
Thanks in advance.
Have a look at FLAG_SHOW_WALLPAPER. Setting that to your activity will make it seem like all other apps were closed/hidden:
http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_SHOW_WALLPAPER

Customised Android Home Screen with default Widget

I have customised the home screen sample application which was there in Android SDK samples, and now trying to add a clock widget there.This home screen sample doesn't have any option in the menus to add widgets.
And my objective is to just a Digital Clock and Whether in the Home screen.
So can you pls suggest me about how to proceed ?
Use a different home screen as the basis for your research. The Launcher2 home screen is in the Android open source project, and there may be third-party home screen implementations that are open source as well. You will be looking for classes like AppWidgetHost and AppWidgetHostView.

Spawn Android desktop widget from an application

I have an Android application does many things. I would like to be able have it spawn a desktop widget (?) that opens the application to do a specific thing when the widget is clicked.
Can someone give me a road map on how to do this?
As far as i know, Android applications can not add App Widgets to the home screen. Applications can define App Widgets, but user has to add them manually to the home screen.
However it is not hard to launch Activitys from a widget using PendingIntent.
This is called AppWidget and is described in details in Android documentation (both references and step-by-step guide). Note, that it's the user that adds the widget to his launcher screen. AFAIK there's no way to add it to launcher in code (though HTC might have some undocumented ways).

Categories

Resources