Developing Android applications calls for familiarity with a development environment, an SDK, emulators, and the Android platform. Immersing yourself into the various screen sizes, framework intricacies, and dependencies can leave your head spinning. Here are some helpful hints to get you through your day-to-day development experience.
>
>
Helpful Hints for Android App Development
While solving problems with Android is a simple task, you may get to the point in app development where you're not sure what to do. The following list should point you in the right direction when you’re in need of help.
Not sure how to solve a particular problem? Visit the forums at StackOverflow.com and use the Android tag. StackOverflow is an Android platform–recommended destination for developer questions.
The most common tasks have already been done for you. A list of common tasks and instructions on how to do them are provided by the Android developer Web site.
If you’re not sure what a package or class does, place your cursor over the object or class while inside Eclipse to view the documentation pop-up window. If no tool tip exists, you can view the documentation online at Android Developer Reference.
To find all references of a particular object in your class file, select the object and press Ctrl+Shift+G.
To make the stream messages in the DDMS perspective more readable, create a filter that specifically applies to your application logging.
When typing into Eclipse, you sometimes know the name of the destination property, method, or class you’d like to create. However, it does not yet exist. Type the name in the component, Eclipse will inform you that the component cannot be found. Now select it, and press F2. This gives you a small pop-up window that allows you to create through the click of a button.
To quickly navigate around a class file, press Ctrl+O and start typing the name of the member you’re interested in. Select it from the pop-up list and press Enter.
To quickly navigate among the tabs in the Eclipse IDE, press Shift+Page Up or Shift+Page Down.
To quickly run your Android application, press Ctrl+Shift+F11.
>
>
>
Eclipse Keyboard Shortcuts
You’ll most likely spend most of your Android development career in the Eclipse IDE. The following table shows a few keyboard shortcuts that can help you save a lot of time.
Action | Keyboard Shortcut |
---|---|
Create a new file in the current package | Alt+Shift+N |
Organize the import statements | Ctrl+Shift+O |
Navigate to the source definition | F3 |
Rename an object | Alt+Shift+R |
Search through Java files | Ctrl+H |
Open a particular type | Ctrl+Shift+T |
Find declarations | Ctrl+G |
Navigate left | Alt+left-pointing arrow |
Navigate right | Alt+left-pointing arrow |
>
>
>
Common Android Intent Usage
You’ll use a few basic intents most of the time while developing mobile apps for Androids. The following table shows you the code for several basic Android intents.
Intent | Code |
---|---|
Start an activity | startActivity(new Intent(this, Destination.class)); |
Create a chooser | Intent.createChooser(yourIntent, "Please Select"); |
Open the Web browser | Intent i = newclass="code"> Intent(Intent.ACTION_VIEW,class="code"> Uri.parse("http://example.org")); startActivity(i); |
Start activity for a result | startActivityForResult(yourIntent, YOUR_REQUEST_CODE); |
>
>
>
Developing Applications for Multiple Screen Sizes in Android
One of the challenges that you will encounter during your time as an Android app developer is developing for multiple screen sizes. There are many things to keep in mind during your adventure into screen sizes. The following list below should help keep you on track.
The size requirements for each icon in each density vary for each type of icon. You find launcher icons, menu icons, status bar icons, tab icons, and many more. They are all built differently for each screen density. When building these icons, reference the Android Icon Design Guidelines.
Try to always use the density-independent pixel (dip) measurement unit when defining your user interface. This helps your application scale to different devices. The density-independent pixel is a virtual pixel that scales proportionally for each given screen density.
Provide the supports-screens element to the AndroidManifest.xml file to help the Android market determine whether your application is compatible with various screen sizes.
Provide graphics for high-, medium-, and low-density devices. While this may increase your development and design time, it will greatly improve the usability and appearance of your application.
>
>
dummies
Source:http://www.dummies.com/how-to/content/android-application-development-for-dummies-cheat-.html
No comments:
Post a Comment