Note that there are some explanatory texts on larger screens.

plurals
  1. POget shortcut intent info from android applications
    primarykey
    data
    text
    <p>when the user clicks a button he gets the list of apps that support shortcuts with this code.</p> <pre><code>Intent j; j = new Intent(Intent.ACTION_PICK_ACTIVITY); j.putExtra(Intent.EXTRA_INTENT, new Intent(Intent.ACTION_CREATE_SHORTCUT)); j.putExtra(Intent.EXTRA_TITLE, "Create a Shortcut"); startActivityForResult(j, choose_app_for_shortcut); </code></pre> <p>after he chooses the app, I show the user the list of the shortcuts this app supports with this code in the onActivityResul() method</p> <pre><code>onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if(resultCode == Activity.RESULT_OK &amp;&amp; data != null) { switch(requestCode){ case: choose_app_for_shortcut Intent i = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT); startActivityForResult(data, pick_shortcut_from_app); break; case pick_shortcut_from_app: ? ? } } </code></pre> <p>the question is: what code do i need in: ( <code>case: pick_shortcut_from_app</code> ) to get the info i need to run this shortcut? the end goal is to have this information stored in a file so that the app remembers the choice and it can launch the shortcut intent after the app closes. i tried a few things but it led to the app crashing so your help would be greatly appreciated!</p> <p>i went one step further using this code</p> <pre><code> String uri = data.toURI().toString(); try { startActivity(Intent.getIntent(uri)); } catch (URISyntaxException e) { e.printStackTrace(); } </code></pre> <p>but i get i weird message asking me what app i want to use to complete this action. and the app from which the shortcut comes is not in the list!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload