Android 3 SDK Programming For Dummies

Android is an open source, Linux- and Java-based, software framework for mobile and portable devices. The Android operating system has a well-designed Java-based SDK to make developing apps straightforward and fun. Before you develop Android 3 applications, get to know Eclipse (an integrated development environment for Java developers) and how to do some common tasks such as creating icons and activities.






>


>


Android: Using the Eclipse IDE for Java Development


Nowadays, software tool developers use an Integrated Development Environment (IDE) for easier Java development. The most widely accepted IDE among Java developers is Eclipse. This table gives you quick tips for using the Eclipse IDE to develop Android apps.















































TaskHow to accomplish
Start a new Android projectFrom the New Project screen, under Android in the Wizards
panel, select Android Project.
Create and starting an emulatorFrom the Window menu, select Android SDK and AVD Manager.
Select Virtual Devices and click on New. Enter a name for the
virtual device, set the target and click on Create AVD. The device
will be created. You will be placed back in the Virtual Devices
screen. From the list of devices, select the device you just
created and click on Start.
Deploy your app on a deviceRight-click on the project that contains the app, select Run
As, and then select Android Application.
Bring up the logcat windowFrom the Window menu, select Show View, and then Other. From
the list of views shown, select logcat.
Debug your applicationDeclare your application as "debuggable" in its manifest. To do
this in Eclipse, view the Manifest, open the Applications tab, and
set the field named Debuggable to true (or edit the XML directly,
add android:debuggable=class="code">"trueclass="code">" as an attribute to the class="code"><application> element). Enable USB
debugging on Windows and Linux (see href="http://developer.android.com/sdk/win-usb.html">Google USB
Driver and href="http://developer.android.com/guide/developing/device.html">Using
Hardware Devices). Right-click on the project that contains the
app, select Debug As and then select Android Application
See what devices are availableFrom the Window menu, select Show View, and then Other. Select
Android, and then select Devices
Open the DDMS perspective to browse a deviceFrom the Window menu, select Open Perspective, and then
DDMS.
Upload a file to a deviceOpen the DDMS perspective to browse the device. In the File
Explorer tab, click and highlight the directory into which you want
to upload the file. Then select the little icon at the top of the
window whose tooltip says, "Push a file onto the device".
Use the profilerIn the Devices view, select the running project. Start the
profiling by clicking on the icon to the left of the Stop sign
(tooltip reads, "Start Method Profiling").
Set up an Android Unit Test projectIn the Resource or the Java perspective select
File->New->Other-Android Test Project. Set the name of the
Android development project that is being tested.




>



>


>


Mastering Common Tasks of Android App Development


Android app development involves many tasks, including designing and building the core of your application; determining user interface components; and, importantly, making your Android app commercially available to the public. This table is a "how-to" for many of the tasks you perform when developing Android apps.











































TaskHow to Accomplish
Create string, color, image, audio, and video resourcesIn the Android project look under the class="code">res directory. String and color resources are
placed in the strings.xml file in the
values sub-directory. Images, audio and
video are added in the raw
sub-directory.
Create iconsIcons are added in the drawable
directories. Common icons are placed in class="code">res->drawable. Icons for specific screen
resolutions and sizes are placed in the extended class="code">drawable directories; class="code">drawable-hdpi for high-resolution screens,
drawable-mdpi for medium resolution
screens and drawable-ldpi for low-res
screens.
Create an activityCreate a Java class for the activity that extends class="code">android.app.Activity.Activity. Create an entry
for it in the AndroidManifest.xml
file.
Create the user interface for an activityCreate the layout file for each class in the res->layout
directory. Use setContentView(class="code">...) to create and
set the view for the activity. Use class="code">findViewById(...class="code">) to extract the components of the view.
Activity must implement the class="code">onClickListener interface (the class="code">onClick(...class="code">) method).
Create a menu for an activityDefine the menu in the res-menu sub-directory of the project.
Implement the onCreateOptionsMenu(Menu
menu)
method and the class="code">onOptionsItemSelected(MenuItem item).
Add logging to your applicationUse Log.v(class="code">...), class="code">Log.d(...class="code">), Log.i(class="code">...), class="code">Log.w(...class="code">), or Log.e(class="code">...) (verbose, debug,
information, warning, and error, respectively). Parameters to each
of these methods are a string tag and a string message.
Launch a web browser from your appUse:



Intent LaunchBrowserIntent = new
Intent(Intent.ACTION_VIEW, theUri);




startActivity(LaunchBrowserIntent);
Record audio or videoCreate an intent using class="code">android.provider.MediaStore.Audio.Media.RECORD_SOUND_ACTION.
Broadcast the event using the class="code">startActivityForResult(class="code">...). Implement a
protected method onActivityResult(int
requestCode, int resultCode, Intent data)
to receive the
result as an intent.



For video, use the same code, but with class="code">android.provider.MediaStore.ACTION_VIDEO_CAPTURE.
Publish to the Android store.Create a Developer account by clicking on the
http://market.android.com/publish link at the bottom of the home
page of the Android Market. Sign your application using
File→Export→Android→Export Signed Android
Application. Upload your application from the Developer Console of
the Android Market.




>






>
dummies


Source:http://www.dummies.com/how-to/content/android-3-sdk-programming-for-dummies-cheat-sheet.html

No comments:

Post a Comment