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

Tuesday, December 7, 2010

signing apk to publish in android app store using keytool and jarsigner

To publish an android application in android market, we need to sign it using jarsigner.

Signing the apk file is very easy, we need to sign for at least 50yrs to publish in android market.

Follow the simple steps to do it.

Step 1:
Create a folder named "keytools" and make a sub folder in that called "keys".

Step 2:
In Eclipse Package Exp window, right click on your project and select Android Tools -> Exports Unsigned Application Package and Save in keytools folder.

Step 3:
Go to your java jdk folder and check jarsigner and keytools is available or not. Path is something like following "C:\Program Files\Java\jdk1.6.0_18\bin"

The the jarsigner and keytools are not available, its not possible to sign the application. Download the files from net and put it in bin.

Step 4:
Open the CMD and navigate to your "keytools" folder. Now the "keytools" folder will be containing .apk file and keys folder.

type the following in your CMD
C:\"Program Files"\Java\jdk1.6.0_18\bin\keytool -genkey -alias myapp.keystore -keyalg RSA -validity 20000 -keystore keys/myapp.keystore

and press enter

Enter keystore password: "SECRET PASSWORD"
Re-enter new password: "SECRET PASSWORD"
What is your first and last name? "Abbas"
What is the name of your Organization unit? "Mobileveda"
What is the name of your Organization? "eMahatva private Limited"
What is the name of your city or locality? "Coimbatore"
What is the name of your state or providence? "TamilNadu"
what is the two-letter country code for this unit? "IN"
is CN=Abbas C=IN correct?
"YES"
Enter key password for
: (press enter button)

Following things may change
1) jdk1.6.0_18 -> your jdk folder name
2) myapp -> your application name.
3) 20000 is number of dates
4) Personal information.

STEP 6:

type the following in CMD

C:\"Program Files"\Java\jdk1.6.0_18\bin\jarsigner -verbose -keystore keys/myapp.keystore -signedjar myapp_signed.apk myapp.apk my.keystore

Enter Passphase for keystore: "Enter your password previously given"
adding: META-INF/MINFEST.MF
.
.
.
.
Signing: classes.dex

Thats it.

Check your keystore folder.

Thanks.

Wednesday, November 24, 2010

Changing ListView seperator and selection color - Android

1) How to change listview separator color and selection color?

use the following in your listview

android:id="@+id/homeListView"
android:drawSelectorOnTop="false"
android:listSelector="@drawable/rollover_singleline"
android:divider="#ffebb5"
android:dividerHeight="1px"
android:paddingTop="50dip"
android:layout_width="fill_parent"
android:layout_height="fill_parent">




Thanks.

Monday, November 15, 2010

Android - Passing Data between Activity

Hi

You can pass the data between Activity using Bundle in Android.

To launch an activity we use to create an intent. using the intent object we can pass the data

For Example

Intent i = new Intent(this, InvokedIntent.class);
i.putExtra("floatValue", 5.0f);
i.putExtra("StringValue", "baz");
startActivity(i);

floatvalues and stringvalues are user defined keyword, In the InvokedIntent class we use this keyword to retrieve the value. Similarly we can add multiple entries here.

To read the passed value, Inside the InvokedActivity Class

Bundle extras = getIntent().getExtras();
if(extras !=null)
{
float foo = extras.getFloat("floatValue");
String bar = extras.getString("StringValue");
}

That's it.

Check: http://developer.android.com/reference/android/os/Bundle.html

Thanks.