2 icons required for one application - android

I am creating an application that needs two icons. (Is this possible?)
The main icon that is created by default, will launch the application. In this application, there is a "Enable/Disable" button (toggle button).
When this button is on enable, a 2nd icon (shortcut button to do another task) must be made visible on home screen.
And i want to code a onClickListener() on the new shortcut icon. i.e. When this new shortcut icon is clicked, without launching any activity, that particular action must be performed.
i.e. The app should not open but perform its assigned task.
Example: Activity A has a toggle button: if this button is enabled, a shortcut icon is created on homescreen. When this shortcut icon is clicked, the wallpaper of phone changes without any activity being launched.
How to change wallpaper randomly without opening any activity.
Any views about how this can be achieved?

Related

How to toggle between default home launcher and my application using only buttons?

I am wondering if it is possible to set the home launcher with buttons instead of manually doing it through settings.
Example there is two buttons(Home and MyApp), clicking on home will bring me back to the default home screen and clicking on MyApp will bring me to my application home screen. I am running on Kitkat 4.4.2.
You can't, because the device will always show the chooser dialog, do you want to use bla or blabla once only or always.

Home button in android

I am developing an app
and I need to disable the home button or change his behavior on clicking a button
how can I do it?
I have already tried to use the onKeyDown event and other events
You cannot block the Home button from sending intent android.intent.category.HOME which switches to the launcher but you can set your window to be always on top so the launcher won't be shown.

Assign custom action to Android Menu button, prevent default action at the same time

I have a main menu in my app that allows the user to do a set of specific tasks. On the app, I have a menu button akin to what Facebook have (three horizontal bars as a button). I'd like it to open when the physical Menu button on the Android phone was pressed.
Can this be done?

how to handle activities configuration change

what i need is i have 3 activities i have navigated from 1 to 2 and from 2 to 3. now at i am at third screen and now if i press home button all the activities will be paused and application goes into background. and when i open the app by long press on home buttton passcode screen will appear and when entered pas code now i need to get 3rd activity screen from where i pressed home button. How can i do this. how could i do this
i referred Saving Android Activity state using Save Instance State this link

Undo "Default Home Sceen" as my default home screen

In my app I am trying to override the default home screen. For that purpose, I have created an activity of category "HOME". When the app launches, it is prompting the user to select the App(Showing my app and default Launcher) to complete the action. If I select "Launcher" ( Default Home screen), then there is no way to choose my app as default home screen.
Can somebody tell me if there a way to undo the "Default Home Screen" as my default launcher for Home activity?
Thanks,
Praveen
clearPackagePreferredActivities() on PackageManager should allow you to do this programmatically, for your own app.

Categories

Resources