Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project Structure and Basics of User Interface in an Android studio #8614

Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

## **Types of permissions**

Android categorizes permissions into different types, including install-time permissions, runtime permissions, and special permissions. Each permission's type indicates the scope of restricted data that your app can access, and the scope of restricted actions that your app can perform, when the system grants your app that permission.


### **Install-time permissions**

Install-time permissions give your app limited access to restricted data, and they allow your app to perform restricted actions that minimally affect the system or other apps. When you declare install-time permissions in your app, the system automatically grants your app the permissions when the user installs your app. An app store presents an install-time permission notice to the user when they view an app's details page, as shown in Figure 2.

Android includes several sub-types of install-time permissions, including normal permissions and signature permissions.


#### **Normal permissions**

These permissions allow access to data and actions that extend beyond your app's sandbox. However, the data and actions present very little risk to the user's privacy, and the operation of other apps.

The system assigns the "normal" protection level to normal permissions, as shown on the permissions API reference page.


#### **Signature permissions**

If the app declares a signature permission that another app has defined, and if the two apps are signed by the same certificate, then the system grants the permission to the first app at install time. Otherwise, that first app cannot be granted the permission.

**Note:** Some signature permissions aren't for use by third-party apps.

The system assigns the "signature" protection level to signature permissions, as shown on the permissions API reference page.


### **Runtime permissions**

Runtime permissions, also known as dangerous permissions, give your app additional access to restricted data, and they allow your app to perform restricted actions that more substantially affect the system and other apps. Therefore, you need to request runtime permissions in your app before you can access the restricted data or perform restricted actions. When your app requests a runtime permission, the system presents a runtime permission prompt, as shown in Figure 3.

Many runtime permissions access _private user data_, a special type of restricted data that includes potentially sensitive information. Examples of private user data include location and contact information.

The microphone and camera provide access to particularly sensitive information. Therefore, the system helps you explain why your app accesses this information.

The system assigns the "dangerous" protection level to runtime permissions, as shown on the permissions API reference page.


### **Special permissions**

Special permissions correspond to particular app operations. Only the platform and OEMs can define special permissions. Additionally, the platform and OEMs usually define special permissions when they want to protect access to particularly powerful actions, such as drawing over other apps.

The **Special app access** page in system settings contains a set of user-toggleable operations. Many of these operations are implemented as special permissions.

Each special permission has its own implementation details. The instructions for using each special permission appear on the permissions API reference page. The system assigns the "appop" protection level to special permissions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@


### **Profile Application Performance**

An app is considered to have poor performance if it responds slowly, shows choppy animations, freezes, or consumes too much power. Fixing performance problems involves identifying areas in which your app makes inefficient use of resources such as the CPU, memory, graphics, network, and the device battery. To find and fix these problems, use the profiling and benchmarking tools and techniques described in this topic.

Android Studio offers several profiling tools to help find and visualize potential problems:



* **CPU profiler**: This tool helps track down runtime performance issues.
* **Memory profiler**: This tool helps track memory allocations.
* **Network profiler**: This tool monitors network traffic usage.
* **Energy profiler**: This tool tracks energy usage, which can contribute to battery drain.

See the Android Studio Profilers page for information about using those tools.

The Jetpack Benchmark libraries allow your application to measure various important operations:



* **Microbenchmark**: Measure important performance use cases, including application startup and redrawing that is triggered by actions such as UI animations or scrolling.
* **Benchmark**: Measure CPU cost of specific functions.

See the Benchmark your app page to learn more about these libraries.

There are many potential causes of performance problems, so it can be difficult to know where to start if you are new to performance analysis. See Measuring performance to learn techniques for measuring performance, along with examples of how to use these techniques to resolve specific problems.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@


## **Project structure**

Each project in Android Studio contains one or more modules with source code files and resource files. Types of modules include:



* Android app modules
* Library modules
* Google App Engine modules

By default, Android Studio displays your project files in the Android project view, as shown in figure 1. This view is organized by modules to provide quick access to your project's key source files.

All the build files are visible at the top level under **Gradle Scripts** and each app module contains the following folders:



* **manifests**: Contains the AndroidManifest.xml file.
* **java**: Contains the Java source code files, including JUnit test code.
* **res**: Contains all non-code resources, such as XML layouts, UI strings, and bitmap images.

The Android project structure on disk differs from this flattened representation. To see the actual file structure of the project, select **Project** from the **Project** dropdown (in figure 1, it's showing as **Android**).

You can also customize the view of the project files to focus on specific aspects of your app development. For example, selecting the **Problems** view of your project displays links to the source files containing any recognized coding and syntax errors, such as a missing XML element closing tag in a layout file.


## **The Basics of user interface**



1. The **toolbar** lets you carry out a wide range of actions, including running your app and launching Android tools.
2. The **navigation bar** helps you navigate through your project and open files for editing. It provides a more compact view of the structure visible in the **Project** window.
3. The **editor window** is where you create and modify code. Depending on the current file type, the editor can change. For example, when viewing a layout file, the editor displays the Layout Editor.
4. The **tool window bar** runs around the outside of the IDE window and contains the buttons that allow you to expand or collapse individual tool windows.
5. The **tool windows** give you access to specific tasks like project management, search, version control, and more. You can expand them and collapse them.
6. The **status bar** displays the status of your project and the IDE itself, as well as any warnings or messages.

You can organize the main window to give yourself more screen space by hiding or moving toolbars and tool windows. You can also use keyboard shortcuts to access most IDE features.

At any time, you can search across your source code, databases, actions, elements of the user interface, and so on, by double-pressing the Shift key, or clicking the magnifying glass in the upper right-hand corner of the Android Studio window. This can be very useful if, for example, you are trying to locate a particular IDE action that you have forgotten how to trigger.
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@

**Publishing an android application**

Publishing is the general process that makes your Android applications available to users. When you publish an Android application you perform two main tasks:



* You prepare the application for release. \
During the preparation step you build a release version of your application, which users can download and install on their Android-powered devices.
* You release the application to users. \
During the release step you publicize, sell, and distribute the release version of your application to users.


## **Preparing app for release**

Preparing your application for release is a multi-step process that involves the following tasks:



* Configuring your application for release. \
At a minimum you need to remove Log calls and remove the android:debuggable attribute from your manifest file. You should also provide values for the android:versionCode and android:versionName attributes, which are located in the <manifest> element. You may also have to configure several other settings to meet Google Play requirements or accommodate whatever method you're using to release your application. \
If you are using Gradle build files, you can use the _release_ build type to set your build settings for the published version of your app.
* Building and signing a release version of your application. \
You can use the Gradle build files with the _release_ build type to build and sign a release version of your application. See Building and Running from Android Studio.
* Testing the release version of your application. \
Before you distribute your application, you should thoroughly test the release version on at least one target handset device and one target tablet device.
* Updating application resources for release. \
You need to be sure that all application resources such as multimedia files and graphics are updated and included with your application or staged on the proper production servers.
* Preparing remote servers and services that your application depends on. \
If your application depends on external servers or services, you need to be sure they are secure and production ready.

You may have to perform several other tasks as part of the preparation process. For example, you will need to get a private key for signing your application. You will also need to create an icon for your application, and you may want to prepare an End User License Agreement (EULA) to protect your person, organization, and intellectual property.

When you are finished preparing your application for release you will have a signed .apk file that you can distribute to users.

To learn how to prepare your application for release, see Preparing for Release in the Dev Guide. This topic provides step-by-step instructions for configuring and building a release version of your application.


## **Releasing an android application to users**

You can release your Android applications several ways. Usually, you release applications through an application marketplace such as Google Play, but you can also release applications on your own website or by sending an application directly to a user.


### **Releasing through an app marketplace**

If you want to distribute your apps to the broadest possible audience, releasing through an app marketplace such as Google Play is ideal.

Google Play is the premier marketplace for Android apps and is particularly useful if you want to distribute your applications to a large global audience. However, you can distribute your apps through any app marketplace you want or you can use multiple marketplaces.


#### **Releasing your apps on Google Play**

Google Play is a robust publishing platform that helps you publicize, sell, and distribute your Android applications to users around the world. When you release your applications through Google Play you have access to a suite of developer tools that let you analyze your sales, identify market trends, and control who your applications are being distributed to. You also have access to several revenue-enhancing features such as in-app billing and application licensing. The rich array of tools and features, coupled with numerous end-user community features, makes Google Play the premier marketplace for selling and buying Android applications.

Releasing your application on Google Play is a simple process that involves three basic steps:



* Preparing promotional materials. \
To fully leverage the marketing and publicity capabilities of Google Play, you need to create promotional materials for your application, such as screenshots, videos, graphics, and promotional text.
* Configuring options and uploading assets. \
Google Play lets you target your application to a worldwide pool of users and devices. By configuring various Google Play settings, you can choose the countries you want to reach, the listing languages you want to use, and the price you want to charge in each country. You can also configure listing details such as the application type, category, and content rating. When you are done configuring options you can upload your promotional materials and your application as a draft (unpublished) application.
* Publishing the release version of your application. \
If you are satisfied that your publishing settings are correctly configured and your uploaded application is ready to be released to the public, you can simply click **Publish** in the Play Console and within minutes your application will be live and available for download around the world.
66 changes: 66 additions & 0 deletions Android_Development_With_Java/1 Introduction/shortcut keys.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
| **Description** | **Windows/Linux** | **Mac** |
| --- | --- | --- |
| **General** |
| Save all | Control+S | Command+S |
| Synchronize | Control+Alt+Y | Command+Option+Y |
| Maximize/minimize editor | Control+Shift+F12 | Control+Command+F12 |
| Add to favorites | Alt+Shift+F | Option+Shift+F |
| Inspect current file with current profile | Alt+Shift+I | Option+Shift+I |
| Quick switch scheme | Control+` (backquote) | Control+` (backquote) |
| Open settings dialogue | Control+Alt+S | Command+, (comma) |
| Open project structure dialog | Control+Alt+Shift+S | Command+; (semicolon) |
| Switch between tabs and tool window | Control+Tab | Control+Tab |
| **Navigating and searching within Studio** |
| Search everything (including code and menus) | Press Shift twice | Press Shift twice |
| Find | Control+F | Command+F |
| Find next | F3 | Command+G |
| Find previous | Shift+F3 | Command+Shift+G |
| Replace | Control+R | Command+R |
| Find action | Control+Shift+A | Command+Shift+A |
| Search by symbol name | Control+Alt+Shift+N | Command+Option+O |
| Find class | Control+N | Command+O |
| Find file (instead of class) | Control+Shift+N | Command+Shift+O |
| Find in path | Control+Shift+F | Command+Shift+F |
| Open file structure pop-up | Control+F12 | Command+F12 |
| Navigate between open editor tabs | Alt+Right Arrow or Left Arrow | Control+Right Arrow or Control+Left Arrow |
| Jump to source | F4 or Control+Enter | F4 or Command+Down Arrow |
| Open current editor tab in new window | Shift+F4 | Shift+F4 |
| Recently opened files pop-up | Control+E | Command+E |
| Recently edited files pop-up | Control+Shift+E | Command+Shift+E |
| Go to last edit location | Control+Shift+Backspace | Command+Shift+Delete |
| Close active editor tab | Control+F4 | Command+W |
| Return to editor window from a tool window | Esc | Esc |
| Hide active or last active tool window | Shift+Esc | Shift+Esc |
| Go to line | Control+G | Command+L |
| Open type hierarchy | Control+H | Control+H |
| Open method hierarchy | Control+Shift+H | Command+Shift+H |
| Open call hierarchy | Control+Alt+H | Control+Option+H |
| **Viewing layouts** |
| Zoom in/out | Control+plus or Control+minus | Command+plus or Command+minus |
| Fit to screen | Control+0 | Command+0 |
| Actual size | Control+Shift+1 | Command+Shift+1 |
| **Design tools: Layout Editor** |
| Toggle between Design and Blueprint modes | B | B |
| Toggle between Portrait and Landscape modes | O | O |
| Toggle devices | D | D |
| Force refresh | R | R |
| Toggle render errors panel | E | E |
| Delete constraints | Delete or Control+click | Delete or Command+click |
| Zoom in | Control+plus | Command+plus |
| Zoom out | Control+minus | Command+minus |
| Zoom to fit | Control+0 | Command+0 |
| Pan | Hold Space+click and drag | Hold Space+click and drag |
| Go to XML | Control+B | Command+B |
| Select all components | Control+A | Command+A |
| Select multiple components | Shift+click or Control+click | Shift+click or Command+click |
| **Design tools: Navigation Editor** |
| Zoom in | Control+plus | Command+plus |
| Zoom out | Control+minus | Command+minus |
| Zoom to fit | Control+0 | Command+0 |
| Pan | Hold Space+click and drag | Hold Space+click and drag |
| Go to XML | Control+B | Command+B |
| Toggle render errors panel | E | E |
| Group into nested graph | Control+G | Command+G |
| Cycle through destinations | Tab or Shift+Tab | Tab or Shift+Tab |
| Select all destinations | Control+A | Command+A |
| Select multiple destinations | Shift+click or Control+click | Shift+click or Command+click |
Loading