2

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?

Dharmaraj
  • 47,845
  • 8
  • 52
  • 84
Deep Chhowala
  • 99
  • 2
  • 11
  • Please check [here](https://stackoverflow.com/a/15249542/13130697). Similar question has been already answered – Dharmaraj Apr 05 '20 at 06:50
  • @Dharmaraj I saw this, but it seems that this would launch some activity, I don't want any activity to be launched. The action must be performed directly. – Deep Chhowala Apr 05 '20 at 07:06
  • So you want the activity to stay as it is when you click the button but change the icon right? – Dharmaraj Apr 05 '20 at 07:07
  • umm no, I have edited the question, added example. That will make my question more clear. If you could please read that. – Deep Chhowala Apr 05 '20 at 07:09
  • You want a single app to have 2 icons right? Like [this?](https://imgur.com/RRHptcA) here playstore itself has 2 icons for different tasks? similar? – Dharmaraj Apr 05 '20 at 07:15
  • Please check this link https://stackoverflow.com/questions/6337431/android-create-shortcuts-on-the-home-screen Similar question has been already answered – Arunachalam k Apr 05 '20 at 07:16
  • No, I had a look at short cuts, it wont help. – Deep Chhowala Apr 05 '20 at 09:58

0 Answers0