Chapter2 Package name:This is the unique identifier of your application,usually in the com company name.app n me or reverse company domain.app name with other applic tpackage elds Is propose an tion name You can change the package name by clicking Project location:This is the directory in your system in which the project is saved. Complete the information for your project and click on the Next button.This will take you to the the minimum erent devices Selecting the form factors of the Beca nded to differe nd de ent types vices,you may norare s follows Phone and Tablet:These are standard Android platforms used to create an application for phones and/or tablets vision sets Wear:This is an Android Wear platform used to design applications for wearable devices such as smart watches gle Glas used to design applications for e To include any of thes need to have the stalled ir plained in Chapter 6,Tools Once you'vedecided ony m SDK supported by yo lication De SDK will not he ahle to mh品e then you can select an older application programming interface(APD).The latest by Go le about plat ect A rises to s by a1 aiabeafnthe rds/index.html. [15]
Chapter 2 [ 15 ] • Package name: This is the unique identifier of your application, usually in the com.company_name.app_name or reverse_company_domain.app_name form. This form reduces the risk of name conflicts with other applications. A default package name is proposed based on the Company Domain and Application name fields. You can change the package name by clicking on Edit. • Project location: This is the directory in your system in which the project is saved. Complete the information for your project and click on the Next button. This will take you to the second screen. This screen allows you to select your platform and the minimum SDK your project will support on different devices. Selecting the form factors Because of the way Android has expanded to different types of devices, you may want to select one or more kinds of platforms and devices to be included in your project. For each type of device, you can select a different minimum SDK. The devices Android supports are as follows: • Phone and Tablet: These are standard Android platforms used to create an application for phones and/or tablets • TV: This is an Android TV platform used to design applications for big screens, such as those of television sets • Wear: This is an Android Wear platform used to design applications for wearable devices such as smart watches • Glass: This is an Android Glass platform used to design applications for Google Glass devices To include any of these platforms in your project, you need to have them installed in your system. A tool known as Android SDK Manager has to be used to install a new platform. The Android SDK Manager tool will be explained in Chapter 6, Tools. Once you've decided on your devices, you can choose the minimum SDK supported by your application. Devices with an older SDK will not be able to install your application. Try to reach a balance between supported devices and available features. If your application does not require a specific feature published in the newest SDKs, then you can select an older application programming interface (API). The latest dashboards published by Google about platform distribution show that 99.5 percent of devices use Android 2.3 or later versions. If you select Android 2.2, then the percentage rises to 100 percent. You can check out these values by clicking on the Help me choose link. The official Android dashboards are also available at http:// developer.android.com/about/dashboards/index.html
Starting a Project Check the Phone and Tablet option and select API 15 as the minimum SDK.After that,click on Next.This will take you to the next screen,where you can select the activity type. Choosing the activity type Activities are the ociated with the screens with which users interact in an applic a on multiple activ an applicatio e main a sdisplayed.Th ls. app ity. Several types of activities that can be selected are as follows an action bar.The action on ba rovid following screenshot shows Blank Activity: /act ntml.The ■w Blank Activity .Blank Activity with Fragment This creates a blank activity with an action bar and a contained fragment.A fragment is a portion of the user intertace in an in multiple activities,and multiple fragments can be coml in a single activity.You can find out more about fragments 【161
Starting a Project [ 16 ] Check the Phone and Tablet option and select API 15 as the minimum SDK. After that, click on Next. This will take you to the next screen, where you can select the activity type. Choosing the activity type Activities are the components associated with the screens with which users interact in an application. Android applications are usually based on multiple activities. When an application is launched, the activity indicated as the main activity is displayed. The third screen allows you to create the main activity of your application. You can also complete the creation of a new project without adding an activity. Several types of activities that can be selected are as follows: • Blank Activity: This creates a blank activity with an action bar. The action bar includes a title and an options menu. Action bars can provide navigation modes and user actions. You can read more about action bars at http:// developer.android.com/guide/topics/ui/actionbar.html. The following screenshot shows Blank Activity: • Blank Activity with Fragment: This creates a blank activity with an action bar and a contained fragment. A fragment is a portion of the user interface in an activity. Fragments can be reused in multiple activities, and multiple fragments can be combined in a single activity. You can find out more about fragments at https://developer.android.com/guide/components/fragments.html. Here is a screenshot showing Blank Activity with Fragment:
Chapter2 ■ Blank Activity with Fragment Full ity. This tem nplate hid en view wn in the following ■ Google Maps Activity:This template creates a new activity with a Google map.It is shown in the next screenshot: Google Maps Activity 【171 www.allitebooks.com
Chapter 2 [ 17 ] • Fullscreen Activity: This template hides the system user interface (such as the notification bar) in a fullscreen view. By default, the fullscreen mode is alternated with an action bar that shows up when the user touches the device screen. Fullscreen Activity is shown in the following screenshot: • Google Maps Activity: This template creates a new activity with a Google map. It is shown in the next screenshot: www.allitebooks.com
Starting a Project .Google Play Services Activity:This template creates a new activity connected to the Google Play Services client.It is shown in the following screenshot: Google Play Services Activity (■w Login Activity 【18]
Starting a Project [ 18 ] • Google Play Services Activity: This template creates a new activity connected to the Google Play Services client. It is shown in the following screenshot: • Login activity: This template creates a view as a login screen, allowing the users to log in or register with an e-mail and a password
Chapter2 mend screen,both s Master/Detall Flow a nav plays the main na options in a panel that is brought onto the screen from a left-hand side panel. You can read more about navigation drawers at https://developer. android.com/design/patterns/navigation-drawer.html. ■ Navigation Drawer Activity [19]
Chapter 2 [ 19 ] • Master/Detail Flow: This template splits the screen into two sections: a left-hand-side menu and the details of the selected item on the right-hand side. On a smaller screen, just one section is displayed, but on a bigger screen, both sections are displayed at the same time. • Navigation Drawer Activity: This template creates a new activity with a navigation drawer. A navigation drawer displays the main navigation options in a panel that is brought onto the screen from a left-hand side panel. You can read more about navigation drawers at https://developer. android.com/design/patterns/navigation-drawer.html