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
Showing posts with label Dev. Show all posts
Showing posts with label Dev. Show all posts
Wednesday, 1 February 2012
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 linerequestWindowFeature(Window.FEATURE_NO_TITLE);
OR
In AndroidManifest.xml file use the following android theme for your activity<activity android:name=".YourActivityClassName" android:theme="@android:style/Theme.NoTitleBar"> </activity>
<activity android:name=".YourActivityClassName" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> </activity>
[2] Hiding App Title and Status Bar(Notification Bar)
Request window feature. In the onCreate method of Activity, Add the following linegetWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
OR
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
2] Locate the xml block of Javadoc file. As given bellow
<!-- DOCS ........................ -->
<sdk:doc>
<!-- Generated at Thu Dec 15 16:56:14 2011 from git_ics-mr1 @ 238992 -->
<sdk:revision>1</sdk:revision>
<sdk:api-level>15</sdk:api-level>
<sdk:archives>
<sdk:archive arch="any" os="any">
<sdk:size>137065704</sdk:size>
<sdk:checksum type="sha1">bd6be3d4f40d610963113b956edddcd66aca9327
</sdk:checksum>
<sdk:url>docs-15_r01.zip</sdk:url>
</sdk:archive>
</sdk:archives>
</sdk:doc>
3] Create url to download the Javadoc file
Append the repository url with <sdk:url> value. So we get the new url as
https://dl-ssl.google.com/android/repository/docs-15_r01.zip
4] Download the Android Javadoc file from the url.
5] Extract the zip to location : 'C:\Program Files\Android\android-sdk\platforms'
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.
Now the Javadocs are integrated in Eclipse and available for Android Projects.
Steps for downloading Android Javadoc file for offline use.
1] Go to https://dl-ssl.google.com/android/repository/repository-5.xml2] Locate the xml block of Javadoc file. As given bellow
<!-- DOCS ........................ -->
<sdk:doc>
<!-- Generated at Thu Dec 15 16:56:14 2011 from git_ics-mr1 @ 238992 -->
<sdk:revision>1</sdk:revision>
<sdk:api-level>15</sdk:api-level>
<sdk:archives>
<sdk:archive arch="any" os="any">
<sdk:size>137065704</sdk:size>
<sdk:checksum type="sha1">bd6be3d4f40d610963113b956edddcd66aca9327
</sdk:checksum>
<sdk:url>docs-15_r01.zip</sdk:url>
</sdk:archive>
</sdk:archives>
</sdk:doc>
3] Create url to download the Javadoc file
Append the repository url with <sdk:url> value. So we get the new url as
https://dl-ssl.google.com/android/repository/docs-15_r01.zip
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 list2] 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" />
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.
Subscribe to:
Posts (Atom)