0

I have an App Shortcut (See:App shortcuts overview ) that calls an activity that immidietly calls finish() (after changing a small thing in the shareprefs).

so when I click on the shortcut - everything works, but the shortcut menu remains open. [The user doesn't notice the activity opening and closing and stays on the homescreen - with the shortcuts menu still open]

can I force close/force refresh it somehow?

[this gets annoying since I want to dynamically change the text of the shortvcut but this doesnt change unless i close this menu and re opens it]

Wops
  • 983
  • 9
  • 23
  • 1
    which menu u r talking about ? please provide a bit more information about your question its totally vague what i can make out of it is your navigation bar has got something to to do with shared prefs and as when the value change the effect must take place in the manu also if thats the case make an interface which listenes to the change in the shared prefs values – Harkal Nov 01 '18 at 10:55
  • I'm sorry @HarKal, please see my edit. – Wops Nov 01 '18 at 11:02

1 Answers1

1

well this is not the perfect answer but this will suffice the purpose

instead of calling :

finish();

call this code after you change your shared preferences :

Intent goToHomeIntent = new Intent(Intent.ACTION_MAIN);
goToHomeIntent.addCategory(Intent.CATEGORY_HOME);
goToHomeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(goToHomeIntent);

what this does is that it takes the user to home screen of device

hope it helps happy coding :)

Harkal
  • 1,770
  • 12
  • 28