Showing posts with label Android. Show all posts
Showing posts with label Android. Show all posts

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
requestWindowFeature(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>


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

Request window feature. In the onCreate method of Activity, Add the following line
getWindow().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

Steps for downloading Android Javadoc file for offline use.

1] Go to https://dl-ssl.google.com/android/repository/repository-5.xml
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'


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
http://developer.android.com/sdk/index.html

2] Download Eclipse IDE from
http://www.eclipse.org/downloads/

3] Downloading Eclipse ADT Plugin directly as an archive from

http://dl.google.com/android/ADT-16.0.1.zip

To Install this plugin. GO to Eclipse > Help > Install New Software > and select ADT-16.0.1.zip.

4] Go to https://dl-ssl.google.com/android/repository/repository-5.xml
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:platform>
    <sdk:version>2.3.3</sdk:version>
    <sdk:api-level>10</sdk:api-level>
    <sdk:codename/>
    <sdk:revision>02</sdk:revision>
    <sdk:min-tools-rev>8</sdk:min-tools-rev>
    <sdk:description>Android SDK Platform 2.3.3._r2</sdk:description>
    <sdk:desc-url>http://developer.android.com/sdk/</sdk:desc-url>
    <sdk:archives>
        <sdk:archive arch="any" os="any">
            <sdk:size>85470907</sdk:size>
            <sdk:checksum
               type="sha1">887e37783ec32f541ea33c2c649dda648e8e6fb3</sdk:checksum>
            <sdk:url>android-2.3.3_r02-linux.zip</sdk:url>
        </sdk:archive>
    </sdk:archives>
    <sdk:layoutlib>
        <sdk:api>4</sdk:api>
    </sdk:layoutlib>
</sdk:platform>

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

So we get the new url of the SDK package as :
https://dl-ssl.google.com/android/repository/android-2.3.3_r02-linux.zip

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 ........................ -->
<sdk:platform-tool>
    <!-- Generated at Thu Dec 15 16:55:10 2011 from git_ics-mr1 @ 238992 -->
    <sdk:revision>10</sdk:revision>
    <sdk:archives>
        <sdk:archive arch="any" os="windows">
            <sdk:size>10007508</sdk:size>
            <sdk:checksum type="sha1">
            44ecef94d0ebf1fc4c8fc3f7f0bf1679618b1e94</sdk:checksum>
            <sdk:url>platform-tools_r10-windows.zip</sdk:url>
        </sdk:archive>
        <sdk:archive arch="any" os="linux">
            <sdk:size>9930673</sdk:size>
            <sdk:checksum type="sha1">
            5f6a36c5d5e51cfa51a964c0365a0533784b8c9f</sdk:checksum>
            <sdk:url>platform-tools_r10-linux.zip</sdk:url>
        </sdk:archive>
        <sdk:archive arch="any" os="macosx">
            <sdk:size>10001226</sdk:size>
            <sdk:checksum type="sha1">
            84fc063c555d2a84d8e8fa2092c1635c6bbe940f</sdk:checksum>
            <sdk:url>platform-tools_r10-macosx.zip</sdk:url>
        </sdk:archive>
    </sdk:archives>
</sdk:platform-tool>

9] To download the platform-tools, Append the repository url with <sdk:url> value.
The url of platform-tools for windows os : https://dl-ssl.google.com/android/repository/platform-tools_r10-windows.zip

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.

Tuesday, 8 November 2011

Using APKTool to Decompile and Recompile Android APKs

APKTool is an application which decompiles and recompiles android APKs.

It is very useful for decrypting the XML files inside the Android APK. After Decompilation we can edit the XML files and rebuild the APK. Since the strings used in the app are stored in the XML file (such as strings.XML) we can build a language pack  by translating the strings inside .XML file to any language we want.

This tool also allows us to debug the smali code.

Following is the step by step tutorial for using the APKtool on Windows.

1.Download the APKTool from http://code.google.com/p/android-apktool/.

2.Extract the downloaded APKtool to a directory (consider the dir name as apktoolwin).

3.Copy your apk file(consider the file name as xyz.apk) in the same directory.

4.Open command prompt and navigate to the APKTool directory (in our case apktoolwin).

5.Execute the following command
apktool d xyz.apk
Command prompt shows the following information
I: Baksmaling...
I: Loading resource table...
I: Decoding resources...
I: Loading resource table from file: C:\Users\sam\apktool\framework\1.apk
I: Copying assets and libs...

6.After successful completion you can find the directory with the same name as the apk file (in our case you will notice that xyz directory is been created in apktoolwin directory)

7.Now this xyz directory contains all the resources like images, xmls, etc which we can edit.

8.Use Notpad++ application for editing the xml files.

9.After editing the files we are ready to rebuild the apk. Use the following command to rebuild the apk
apktool b [folder name] [new file-name]

In our case

apktool b xyz  xyznew.apk

10.Done.You will find xyznew.apk is created in the apktoolwin directory.
About Us | Site Map | Privacy Policy | Contact Us | Blog Design | 2007 Company Name