- How to Create Your Own Shortcut in Android Studio?
- Approach
- Add Keyboard Shortcut:
- Add Mouse Shortcut:
- Add Abbreviation:
- How to Create a Shortcut on Android
- Add a shortcut to any app or website on your home screen
- What to Know
- How Do I Put an Icon on My Home Screen?
- How Do I Create a Shortcut for an App Function?
- How Do I Create a Shortcut to a Website on Android?
- How Do I Create a Shortcut to My Android Home Screen?
- How Do I Delete Shortcuts on Android?
- Create shortcuts.xml
- Overview
- Static shortcuts
- Schema
- Capability schema
- App shortcuts overview
- Shortcut types
- Display shortcuts in assistants using capabilities
- Shortcut limitations
How to Create Your Own Shortcut in Android Studio?
Android Studio is the official integrated development environment for Google’s Android operating system, built on JetBrains’ IntelliJ IDEA software and designed specifically for Android app development . Android Studio offers a lot of shortcuts to users. It also provides to configure Keymap and add your own shortcuts. So in this article let’s create our own shortcut and use them to easily navigate throughout the Android Studio.
Approach
On Windows, go to File -> Settings, on Mac: Android Studio -> Preferences and navigate to the Keymap pane. It opens with the shortcuts for different categories that you want to make or are already there in Android Studio.
On expanding editor actions, and right-clicking on the desired Keymap, we can add shortcuts in three ways.
Add Keyboard Shortcut:
Making the Keyboard shortcut feature also gives the choice that whether or not we are overriding the previously set shortcuts.
One can anytime change/remove the shortcut too. For example, the custom shortcut Shift+ A which we set for Move Caret Backward a Paragraph can be removed.
Remove the shortcut by right click and Remove Shift+A.
Add mouse shortcut and add abbreviations are similar to add the Keyboard shortcut.
Add Mouse Shortcut:
This option asks to create shortcuts by creating shortcuts mouse operations or with Ctrl, Tab, Shift, etc. like done in the following image.
Add Abbreviation:
Adding the Abbreviation feature lets you search for an action when you do “Search Everywhere“(double shift). Here’s the added abbreviation to Move Caret Backward a Paragraph.
Источник
How to Create a Shortcut on Android
Add a shortcut to any app or website on your home screen
What to Know
- To add an Android app’s icon to your Home screen, long-press its icon and select Add to home.
- Long-press an app icon then long-press a function’s name and drag it to your Home screen to create an app function shortcut.
- To make a website shortcut on Android, open the site in Chrome, tap the ellipsis, and select Add to Home screen.
This guide will explain all of the steps for adding an app icon to an Android tablet or smartphone’s Home screen, how to make a shortcut to a website, and what to do to make a shortcut to an Android app function.
How Do I Put an Icon on My Home Screen?
You can add a shortcut for any app to your Android Home screen as long as you have the app installed. Here’s how to do it.
Open the list of all of your apps.
This can usually be done by tapping the icon that looks like a white circle with six blue dots in it.
Find the app you want to create a shortcut for and long-press on its icon.
Tap Add to home.
The app’s icon should then appear in the top-right corner of your Home screen on your Android tablet or smartphone. Long-press the app icon and drag it to where you want it to be.
How Do I Create a Shortcut for an App Function?
Some Android apps support functions which can be accessed by performing a long-press on their app icon. These functions can be pinned to your Android home screen as a separate icon to act as a shortcut to that specific task.
Perform a long-press on the app whose function you want to create a shortcut for.
A menu of available app functions should appear. Long-press the function you want to create a shortcut for and drag it onto your Home screen.
Move the shortcut icon to its desired position and release your finger. The icon will now work as a shortcut which will open the Android app and immediately activate that one specific function.
How Do I Create a Shortcut to a Website on Android?
Much like how you can create shortcuts for apps and app functions on Android tablets and mobiles, you can also add shortcuts to websites to your device’s Home screen.
For this example, we’ll use the Google Chrome app which comes pre-installed on most Android devices. You can also create website shortcuts with some other Android web browser apps which use similar steps though the phrasing may be slightly different.
Here’s how to pin a shortcut to a website onto your Android Home screen.
Open the Google Chrome web browser and navigate to the website you want to pin to your Home screen.
Tap the ellipsis icon in the top-right corner.
From the menu, tap Add to Home screen.
Enter a custom name for the website.
This name will be the word or words which will appear under the shortcut on your Home screen (shorter is better).
Tap Add.
Tap Add Automatically for the shortcut to be added to the top-left of your Home screen. Alternatively, you can long-press the icon and place the website shortcut icon manually.
Whichever option you choose, you can manually move the shortcut icon afterwards to wherever you like.
How Do I Create a Shortcut to My Android Home Screen?
There’s no need to create a shortcut to your Home screen as all Android devices have built-in ways to return to your Home screen no matter what app you’re using or which video you’re watching.
» data-caption=»» data-expand=»300″ data-tracking-container=»true»/>
To return to your Home screen, tap the Home button. Depending on your Android smartphone or tablet model, it may look like a circle or a horizontal line. It’s always located under the screen.
Alternatively, some Android smartphones allow you to return to your Home screen by swiping up from the bottom of the screen.
How Do I Delete Shortcuts on Android?
To delete a shortcut from your Android Home screen, long-press its icon and tap Remove from the popup menu.
This process will just delete the icon for the shortcut. To delete the app from your Android smartphone or tablet, tap Uninstall from the same menu.
In the My Files app, go to the Downloads folder and select the file. Then, tap the three dots in the upper-right corner and choose Add shortcut from the drop-down menu.
You can add contact shortcuts as Android widgets. In the Widget menu, choose Contacts to add a contact to your home screen.
Android comes with many built-in shortcuts for making calls, taking photos, sending texts, and more. Many Android devices also allow you to control your phone using gestures.
In the app drawer, tap the three dots in the upper-right corner and select Hide Apps to view your hidden Android apps. If you don’t see the Hide apps option, you have no hidden apps.
Источник
Create shortcuts.xml
Beta: This page describes App Actions functionality you can add to your app today using the Android Shortcuts framework. This framework integration is in the Beta release stage. If you are maintaining a production implementation of App Actions, refer to the Actions.xml documentation.
Once you identify your in-app functionality and corresponding built-in intent (BII) to implement, declare the BIIs your functionality supports by defining a capability element in a shortcuts.xml resource file. Declaring a BII as a capability registers support for that semantic intent in your app, and enables voice query fulfillment of the intent using Google Assistant.
Assistant uses natural language processing to extract parameters from a user query. The built-in intents reference lists the fields that each BII is capable of extracting from an associated user query. For example, if a user invokes the actions.intent.ORDER_MENU_ITEM capability in your app by saying, «Hey Google, order a pizza from ExampleCafe in ExampleApp», Assistant extracts the following BII parameters from the user request:
- menuItem.name = «pizza»
- menuItem.inMenuSection.inMenu.forRestaurant.name = «ExampleCafe»
Assistant passes BII parameters to the fulfillment intent defined in the capability . One or more intent elements can be defined in a capability to accommodate the different ways a user might invoke a BII. For instance, you could define a fulfillment intent that requires both BII parameters in the above example. You could then define a second intent that requires a single BII parameter, menuItem.name , that displays nearby restaurant options if a user makes a simpler request, like «Hey Google, order a pizza on ExampleApp.»
Overview
You configure App Actions using a shortcuts.xml file placed in your app project’s res/xml directory, and then creating a reference to shortcuts.xml in your app manifest. Add a reference to shortcuts.xml in your app manifest by following these steps:
In your app’s manifest file ( AndroidManifest.xml ), find an activity whose intent filters are set to the android.intent.action.MAIN action and the android.intent.category.LAUNCHER category.
Add a reference to shortcuts.xml in AndroidManifest.xml using a tag in the Activity that has intent filters for both MAIN and LAUNCHER , as follows:
The above example declares an XML resource for the xml/shortcuts.xml file in the APK. For more details on configuring shortcuts, see Create static shortcuts in the Android developer documentation.
The Jetpack library androidx.core:core:1.6.0 (or greater) is required in your Android project to avoid compilation errors when defining App Actions capabilities in shortcuts.xml . For details, see Getting started with Android Jetpack.
Static shortcuts
When defining your capability , you can declare static shortcut elements in shortcuts.xml to extend the functionality of the capability. Static shortcuts are ingested by Assistant when you upload a release to Google Play Console. Since static shortcuts can only be created and updated by creating new releases, they are most useful to highlight common activities and content in your app.
You can enable the following App Actions functionality with static shortcuts:
Capability shortcuts. Create shortcuts that launch an instance of your capability containing predefined intent parameter values. For example, you could declare an app shortcut «Start a run» which invokes the START_EXERCISE BII capability in your fitness app.
These shortcuts contain intent , shortLabel , and longLabel attributes, making them eligible to be suggested and fulfilled as chips in proactive surfaces, such as Assistant or when long-pressing an app icon on Android launchers. An action shortcut can also serve as an entity shortcut, detailed below, by associating it to a capability using a tag.
Entity shortcuts. Entity shortcuts provide a list of supported parameter values for voice query fulfillment of a capability . For example, an entity shortcut with a list of exercise types («hike,» «run,» etc.) bound to the exercise.type BII parameter of the START_EXERCISE capability. If a user utterance matches an entity, the shortcutId ID is passed to the intent instead of the raw user query value.
Entity shortcuts do not define intent , shortLabel , or longLabel attributes, and as such are not suggested on proactive surfaces. For details, see Inline inventory for App Actions.
Schema
Capability schema
The following table describes the App Actions schema for capability elements in shortcuts.xml . When including a tag, all of its attributes are required unless marked «optional».
Shortcuts.xml tag | Contained in | Attributes |
---|---|---|