Sunday 20 May 2012

Install apk on android emulator

To install android application (.apk) on an emulator follow these steps:

1- run the target emulator
2- copy the .apk file into platform-tools folder
3- cd into platform-tools folder
ex: E:\>cd \Android Full Development Platform (SDK+Eclipse)\android-sdk-windows\platform-tools
4- adb install theApkFileName.apk

if you launched more than one emulator, use the following code

adb -s emulator-5556 install  theApkFileName.apk


Hint: make sure adb.exe in the platform-tools folder


Mohammad Abu Hmead

Thursday 17 May 2012

Reset Identity column in SQL Server


Just use the following code and run it, your identity columns will be reset to the value you use 

DBCC CHECKIDENT('TableName', RESEED, 0)


Mohammad Abu Hmead

Wednesday 16 May 2012

Android Shape



xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
    <corners android:radius="40dp" />
    <padding
        android:left="20dp"
        android:right="20dp" />
shape>


<gradient
        android:centerColor="#FF0000"
        android:endColor="#00FF00"
        android:startColor="#0000FF"
        android:type="sweep"
        android:useLevel="false" />




<gradient       
        android:centerColor="#FF0000"
        android:endColor="#00FF00"
        android:gradientRadius="150"
        android:startColor="#0000FF"
        android:type="radial"
        android:useLevel="false" />



<gradient
        android:centerColor="#FF0000"
        android:endColor="#00FF00"
        android:startColor="#0000FF"
        android:type="linear"
        android:useLevel="false" />




<gradient
        android:angle="135"
        android:centerColor="#FF0000"
        android:endColor="#00FF00"
        android:gradientRadius="20"
        android:startColor="#0000FF"
        android:type="linear"
        android:useLevel="false" />


Gradient Angles (0,45,90,180,135,225,270)



<stroke
        android:dashGap="5dp"
        android:dashWidth="10dp"
        android:width="10dp"
        android:color="#ABCDEF" >
    stroke>




Mohammad Abu Hmead

Wednesday 2 May 2012

Image get be zoomed in Android

I had a problem, when I'm using a list of icons and texts in android app, when i press on the list item, the icon must be shown in another activity with size larger than the current(on the list item), when I press back to back to the list activity, i saw the image get zoomed. I solved the issue by creating new object from the current Drawable via the code bellow
Bitmap bitmap = ((BitmapDrawable)listItemIconDrawableObject).getBitmap();   
BitmapDrawable d = new BitmapDrawable(bitmap);
//use d whenever you want


Mohammad Abu Hmead