Sunday, 14 April 2013

Android Lessons 3 _ XML-Based Layout - More XML and reference background



Welcome back Developer , i hope you are fine , let us begin our third android lesson :

What Is an XML-Based Layout?


As the name suggests, an XML-based layout is a specification of widgets’ relationships to each
other—and to their containers encoded in XML format. Specifically,Android considers XML-based layouts to be resources, and as such layout files are stored in the res/layout directory inside your Android project.

Each XML file contains a tree of elements specifying a layout of widgets and their containers
that make up one view hierarchy. The attributes of the XML elements are properties, describing
how a widget should look or how a container should behave. For example, if a Button element
has an attribute value of android:textStyle = "bold", that means that the text appearing on
the face of the button should be rendered in a boldface font style.

Android’s SDK ships with a tool (aapt) which uses the layouts. This tool should be automatically invoked by your Android tool chain (e.g., Eclipse, Ant’s build.xml). Of particular importance to you as a developer is that aapt generates the R.java source file within your project, allowing you to access layouts and widgets within those layouts directly from your Java code.


OK, So What Does It Look Like?

Here is the Button code , converted into an XML layout file


<?xml version="1.0" encoding="utf-8"?>
<Button xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/button"
    android:text=""
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"/>


What’s with the @ Signs?

Many widgets and containers only need to appear in the XML layout file and do not need to be
referenced in your Java code. For example, a static label (TextView) frequently only needs to be
in the layout file to indicate where it should appear. 

These sorts of elements in the XML file do not need to have the android:id attribute to give them a name.
Anything you do want to use in your Java source, though, needs an android:id.
The convention is to use @+id/... as the id value, where the ... represents your locally-
unique name for the widget in question.

 In the XML layout example in the preceding section, @+id/button is the identifier for the Button widget.



• android:text indicates the initial text to be displayed on the button face (in this case, an
empty string)
• android:layout_width and android:layout_height tell Android to have the button’s 
width and height fill the “parent”

for more details about XML-Based Layout : Please watch the videos.












Read more »

Tuesday, 26 March 2013

Android Lessons 2 _ Setting up a Project and Explaining the Basics - Create your first project



Hi developer .. i hope you are fine ..

Today you will make your first Android Application .. and we will recognize files functions and configuration.


Click New in the toolbar.
In the window that appears, open the Android folder, select Android Application Project, and click Next.

Fill in the form that appears:

  • Application Name is the app name that appears to users. For this project, use "My First App."
  • Project Name is the name of your project directory and the name visible in Eclipse.
  • Package Name is the package namespace for your app (following the same rules as packages in the Java programming language). Your package name must be unique across all packages installed on the Android system. For this reason, it's generally best if you use a name that begins with the reverse domain name of your organization or publisher entity. For this project, you can use something like "com.example.myfirstapp." However, you cannot publish your app on Google Play using the "com.example" namespace.
  • Minimum Required SDK is the lowest version of Android that your app supports, indicated using the API level. To support as many devices as possible, you should set this to the lowest version available that allows your app to provide its core feature set. If any feature of your app is possible only on newer versions of Android and it's not critical to the app's core feature set, you can enable the feature only when running on the versions that support it (as discussed in Supporting Different Platform Versions). Leave this set to the default value for this project.
  • Target SDK indicates the highest version of Android (also using the API level) with which you have tested with your application.
As new versions of Android become available, you should test your app on the new version and update this value to match the latest API level in order to take advantage of new platform features.
Compile With is the platform version against which you will compile your app. 

By default, this is set to the latest version of Android available in your SDK. (It should be Android 4.1 or greater; if you don't have such a version available, you must install one using the SDK Manager). 

You can still build your app to support older versions, but setting the build target to the latest version allows you to enable new features and optimize your app for a great user experience on the latest devices.
Theme specifies the Android UI style to apply for your app. You can leave this alone.

Click Next.


On the next screen you can configure the project, leave the default selections and click Next

The next screen can help you
create a launcher icon for your
app.

You can customize an icon in several ways and the tool generates an icon for all screen densities.

Before you publish your app, you should be sure your icon meets the specifications defined in the Iconography design guide.

Sizes & scale :

• Launcher icons on a mobile device
must be 48x48 dp.
•Launcher icons for display on
Google Play must be 512x512 pixels.
Click Next.


On the next screen to configure the project, leave the default selections and click Next.

Now you can select an activity template from which to begin building your app.

For this project, select Blank Activity and click Next



Leave all the details for the activity in their default sate and click Finish.















Please Watch the Videos for more illustration and details about configuration your application.


Android Lessons 2 .. Part 1
Android Lesson 2 .. Part 2
Read more »

Monday, 25 March 2013

Android Lessons 1 _ Installing Eclipse and SDKs - Configuring Your Android Development Environment






Hi Android Developers ,
Let us start developing our first lesson ..

We have to prepare our Android Environment First ..

You needed to install and configure all the appropriate
tools you need to get started developing Android applications:


  • The appropriate Java Development Kit (JDK).
Download the latest version of the Java at : http://www.oracle.com/technetwork/java/index.html
  • The Eclipse integrated development environment (IDE).
Download the latest version  at www.eclipse.org/downloads/.
  • The Android Software Development Kit (SDK) and tools.
Download the latest version at http://developer.android.com/sdk/index.html.

Installing and Configuring the Android Plug-in for Eclipse (ADT)

The Android Plug-in for Eclipse allows seamless integration with many of the
Android development tools. If you’re using Eclipse, it’s highly recommended that
you install the Plug-in, as it will make your life much easier. 

The Plug-in includes various wizards for creating and debugging Android projects.
To install  the Android Plug-in for Eclipse (ADT) ,  you must  launch Eclipse and install 
a custom software update. 
The steps required depend on the version of Eclipse you use.
To install  Android Plug- in on Eclipse 3. 5 (Galileo) ,  fol low these steps:
1. Launch Eclipse.
2. Select Help, Install New Software.
3. Select the Available Software tab.
4. Click the Add button.
5. Add the remote site https://dl-ssl.google.com/android/eclipse/. 
If this site fails,
try http://dl-ssl.google.com/android/eclipse/.
6. On the Available Software tab, check the box next to Developer Tools box.
(Also check the boxes for Android DDMS and Android Development Tools.)
7. Click the Next button and follow the wizard for installing the tools. Accept the
terms of the license agreement and click the Finish button.
8. After the software update completes, restart Eclipse.

After you install the Android SDK Eclipse plug-in, update your Eclipse preferences to 
point at the Android SDK you previously downloaded. To do this, launch Eclipse and
choose Window, Select the Android preferences and set the path to where you installed the Android SDK. 

Once you have set the path appropriately, you will see a number of target SDK versions (Android
1.0, 1.5, 1.6, 2.0, 2.01, 2.1, and so on) listed below SDK Location in the Android Preferences dialog in Eclipse.

For more details : Please watch the video.



Read more »