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

Saturday, 6 July 2013

How to add View to android service ?

Generally Android service do not have view

Android Service can be explained as -

Service is an application component that can perform long-running operations in the background and does not provide a user interface. Another application component can start a service and it will continue to run in the background even if the user switches to another application.

But If you want to add some UI to the service , then you can use WindowManage for this purpose.
Suppose you want to add Imageview to the android application, Then following code serves the purpose.


ImageView imageView = new ImageView(this);
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
    WindowManager.LayoutParams.WRAP_CONTENT,
    WindowManager.LayoutParams.WRAP_CONTENT,
    WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
    WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,
    PixelFormat.TRANSLUCENT);
  params.gravity = Gravity.LEFT | Gravity.BOTTOM;
  params.setTitle("Any Title");
  WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE);

   wm.addView(imageView, params);
  imageView.setBackgroundResource(R.drawable.idofimageresource);



copy this code in the onCreate()  function of the service.
You can experiment different layout params and found out what is useful for your.

Wednesday, 3 April 2013

Official Upgrade for Samsung Galaxy pop S5570 from Android 2.2 to android 2.3

Galaxy pop is one of early Android smartphone of Samsung. Galaxy pop has android 2.2 (Froyo) as default OS. However, you can upgrade your  galaxy pop to Android 2.3 i..e very  easily.


Note : Before upgrading your smartphone, Kindly remove your sdcard ,sim card and take backup of your contacts and other important data. Make sure that your phone battery is fully charged. The process should not be interrupted in between. 

Steps to upgrade your galaxy pop from froyo to gingerbread are as follows.

Step 1: Install  samsung kies to your laptop/pc
Step 2: Connect your Galaxy pop with laptop using USB cable. Now open kies, and wait till your device is detected.

Step 3: Go to Tools menu, Click on  "Firmware Upgrade and initialisation" option.

Step 4: Now click on available update.... it would take around 15-45 minutes depending upon your machine and internet connection speed.

Step 5: Reboot your device after upgrading process is successfully completed.


Check "About phone" option in settings menu !
Congratulation ! you have Android 2.3 in your Galaxy pop.

Monday, 11 March 2013

How to use Android Emulator to test Custom ROM


You might have a smart phone , more precisely android smart phone and you want to install a fancy customized ROM right?

Well,  before flashing any custom ROM directly on smartphone you can try it on Android virtual device.

Requirement :
Android sdk -tool should be installed on pc/laptop to create AVD (android virtual device)
system image of custom ROM


Follow the steps given below

Step 1: Open Command prompt (run > cmd  hit enter).

Step 2: change path to "tools" folder of your android sdk
it is something like  ..\Android\android-sdk\tools
[Note : if you have set your path variable for Android Sdk then skip this step   ]


Step 3: enter the command : android list target
This command will give you list of available Android targets with ID of perticular target.
Note down the Id number of target for your custom rom
for example if your custom ROM is for ICS then choose ID number of 4.0 like wise

Example Outout :

Available Android targets:
----------

id: 3 or "android-7"
     Name: Android 2.1
     Type: Platform
     API level: 7
     Revision: 3
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WVGA800 (default), WVGA854
     ABIs : armeabi

----------
id: 5 or "android-8"
     Name: Android 2.2
     Type: Platform
     API level: 8
     Revision: 3
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WVGA800 (default), WVGA854
     ABIs : armeabi
----------
id: 15 or "android-15"
     Name: Android 4.0.3
     Type: Platform
     API level: 15
     Revision: 3
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854,
     XGA720, WXGA800
     ABIs : armeabi-v7a, x86



Here for ICS we can chose ID- 15

Created AVD 'abc' based on Android 4.0.3, ARM (armeabi-v7a) processor,
with the following hardware config:
hw.lcd.density=240
vm.heapSize=48
hw.ramSize=512

Step 4 : now we will create avd for our target sdk
command : android create avd -n NameOfEmualtor -t TargetID
hit enter ,If you receive error message : Error: This platform has more than one ABI.

Please specify one using --abi. find out abi for your target from previous "android list target" command output and now run
command: android create avd -n Name_Of_Emulator -t TargetID --abi AbiType

Example: android create avd -n myemulator -t 15 --abi armeabi-v7a
Now it will prompt : Do you wish to create a custom hardware profile [no] :
if you dont want to create custom hardware then simply give enter, It will chose default settings. and will give you following output

Step 5:
now you can see that folder named after you avd will be created in
"C:\Users\your_user_name\.android\avd" folder
copy your all Images like user image, data image, system image to this folder.

Step 6: now you can start emulator with your custom ROM by following
command : emulator -avd Name_Of_Emulator

For the first time it may take several minutes to start your AVD.

Done !
your comments, questions and suggestions are always welcome.