How To Developing Android Application in hindi

Part-01

Activity

Activity is the presenter of a single screen in the application. It is the only one who has certain abilities, like displaying Views, menus, alerts and notifications. It also has the ability to open a new Activity, which means opening a new screen.Activity is a class which derives from android.app.Activity.An application needs to have at least one Activity.All Activities must be declared in the manifest file. 

View

A view is a single user interface element. Its responsibilities include drawing on a canvas and handling user events. 
Some Views can contain other Views, these are called view groups. 
A View is a class which derives from android.view.View. 
There are already many existing views. The developer can use them or create his own customized view by extending any of them.

Intent

Intent is the negotiator between two activities or between two applications. It gives the ability to pass messages and data between the two entities. 
When writing applications for mobile, Intent is very handy, since it gives access to a lot of the OS services like opening the camera, a browser, displaying notifications and so on. 

Service


A Service is an application which has the ability to run in the background without displaying any user interface. 
A Service is a class which derives from android.app.Service. 
All Services must be declared in the manifest file.

Environemnt Installation

Option 1 - Eclipse Plugin

If you have an Eclipse installed and you wish to continue working with it, you can do so by installing the Android Eclipse Plugin.
http://developer.android.com/sdk/eclipse-adt.html

Option 2 - Android Development Tools (ADT) Bundle

The ADT Bundle is a complete package of Eclipse with Android plugin and Android SDK with all the extra tools. So this is probably a good options if you are starting from scratch.
http://developer.android.com/sdk/installing/bundle.html

Option 3 - Android studio

If you like inteliJ morte than a Eclipse, than this is probably the best option for you. This one also includes every thing the ADT bundle includes.
http://developer.android.com/sdk/installing/studio.html

Creating a project

In Eclipse: Select File > New > Android Project.
In Android Studio: Select File > New Project.

Enter the project properties:

  • Application name - this is how the user sees the title of your application
  • Project Name - The java eclipse project name.
  • Build SDK - The Android SDK version you will use to develope your application.
  • Minimum required SDK - The minimum Android API version to be supported by your application.
  • Package name - Android demands each application to declare its root package
  • Click on 'Next' twice

  • Create Activity + Activity name
  • Click on 'Finish'.


    An Android project structure



    Manifest file

    AndroidManifest.xml defines the Android application project. It defines the attributes, activities, versions, permissions, and other parameters of the application.

    'src' folder

    As any Java project, this folder holds all the Java sources and packages.

    'res' folder

    Holds any local resources of the application:
  • 'drawable' - image folders according to resolutions. By default there are 3 folders for 3 basic resolutions.
  • 'layout' - xml files which represent display layout. By default a main.xml is created.
  • 'values' - xml files which define global constants, strings, styles or colors.

  • *Note: files in the res folder may be modified for optimization purposes.

    SDK jar

    Holds the android.jar which is different from versions of the SDK.

    'gen' folder

    Contains the R class which is a class that is automatically generated by the Eclipse plugin and gives access to the projects resources.

    'assets' folder

    Holds other raw resource files such as movies or sound files. By default this folder is not created. These resources will not be modified.

    Creating Android Virtual Device (AVD)

    The developer can test his applications on an emulator which comes along with Android SDK.
    But first the developer has to define a virtual device which suits his needs.

    To create an AVD:
  • In Eclipse: select Window > AVD Manager 
       In Android Studio: select Tools > AVD Manager 
       or click the AVD Manager icon from the toolbar.
  • In the Virtual Devices panel, you'll see a list of existing AVDs. Click New to create a new AVD.
  • Fill in the details for the AVD and click "Create AVD".

  • Signing and generating jars

    Android applications as other applications are zipped to jar files. The only difference is that Android jar files have a different extension - .apk.
    All application jars have to be signed before they are installed.
    Please follow instructions in:
    http://developer.android.com/guide/publishing/app-signing.html
    Next

    Views

    Creating and adding a new View to a Layout
    XML example - Adding to a view in a layout xml file
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout  xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/mainLayout" >
        <TextView
        android:text="My text view"
        android:id="@+id/TextViewExample"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"></TextView>
    </LinearLayout>
    Code example - Creating and adding a new view to a Layout (implemented in an Activity class).
    TextView textView = new TextView(this);
    textView.setText("My Text View");
    ((LinearLayout)findViewById(R.id.mainLayout)).addView(
            textView ,
            new LayoutParams(LayoutParams.MATCH_PARENT,
            LayoutParams.WRAP_CONTENT));


    Comments

    Popular posts from this blog

    कंफर्म ट्रेन टिकट ना मिलने पर स्मार्ट बस से करें सफर, रेल यात्री का खास ऑफर

    इकोनॉमिक सर्वे की 10 खास बातें यहां पढ़ें

    Musk ने क्रिएटर्स को दिया लाखों रुपये, ट्विटर से आप भी कर सकते हैं कमाई, इस तरीके से X यूजर्स हुए मालामाल