android

Spoofing Location

I've got an application in the browser that's customized to use Android's browser geolocation APIs. I'd like to find a way to fake the lat/lng that's sent to the browser so I can type in arbitrary coordinates. In doing some research I came across DDMS - http://developer.android.com/guide/developing/tools/ddms.html - which seems to do wh...

Insert more stuff in an XML loaded Layout.

Hi! I'm using setContentView(R.layout.somelayout); to load an XML to my activity. On this layout, there is a FrameLayout, I want to insert more objects in it dynamically, as an example, more Button Objects. I haven't found some getCurrentView() method yet... So, how can I get the current Layout from the activity? ...

Example using build number in version string when building Android project via ant ?

We are using Hudson to automate our Android build. I need to incorporate the build number into the version string used in our app. Was wondering if anyone had an example of doing that before I (re?)invent that wheel. Obviously I need to replace a string value in one of our config files. ...

Saving cursor state with activity instance?

I've got an android app that pulls a random 20 questions (rows) as a cursor from a SQLite DB and loops through all the questions to ask the user all 20 questions. Is there some way to save the cursor's state/location when the activity is paused or stopped so that when the activity resumes the cursor is restored and in the same position ...

How to bring up list of available notification sounds on Android

I'm creating notifications in my Android application, and would like to have an option in my preferences to set what sound is used for the notification. I know that in the Settings application you can choose a default notification sound from a list. Where does that list come from, and is there a way for me to display the same list in my ...

Getting a gestureoverlayview

I have been using some nice tutorials on drawing graphics on my android. I wanted to also add in the cool gesture demo found here: http://developer.android.com/resources/articles/gestures.html That takes these lines of code: GestureOverlayView gestures = (GestureOverlayView) findViewById(R.id.gestures); gestures.addOnGesturePerformed...

How to maintain the position of ListView

Hi, How can I maintain the position of my ListView in my activity when I go to another activity (by launching another intent) and then come back (press the back button)? Thank you. ...

change background of an ImageView (the old image stays there!)

how can I change the background of an ImageView from java? I have an ImageView and at a certain point I need to change the image that it displays (set in the styles). I tried to do it like this: placeHolder.setImageDrawable(myDrawb); but it looks like the old image remains there and it is partially covered but the new one (which in my...

Creating a C++ static lib to use with Java on Android

I have some C++ code that I want to make into a static lib for use with Java on the Android platform. Can anyone point me to a resource that tells me how to do this? I am completely new to Java and Android. ...

Does apps that play on the word Droid need to worry about Lucasfilm's Trademark?

I've noticed in recent ads that the Verizon Droid and Droid Eris have to put up acknowledgement on Lucasfilm's trademark of the word "Droid", and had to pay licensing fees to use it. I'm wondering if an app I'm building that uses the word Droid in the naming is violating said trademark. I've noticed other apps that do it (Twitdroid), an...

using XMPP for user location

Hi, I want to create an application for Android that enables me to get the geolocation of a user. This has to be made as a client-server app and for the server side I'm using OpenFire. For getting the user's location I would have to use XEP-0080, right? And SmackAPI also? I'm completely new to XMPP and Smack, so if anyone could get me a...

Custom color for the section box displayed on a ListView with fast scrolling enabled in Android

I have an adapter that implements the SectionIndexer interface in order to display the box that indicate the letter of the section when the user scroll my listview (like when you scroll a contact list). It works well but i need to customize the background and the text color of this box. Any advice? ...

Why is my Android app camera preview running out of memory on my AVD?

I have yet to try this on an actual device, but expect similar results. Anyway, long story short, whenever I run my app on the emulator, it crashes due to an out of memory exception. My code really is essentially the same as the camera preview API demo from google, which runs perfectly fine. The only file in the app (that I created/use...

How to correctly size containing views

I have an Activity that will display a custom view made up of 2 parts. I want one part to be 1/3 of visible screen height, the other part to be 2/3. I can override onMeasure and use display metrics to find the height of the display, but this does not account for the battery bar or view title sizes. DisplayMetrics dm = new DisplayMetri...

Porting a C++ application to android

Is it possible to port a C++ application which uses the STL extensively to Android? I understand that currently the NDK does not support this, but is there any effort (open source or otherwise) underway to achieve this? If not is there a way to cross compile libstdc++ for Android? ...

Android TextView formating.

Hey Everyone, I am trying to implement a TextView that is serving as a header for a ListView. I want to format it so that I have basically a title centered on the first line and then additional information on the lines following. How can I format the text/string to create this kind of formatting? Thanks, Rob ...

Overlap problem with Android ListView selector

I am trying to style my ListView with two 9-patch background images (16px * 9px), one dark image for default state and another green image for selected and pressed state. It works except for just one problem that when I select or press one list item, it seems that the selected item overlap the next one a little bit as I can see some pi...

Display custom title bar for Android with XML

In Android documentation describing "Configuring General Window Properties", it is suggested that specifying properties via XML is preferable whenever possible to avoid seeing the title bar flash. As an example, instead of setting Window.FEATURE_NO_TITLE with requestWindowFeature, they set it to @android:style/Theme.NoTitleBar. Is there ...

Android source referencing missing classes

I cloned some of the trees from the Android Open Source Project to take a look at the code, but I can't build them because they reference classes which don't seem to exist. For instance, the music application here references android.media.MediaFile which according to the package summary does not exist, as well as things like ArrayListCu...

Android: Changing LinearLayout in a widget.

Hello all, I have this really annoying problem: In my widget, i would like to change the background by code. I noticed on the Google doc than I can easily change the background of an Imageview: remoteViews.setImageViewResource(R.id.my_iv, R.drawable.my_bg); Ok, too easy, i want to change now the Linear layout.. What I read about the ...