Wednesday, 1 February 2012

Eclipse: Setting max line width for auto formatting

Eclipse has the functionality to auto format code on CTRL+SHIFT+F key press. At a certain point, it wraps lines.

You can increase Maximum line width -

1] Open Eclipse > Window > Preferences,
2] On the left panel. Click Java > Code Style > Formatter
3] You need to create a new 'Active profile'. To create click New button. Type profile name. Choose 'Eclipse [built-in]' in drop-down list and click ok.
4] In the Profile window select 'Line Wrapping' tab. In 'General Settings' Increase the value of 'Maximum line width:' property and Apply.
5] Select the newly created profile in Active profiles list. Apply and click OK.
6] In code editor window, press CTRL+SHIFT+F to confirm changes.
7] Done

Saturday, 14 January 2012

Android : How to Remove Application Title and Status bar from Activity

We can remove the 'application name' from androd activity. Thus we can utilize this extra for activity. To do this

[1] Hiding Application Title

Request window feature. In the onCreate method of Activity, Add the following line
In AndroidManifest.xml file use the following android theme for your activity
<activity android:name=".YourActivityClassName" android:theme="@android:style/Theme.NoTitleBar"> </activity>

[2] Hiding App Title and Status Bar(Notification Bar)

Request window feature. In the onCreate method of Activity, Add the following line
In AndroidManifest.xml file use the following android theme for your activity
<activity android:name=".YourActivityClassName" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> </activity>

Friday, 13 January 2012

Downloading and Integrating Android Javadoc Locally with Eclipse

Missing Javadoc while building an android project ? Don't worry, Here is the solution

Steps for downloading Android Javadoc file for offline use.

1] Go to
2] Locate the xml block of Javadoc file. As given bellow
<!-- DOCS ........................ -->
 <!-- Generated at Thu Dec 15 16:56:14 2011 from git_ics-mr1 @ 238992 -->
  <sdk:archive arch="any" os="any">
   <sdk:checksum type="sha1">bd6be3d4f40d610963113b956edddcd66aca9327
3] Create url to download the Javadoc file
Append the repository url with <sdk:url> value. So we get the new url as
4] Download the Android Javadoc file from the url.
5] Extract the zip to location : 'C:\Program Files\Android\android-sdk\platforms'

Steps for Integrating Android Javadoc with Eclipse IDE.

1] Open Eclipse > Project > Properties > Click on 'Java Build Path' from list
2] Select 'Libraries' Tab
3] Expand 'Android X.X' and then expand android.jar.
4] Select '@ Javadoc location' field and click on Edit Button. A new window will popup.
5] Choose 'Javadoc URL' then click on browse button and select path to ..\doc\reference folder extracted previously. i.e.
'C:\Program Files\Android\android-sdk\platforms\docs\reference'
7] Click Validate button.
Note: Please be sure that you have selected the path to \doc\reference folder otherwise you will get following error while validating
'Location might be invalid. Files 'package-list' and 'index.html' that are typically available at the root of documentation created by the Javadoc tool have not been found.'
So add the correct path given above in step [5] and eclipse will validate the path.
8] Done.

Now the Javadocs are integrated in Eclipse and available for Android Projects.

Friday, 6 January 2012

Changing Main Activity of Android Project

When we create a new Android project in Eclipse, it will set the activity (Created at the time of making a new android project project) to be the main Activity.

If you create another Activity and you want that Activity to be called as the main Activity.

Then you have to edit the 'AndroidManifest.xml' file from your Android Project.

How it works :
When an Android application is allowed to run, the host loads the application and reads the 'AndroidManifest.xml' file. It looks for an activity or activities with an intent-filter that has the MAIN action with a category of LAUNCHER and starts that activity.

How to do it :
So if you want to change the main activity of your android project, you need to CUT the following code from your previous main activity and PASTE it into the new activity which you want to set as a main activity for your android project.

<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />

Note : 
An Android Project may have more then one activities with
<category android:name="android.intent.category.LAUNCHER"> attribute.
But there should be only one activity having
<action android:name="android.intent.action.MAIN"> attribute in the AndroidMainfest.xml file.

Friday, 30 December 2011

Android SDK Offline Installation

Steps for downloading android SDK Packages for offline use.

1] Download and install Android SDK and AVD Manager from

2] Download Eclipse IDE from

3] Downloading Eclipse ADT Plugin directly as an archive from

To Install this plugin. GO to Eclipse > Help > Install New Software > and select

4] Go to
All the Android SDK Packages are listed in this XML file.

5] Locate the block of SDK version you want to download. Suppose you want to download the SDK version 2.3.3 then locate the block that looks like

    <sdk:description>Android SDK Platform 2.3.3._r2</sdk:description>
        <sdk:archive arch="any" os="any">

5] Append the repository url with <sdk:url> value.

So we get the new url of the SDK package as :

6] Download the SDK Package.

7] Extract the downloaded SDK package to C:\Program Files\Android\android-sdk\platforms\

8] Locate the block of Platform-Tools. As shown bellow
<!-- PLATFORM-TOOLS ........................ -->
    <!-- Generated at Thu Dec 15 16:55:10 2011 from git_ics-mr1 @ 238992 -->
        <sdk:archive arch="any" os="windows">
            <sdk:checksum type="sha1">
        <sdk:archive arch="any" os="linux">
            <sdk:checksum type="sha1">
        <sdk:archive arch="any" os="macosx">
            <sdk:checksum type="sha1">

9] To download the platform-tools, Append the repository url with <sdk:url> value.
The url of platform-tools for windows os :

10] Download the platform-tools and extract it to
C:\Program Files\Android\android-sdk

11] Open SDK Manager from Start Menu. You will notice that the Packages list shows Android 2.3.3 SDK Platform Status as Installed.

12] Open AVD Manager from Start Menu and create a new device and choose the target as the downloaded SDK(i.e Android 2.3.3)

13] Done.

Now you can start developing android apps in Eclipse IDE.
About Us | Site Map | Privacy Policy | Contact Us | Blog Design | 2007 Company Name