android

How to dynamically change layouts?

Hello, I have a SurfaceView using an updating thread, much like the LunarLander example. I want to have a menu option to go back to an introductory screen (which is just a bitmap), at which point another view/thread could be lanched. Do I need to do anything to gracefully clean up the view and close the thread? Most of the samples I'...

Catching key pressed with the virtual keyboard in Android?

With the physical keyboard you can catch key presses with a KeyListener, something like: myEditText.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_ENTER) { /* do something */ } } }); Does anyone know ...

android listview

hai i want to remove the listitem from listview in android.i don't know that how to do it. anyone can help me how to do it.and give sample code for this? ...

android database

Hi, I want store an image using a SQLite database in Android (using an insert statement). Also I need to retrieve the image from the SQLite database and display it on the screen. Thank you. ...

Is AtomicInteger a good solution to provide a counter for multithreaded app ?

I have an android client which will make Http connections to a server. The server requires that all Http request provide a monotonically increasing counter in the Http header. e.g. POST /foo/server X-count: 43 Places that will initiate Http connections: Inside activities under the user's command e.g. button clicks Inside a Service ...

Android hardware properties

How can I find hardware properties at runtime? I want to be able to know if the device has a physical keyboard, d-pad, trackball, etc. ...

For Android: Changing view backgrounds,texts on Scroll Event

I have 27 drawables in my res folder. I want my TextView to have its background and text changed while the user scrolls vertically(both up and down).And i want this feature to carry on forever until and unless the user terminates the app manually. What scroll event i will use here in Android? Can somebody give me a code example please? ...

Android project won't build when editing a resource file

I have an Android 1.5 project in Eclipse and whenever I merely have an xml resource file open the build dies with an error. E.g. if I have the res\layout\main.xml open as the active document it won't build and throws the following error: Error in an XML file: aborting build. res\layout\main.xml:0: ERROR Resource entry main is already de...

How to customize build-in widgets in Android (menu, notification, spinners etc.)?

Hi I want to customize colour palette in Android widgets. Orange colour is good but it can be done better. Things which I want to do: - override colours in menu after press and focus - override colours in ongoing notification bar - override colour in EditText frame and finally - override spinner focus and press colour I want to use ...

Efficient way to update mm:ss from a playing MP3 file

I'm re-inventing the wheel here, but as I'm a beginner programmer I'm curious as to the best way to do this... As part of an Android app, I'm developing a very simple media player. It plays the file, and I want a m:s timer, so the user can see how far into the file they are (e.g. "04:56"). I'm probably missing the obvious, but what's th...

Android: SearchBox -> fill hint list dynamically with data received via HTTP/JSON

I've been looking into the Android SDK's example of the SearchableDictionary for a while now, but I'm still not sure if that is the right approach. The problem is, that I want to fill my hint list (see picture below) with data, which I will receive via a HTTP/JSON query. So I'm not sure if using a ContentProvider as used in the above ex...

Eclipse doesn’t recognize style in the Android Layout builder?

Since Android supports styles and it's good practice to use them (similar to CSS), I made a new style and applied it to 3 buttons. The Layout builder in Eclipse did not register the changes and either broke (showed nothing) or didn't apply styles at all. After running the app in the emulator, styles are correctly applied. So is there ...

Android: Moving window of items in a ListView?

I am trying to update the ListView with periodic updates taken from an HTTP response. Now, I am thinking that because this is very specific to my application, I can get away by using a background thread and then updating the ListView using the magic UI thread. The last time I tried this, I had to remove the entire adapter of the ListView...

Android EditText boxes

I want to cause the focus of one edit text box to move to another on editting (meaning you can only type on letter before it automatically moves on to the next edit text). It's the "on edit" that I can't get my head around. Can anyone help me out with a simple example? Theres a lot I need to implement it into, so just a basic understand...

Howto limit the map in Android?

I'm developing my first Android application and it is based partly on displaying some information in Google Maps. I've managed to set a new center point and a new default zoom level (the area I want to display is a city). Now is it possible to "lock" that new default view somehow? That is, the user should be able to zoom in/out and pan ...

Vertically centering a view in Android.

I'm trying to center a View vertically on screen with the following layout: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <EditText android:text="example text" ...

difference between layout-finger and layout directory

Hi, In android, there are different sub-directory under 'res' * layout * layout-finger * layout-land-finger Can you please explain what are the difference between these directories? Thank you. ...

modal dialog on android browser

I have created a modal pop up box. I have an image at the background to create this. Everything works fine but if the user hits the tab key or click on the input boxes, then the keyborad appears and user can type into the boxes. This happens only if the input boxes has any stylesheet attached to it. Can anyone help me with why this is ha...

Android layout issue

So I have a webview I'd like to display as a dialog. I'd like the webview to fill the entire screen, except for a button below it that I'd like to stay at the bottom of the dialog regardless of how much content is in the webview. Currently my webview fills up the dialog just enough to push the button off the screen. I'm sure this is some...

'Must Override a Superclass Method' Errors after importing a project into Eclipse

Anytime I have to re-import my projects into Eclipse (if I reinstalled Eclipse, or changed the location of the projects), almost all of my overridden methods are not formatted correctly, causing the error 'The method ?????????? must override a superclass method'. It may be noteworthy to mention this is with Android projects - for whatev...