android

How to change the divider height of listview dynamically?

Hi, I have a listview in which there should be different divider height between different rows. So, how can we set the divider height dynamically? Suppose, I have 10 rows and there should be a divider height of 5 between first 2 rows and then there should be a divider height of 1 between next 5 rows and so on. Can someone let me know ...

Creating own LiveWallpaperPreview?

Hi, I would like to create my own LiveWallpaperPreview, i.e. to show the user a fullscreen preview of what the selected Live Wallpaper looks like (without the "Set Wallpaper" and "Settings" button that the stock-OS preview has). Rebuilding the LivePicker-Class from 2.1 (android.git.kernel.org) works great, so I am able to let the user ...

How to use Broadcast Receiver in different Applications in Android?

Hi I have here two applications in two different projects in eclipse. One application (A) defines an activity (A1) which is started first. Then i start from this activity the second activity (B1) in the second project (B). This works fine. I start it the following way: Intent intent = new Intent("pacman.intent.action.Launch"); ...

Looking for tutorials/examples on creating fullscreen IME in Android

Hi everybody I am currently trying to develop a fullscreen input method for Android, but I have a hard time finding any hints on this. The only examples and tutorials to be found are for non-fullscreen IMEs and mention fullscreen mode only very briefly. Also every tutorial about input methods seems to assume that the input method has g...

Responding to preference updates in Android

I am calling a PreferenceActivity from another activity and then updating the application state (ie: changing the font size) on onActivityResult, based on the preference changes. I was thinking it would be better to put the state update logic in the PreferenceActivity. That way I don't have the duplicate the logic in each activity that ...

android : customer List Adatper + ArrayList

Team, Could you please help me debug the issue? ActivityAdapter activityAdapter = new ActivityAdapter(this,activityList); Log.d("list", "List Display - 1"); setListAdapter( activityAdapter ); Log.d("List", "list done"); It's throwing exception at the time of setListAdapter, 05-01 16:59:15.996: WARN/dalvikvm(251): th...

[Android] How do I load URL that requires login into variable?

I am trying to port my usage meter from a JavaScript Gadget (win) / Widget (OSX) to Android. Total newbie when comes to JAVA + Eclipse + Android 2.1 SDK. Essentially what I want to do is load a page, pass through a username and password and load the resulting page into a array that I can then run some regular expressions through. My cod...

How to search for files on phone sdcard or else where

I want to search for files on the users mobile with specific extensions. I tried searching but could not find any direct API's. Is there a specific API's or is there tedious way of achieving the same. Or is there a mechanism to call linux calls for find or something similar Thanks ...

Is it possible to use AsyncTask in a Service class ?

Everything is in the title. On the official documentations it is stated that Note that services, like other application objects, run in the main thread of their hosting process and AsyncTask only works if it is executed in the UIThread. So is it possible to use AsyncTask in a Service class? I am trying to do so but I'm always getting ...

Why would JmDNS service discovery work on a Motorola Droid running Android 2.1-update1 and not on an HTC Incredible running the same version of Android?

I have successfully gotten JmDNS working on Android 2.1 testing on a Motorola Droid by using MulticastLock, but recently got an HTC Incredible as second test device, and JmDNS discovery doesn't work at all. I should mention that broadcasting a service still works and everything appears to run normally, but serviceAdded() never gets call...

How to align text in android

I want to align my text at the bottom left in android. ...

How to make a SurfaceView always horizontal?

Hello there... I'm using SurfaceView to draw some stuff using canvas. The problem is that I want to show everything horizontally by default and keep it that way regardless the position of the device. I'm not using any layout XML file to show the SurfaceView; instead I just have a class that extends SurfaceView and I do setContentView(ne...

ButtonDown and ButtonUp events for Android screen buttons?

Is there a way to get an onButtonDown or onButtonUp event for a soft button (i.e. not a physical hardware button, but a button on the screen)? I have a button on the screen that I want the user to hold down for X seconds. To do this I need to capture the buttonDown and buttonUp events separately. Thanks, Bret ...

android ListView question

Hi, I have a ListView in my android application. If I flick up/down the ListView, which method will return my 'selected' element in my list View? How about if I use the track ball to navigate up/down my list view, which method will return the index of my selected element? Thank you. ...

Change the playback rate of a track in real time on Android

Hello, I would like to know if somebody knows a library to changing the playback rate of a track in real time. My idea is to load a track and change its playback rate to half or double. Firstly, I tried with MusicPlayer but is was not possible at all and then I tried with SoundPool. The problem is that with SoundPool I can´t change the ...

Why Camera.setParameters(Camera.Parameters) does not work on Sony-Ericsson X10 and Droid?

Has anyone come across a strange behaviour with the Camera API when used on Sony-Ericsson X10 or Droid? For example the following code doesn't work on those devices. As a result I'm getting a lot of negative feedback on the Market translating into many cancelled orders... mParameters.set("rotation", orientation); mParameters.set("jpeg-...

Android: SharedPreference: Defaults not set at startup...

I have Listpreferences in my app. They don't appear to be setting to their defaults right after installation - they appear to be null. I'm trying to figure out why my default preferences are not being set right after installation. In my main code I have: SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); ...

Android Source Code Tree Structure

I have downloaded Android source code but I don't find the "Kernel Directory" in the top level directory of the source code tree. Is it normal ???? or is it missing ??? /mydroid$ find . -name kernel ./bionic/libc/kernel ./vendor/htc/sapphire-open/kernel ./vendor/htc/dream-open/kernel ./dalvik/libcore/luni-kernel/src/test/java/tests/api...

How to add a 9patch image to a xml drawable

Hi, I have the following drawable which draw a rectangle. Can you please tell me how can I add a 9patch image as the background of this drawable? <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" > <stroke android:width="1dp" android:color="#FFFFFFFF" /> <solid android:color="@an...

Android widget different portrait and landscape orientation

Hi all, I have a (hopefully) a relatively simple question. How do I tell Android which layout to use for portrait and which layout to use for landscape orientation on my AppWidget? Thanks in advance! ...