android

Android: Preserve button size when changing text

I have for example a Play/Pause button and would like its size not to change when I change the text from 'play' to 'pause' and back. Due to internationalization I don't know if 'play' or 'pause' will be the longer string.. I imagine I need to set the string to the longest string and then create the button allowing the UI to size it prop...

Android getContentResolver().query error

Hey folks, I'm rather new to both Java programming and to Android development, so my learning curve is rather steep at the moment. I seem to be stuck on something that I can't find decent examples for how to work past it. I wrote a function that gets all my phone's contacts based on examples and docs I found here & there online. The pr...

How to dinamicaly change a pressed button background color?

I'm developing a question game and I want to change the answer button pressed background color to green if the answer is correct or to red if the answer is wrong just in the moment the user press the button. Actually I have a custom_button.xml which I assign to the buttons in the layout: <Button android:id="@+id/la" ...

Android LVL and Google Apps account

Is it possible to use a Google Apps account as a test account with the Android License Verification Library? I've done some testing and even though I have my Google Apps account listed, I always get back an unlicensed response. The only account I've ever had success testing with is one ending in @gmail.com Thanks- ...

How to get TextView reference from a custom ImageView?

I would like to ask if there is any methods to get a View from another View. My case is that: I have a custom ImageView call MyImageView. and my layout is that: FrameLayout: MyImageView LiearLayout: LiearLayout: TextView LiearLayout: TextView I have some code in MyImageView and I would like to e...

using Certificate in https

I write android application. How can I use Certificate in https connection when I init cert from der file and not from pkcs? When I have pkcs file with password, this code works: KeyStore keyStore = KeyStore.getInstance("PKCS12"); keyStore.load(certificateIs, pass.toCharArray()); KeyManagerFactory kmf = KeyManagerFactory.g...

Android - why ContentObserver invokes itself?

Hi, I am trying to delete received SMS in ContentObserver (on "content://sms/") onChange() method using contentResolver.delete, but after deleting ContentObserver is invoked one more time. Could you explaing my, whe ContentObserver invokes itself despite deliverSelfNotifications() returns false? I foud soultion to uregister ContentOb...

Inject Keystrokes

Is there a way to inject keystrokes into the JVM on the Android platform? I'm looking for something like java.awt.Robot but I don't think that's available on Android thanks ...

Native looking HTML selector with Android/iPhone Webkit?

Looking at Google Calendar on my android web browser I noticed the time selector looks like a native Android selector as opposed to looking like an HTML selector drop-down. To see it: go to http://calendar.google.com/ Touch the plus button at the top right Touch the time drop-down You should see the native-looking selector. What HT...

Scrolling issues with a ListView inside a ScrollView

Here's the scenario conceptually (excluding linearlayouts) ScrollView Button Checkboxes Spinner ListView (full-size, non-scrolling) AdMob advert i.e. a scrolling pane, which has a filtering UI at the top, followed by results, but the advert must always remain visible, and when scrolling down the filter UI must scroll away, lea...

StackOverflowError when switching views in Android (testing on Sprint HTC).

The application works fine in the emulator. This issue manifests on the Sprint HTC Android phone. The program uses a TabActivity which contains a MapHandler / ItemizedOverlay. When a marker on the map is touched, the overlay onTap method is called. In this method, an alert dialog is displayed then, after a button is pressed, the view is...

Best way to deploy an application that comes with lots of data

I'm working on an Android application that will come with lots of data. I'd have expected to just distribute the SQLite database, but it's clear from researching this that the database can be included, but must be copied from raw to data, which if there's a good few MB of data will take up space needlessly. For my app the data is all tex...

How to change text style based on state with xml?

StateListDrawables and <selector> are great for setting different drawables for each state of a view, but is there a way to tie in what text style that view should use for each of those states? For example, if you had a button that was white with black text, and when clicked, the button color became black, you would want your text color...

Creating an image and rending into a ImageButton in android

I use the following code with the intention to create an image that's half white and half black and put it on a button. What's wrong with my code? (latter we want to use a more complicated logic about what pixels are white and what are black but it should still be black and white) int height = 100; int width = 100; quadratImage = Bitma...

Is it possible to create a custom state for use in a StateListDrawable?

They have states for things like pressed, focused, disabled, but is it possible to create custom states so it could reflect some of my own custom criteria? For example, say you have a list of names. Some people fall into a certain category that should be visually represented differently. These people's rows would then have a different ...

Android Click on listItem checks wrong checkbox

Hello, I've created a custom ListView by extending SimpleCursorAdapter. The result is IMAGE + CheckedTextView (Text + Checkbox). When I long click an Item, everything works fine - I get the right ID and details of the clicked Item. The problem occurs when I try to mark an Item as checked but it checks the wrong checkbox. For example:...

How many queries are required to get the names and numbers of everyone in an Android contact group?

Using the Android 2.0 ContactsContract API, is it possible to build a list of objects representing contacts in a Contact Group like this: public class GroupContact { public String displayName; public List<String> phoneNumbers; } While making fewer than O(n) SQL queries? ...

How to use the Android Intent.createChooser()?

I am trying to use the chooser so I don't have to create a selector-dialog. Maybe it is the wrong construct or widget to be using. What is happening is that the list of intents that I supply are inserted into a chooser dialog, but so are all the other applications on my device. Then if I use the back-button, the application "finishes....

Android hide soft keyboard IME

Below is a bit of code that I managed to get to work to hide the soft keyboard on android. It works by the user clicking anywhere on the screen (outside of a EditText input/s) to hide the IME soft keyboard. It registers a OnTouchListener to the ScrollView (id="@+id/sv_background) which when the screen is touched it hides the IME soft key...

How to get reference to a Button created in a custom Dialog, using a xml layout?

Hi, I have an Activity in which user can update a specific information clicking in a button near a label. This buttons than triggers a Dialog where I have some fields to get user input and a button to finish editing. My problem is that I am not able to get a reference to the button declare in the dialog specific xml layout. The button...