View RSS Feed

Android Developer

  1. Referencing Application Resources

    by , 02-11-2012 at 11:53 AM
    All the application resources are compiled at build time and are stored in “res” project directory structure. These resources can also be used programmatically. Also they can refer to other resources in application. These application resources are accessed using class file R.java programmatically. Get the application’s resource object and call getResource() method to reference a resource in your activity class. After this call the appropriate method to access your desired resource.

    ...
    Categories
    Android Resource
  2. How to access Android Application Preferences?

    by , 02-11-2012 at 11:51 AM
    You can use getSharedPreferences() method of your application context to get your application preferences. Also SharedPreferences class support saving of application data like configuration settings. You need to assign each SharedPreferences object a different and unique name that enables you to arrange preference values in different categories and can store all preferences in on large unnamed set.

    For example, if you are interested in storing user name and game statistics like how ...
  3. Android Application Context

    by , 02-11-2012 at 11:43 AM
    For all the core application functionality, application context is central location. It is used to access resources that are shared between activity instances and is used to access settings. Use getApplicationContext() method to get the application context for current process.

    Java Code:
    Context context =  getApplicationContext()
    You can also use this object when writing code in your Activity class because Activity class is derived from the Context class. After ...
  4. Managing Android Virtual Devices

    by , 02-11-2012 at 11:40 AM
    Android Virtual Device (AVD) is configured in order to execute an application in the Android Emulator. In AVD profile, the type of device is described that you want to simulate in the emulator and it also includes Android platform to support. Different screen sizes and resolution are specified and also can specify an SD card. Follow these steps to create a basic AVD:

    1. In Eclipse launch Android SDK and AVD Manager by clicking the Android icon in meny bar. Also you can select it from ...
  5. Edit a String Resource

    by , 02-11-2012 at 11:38 AM
    Open an Eclipse Android project and examine main.xml file. You will find that it has a TextView control layout. This TextView control interface simply displays a string. The string displayed in this case is defined in string resource called “@string/hello”.

    If you want to edit this string resource using string resource editor, follow these steps:

    • Double click strings.xml file in package explorer of Eclipse and it will open in the resource editor.
    • Select String
    ...
  6. Edit Android Manifest File

    by , 02-11-2012 at 11:09 AM
    Manifest information is managed in different tabs by file editor. These tabs are as follow:

    • Manifest: This tab is used for application general settings such as version information, package name etc.
    • Application: Application details such as name, icon and “guts” are defined under this tab. Like what application can run and what other services application can provide.
    • Permissions: Application’s permissions are defined under this tab. If application wants to read a contact from
    ...
  7. Android Activity Lifecycle

    by , 02-11-2012 at 11:00 AM
    All fundamental lifecycle methods of an activity are given in below code skeleton.

    Java Code: This is the code to manage lifecycle of an activity
    public class ExampleActivity extends Activity {
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            // The activity is being created.
        }
        @Override
        protected void onStart() {
            super.onStart();
            // The activity is about to become visible.
    ...
  8. Starting an Android Activity for a Result

    by , 02-11-2012 at 10:56 AM
    Start the activity using startActivityForResult() when you want to get a result from the activity. Implement the onActivityResult() method to get the result from activity. In this method, subsequent activity will return result in Intent.

    In below code, we want to pick the contact.

    Java Code: This is the code to start an activity for a result
    private void pickContact() {
        // Create an intent to "pick" a contact, as defined by the content provider URI
        Intent intent = new Intent(Intent.ACTION_PICK,
    ...
  9. Starting an Android Activity

    by , 02-11-2012 at 10:53 AM
    startActivity() method is called when a new activity is started. Intent object is passed as parameter and it describes your activity. What actions you want to perform are described by this intent. Also data used by an activity is carried by this intent.

    For launching a new activity, create an intent that describes the activity using the class name. Following code explains how one activity can start a new activity.

    Java Code: This is the code to create a new Intent
    Intent intent = new Intent(this, SignInActivity.class);
    ...
  10. Android Activities

    by , 02-11-2012 at 10:44 AM
    A single screen in Android application is provided by an activity. You can move these Activities into background and then resume.

    It is just like a screen where a user interacts and performs some actions such as dial the phone, view map, send email, take a phone etc. User interface is drawn into an Activity window. Screen is usually filled by the window or it may float on top of different other windows.

    Different bounded or integrated activities create an application. ...
    Categories
    Android Activity
  11. Android Introduction

    by , 02-11-2012 at 10:40 AM
    Android includes following at its core:

    1. Key Applications
    2. OS
    3. Middleware

    Android SDK consists of different APIs & tools to start developing mobile applications on Android platform. The programming language is Java that is being used for development of these applications.

    Core Features

    1. Application framework: It is used to replace and reuse different components
    2. Dalvik VM (Virtual Machine): An optimized ...
    Tags: android, tutorial Add / Edit Tags
    Categories
    Tutorial