android

Android: Exchange objects between Activity and Service

Hello! I have an Activity "A" which instantiates two objects from the Facebook Android SDK. I put these two objects into a static HashMap with unique static keys and their references. From other activities "B" and "C" I'm able to get these two corresponding references via myhashmap.get(). These two Activities are within the same applica...

Android waitForMonitorWithTimeout method not working

I am writing automated test cases using Instrumentation. "waitforMonitorWithTimeout" always timesout. If I use waitForMonitor everything is fine. The two lines of code are below. (I comment out one of them when building my test project). Activity currentActivity = instrumentation.waitForMonitorWithTimeout(monitor, (long)30); Acti...

How to disable an item in a Spinner

Is it possible to display particular entries in a Spinner list as disabled? i.e. I want to always display a spinner with 4 entries (North, South, East and West, say), but I want to be able to disable any one of these so that is appears greyed out and not selectable. Is this possible, or will I have to recreate the list each time, leavin...

Lifecycle of a Service and the best way to unregister Listeners

Hi I've an IntentService which updates an AppWidget. That Service starts every time the AppWidget is being placed on the Screen or when the AlarmManager /ContentObserver / OnChangeListener get called. It stops itself after updating the widget. UpdateService.java: @Override public void onCreate() { contentObserver = new CustomConten...

ADB Connection problem

This question is on Android ADB. I am fairly new on Android / ADB. My requirement is to have a synchronous / "continuous data transfer" kind of connection using ADB (with the device and hosted PC). Currently i need to invoke the ADB shell each and every time when i want to send some data/file to the device, Is it possible to have a "...

how to record key / motion / touch events in android

Hi, Anybody know how to record key events / touch events / motion events occured on an android device or emulator. and these can be utilized again for testing / iteration purpose Please help ...

TableLayout generated by code isn't displaying

I have a need to generate a table layout dynamically using code. I can't get it to display. I've reduced the table generation code segment down to its basics to try and nut it out but even this greatly simplified version isn't working (ie. doesn't display). Can someone please point out what I'm doing wrong? Thanks. public class Tabl...

customise widgets in simple Cursor Adapter in Android

Hello, i have a simple cursor adapter that populates a listView from a database. I would like to know how to customise the different widgets in the listview. an example would be like changing the textview color or setting a different text output based on entries in the database. How do i go about this?. thank you ...

HTTP connection in Android

How to create an Http Connection to retrive a web page content to my android? Please post example code for this. ...

error on installing .apk file with verrsion2.1

I just worked my android application with device (htc magic)version1.5 and it loads properly and when i try to load the same application with the other phone by installing the .apk file of version1.5 with android version 2.1 and kernel version 2.6.29 omap1 but now i couldnt find my application getting installed on my device... I have...

Android Programmatic Frame Layout used as a button - How to fill_parent

Hi guys, Been stuck on this for a while and tried a few various things. Basically I've overridden frame layout to create myself a custom button. The frame layout has two children a button and a linearlayout with items in it. The problem is I'm trying to the get the button to stretch to the size of the frame layout (i.e. fill parent) a...

Programatically starting the 'Add Account' activity in Android 2.2

I've been experimenting with the Android SDK over the past few days, in readiness to write an App for the store, however I've run across a bit of a problem. The App I'll be writing requires that the user has a Google account associated with the phone. Retreiving and making use of the Auth token etc was not a problem, however I would lik...

Build Failed while compiling Android program

when i compile simple android application using command line. following Error occur ../>ant debug Buildfile: build.xml [setup] Android SDK Tools Revision 6 [setup] Project Target: Android 1.6 [setup] API level: 4 [setup] WARNING: No minSdkVersion value set. Application will install on all Android versions. [set...

Line Numbers, Code Highlighting in TextView

I'm working on an 'IDE' for Android - it could be useful for editing short scripts / making quick adjustments to files. At the moment I'm just using a simple EditText, but I am wanting to add several features, for example Line Numbering down the left hand side of the EditText and Code Highlighting. Does anyone have any suggestions about...

Title of Android AppWidget below widget-icon

Hello, I am working on a small application which should be represented by an AppWidget. The AppWidget should look like many other widgets on my HTC Desire. Most of them consist of an icon and a title below the icon. The title always looks identical, it is white text on a black rounded banner. I have not found a way to get this layout w...

How to store downloaded images in to android SD card

Hi i am developing app which downloads the images from the web site and then i am displaying them as slide show. now i want save the downloaded images into my SD card please help me..... My Current Trying Code is: File imageFileFolder = new File(Environment .getExternalStorageDire...

How do I open a socket below 1024

I'm trying to create a ServerSocket on a port below 1024. Obviously, this is restricted to root access only. But I'm struggling on getting the right permissions for my app. I'm using this code, for example, to test if I have root access (or trigger the dialog) But it still doesn't let me ServerSocket work. AFAIK, the process that i...

Android ListView ArrayAdapter data updates Best Practices.

Hi, I have an activity with multiple list views that are continuously receiving new values form a socket thread, another thread parses the data and updates the array adapters, then the ui thread calls notifyDataSetChanged() to cause the list to refresh. My issue is that im refreshing all the list a couple of time a second, this causes t...

How to code for reading pdf file in android?

How to code for reading a pdf file in android? i want to build an app like RepliGo reader. So, Please enlighten me to read pdf by using android sdk or ndk. ...

Hello, Gallery Demo NullPointException

http://developer.android.com/guide/tutorials/views/hello-gallery.html I followed the guide exactly, I can compile and run the program but it crashes on load. When I try to view main.xml in I get errors in the Console. java.lang.NullPointerException at android.view.GestureDetector.(GestureDetector.java:347) at android.view.GestureDe...