android

Android - Where to start

I love to build applications for mobile phones. Hope Android is one good platform to fulfill. Please guide me with all the necessary stuffs needed. ...

Using Google Map Data API on the Android platform.

Hey Everyone, I was checking out the Google Maps Data API and I was wondering if I can follow their Java Development guide to use it on the Android platform? I want to display routes that I have created on Google Maps on the phone. Ideally this would be through a MapView but if I need to do it a different way I could. Thanks, Rob ED...

Android Web Dev - Intercept button press?

Not really sure if this can be done, but is there any way (on an Android device) to intercept in the browser (via JS) when the center button has been pressed? Is a keyup event thrown? Is there a proprietary API? I did some Googling but couldn't come up with anything. Thanks all ...

ClassCastException while using service

I defined a local Service: public class ComService extends Service implements IComService { private IBinder binder = new ComServiceBinder(); public class ComServiceBinder extends Binder implements IComService.IServiceBinder { public IComService getService() { return ComService.this; } } publ...

Emulating Preference look/feel with LinearLayout

I really like the look and feel of the Preference UI items and want to replicate that in my application. Basically I've got an Activity with a couple LinearLayouts set to be focusable. When they are focused, I want them to turn green (like Preferences do). Any idea how to apply that style to my LinearLayouts? Note: The LinearLayouts ...

Nested preference screens lose theming

I have a preference screen for my application and in the manifest I have given it a theme using: android:theme="@android:style/Theme.Light.WallpaperSettings" However when I nest another preference screen inside this one such as: <?xml version="1.0" encoding="utf-8"?> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res...

Setting an ImageView resource as a Drawable.

Hey Everyone, I am trying to create a drawable in code and change the color based on some criteria. When I try and set the Drawable as the background of the ImageView it displays but won't let me set any padding. I realized I need to set the ImageView image via the setImageDrawable() function in order to be able to set the padding. T...

Getting GPS data?

Inside public class IAmHere extends Activity implements LocationListener { i have @Override public void onLocationChanged(Location location) { // TODO Auto-generated method stub } @Override public void onProviderDisabled(String provider) { // TODO Auto-generated method stub } @Override public void onProviderEnabled(Strin...

Port Android App to Desktop?

I'm just wondering if it would be possible (and legal) to port an Android app to desktop? I'm creating an android game that would work well on PC too (even with the cellphone like layout) and was thinking that maybe I could 'embed' an android emulator with an installer or would that process be a bit hard for a novice Java coder? ...

Android - Hide all showed Toast Messages

I have a problem, how do I disable all toast messages being process currently? In my App, there is a list, when a user clicks on an item, a toast message is being displayed, 10 items - 10 toast messages, so if the user clicks 10 times, then presses the menu button... he has to wait for some seconds, until he's able to read the menu opt...

Prevent Activity from saving state when user selects back button

I have an Activity with a list that is bound to a ListAdapter reading data into a ArrayList from a database. All is well when the data is first loaded. While the Activity is open and the list is being displayed it is possible and likely that the data in the database will be updated by a service but the list does not reflect the changes b...

Copying Android source code directory from one computer to an other one

I have downloaded the Android source code on my computer using the repo sync command. Since I have no experience with git and repo , I would like to know if it is possible to copy the mydroid directory (which contains Android source code) to an other computer by just burning it on a DVD and then processing the build without problems. Th...

Runtime exception when creating Bundle in JUnit test

I'm testing some Java code that uses an android Bundle, and am getting a runtime exception whenever I create a Bundle in the unit test. The error I'm getting is java.lang.runtimeException at android.os.Bundle when I create the Bundle. It is running with the android SDK in the run configuration. Has anyone run into this problem before? Th...

Android: 2D. OpenGl or android.graphics?

I'm working with my friend on our first Android game. Basic idea is that every frame of the game the whole surface is redrawn (1 large bitmap) in 2 steps: Background with some static image (PNG) wipes out previous frame Then it is sprinkled all over with large number of particles which produces effect of soapy bubbles where there's a p...

Can I use android.os.* libraries in a standalone project?

I'm trying to develop an external library (not sure if that's the right term) to provide prepackaged functionality in Android projects. Working in Eclipse, I've added the appropriate android.jar file to the build path, and everything is happy both while editing and upon compilation. However, when I use Android's Handler and Message clas...

What is the purpose of both target API and minSDK

Can somebody explain to me the difference between the project target and the minimum SDK? I want my app to run on Donut devices, and the APK I built with a target of 7 worked just fine. When I set an explicit minimum SDK in the Android manifest of 4 (1.6) the compiler bitched at me that the target exceeded the minimum. I reset the target...

How to cache and store objects and set an expire policy in android?

I have an app fetch data from internet, for better performance and bandwidth, I need to implement a cache layer. There are two different data coming from the internet, one is changing every one hour and another one does not change basically. So for the first type of data, I need to implement an expire policy to make it self deleted afte...

Dim Window when Menu opened in Android

In Android, when an alert appears, the background is dimmed. I would like a similar effect for when the menu is opened. I tried the following code, but it didn't work: @Override public boolean onMenuOpened(int featureId, Menu m) { boolean ret=super.onMenuOpened(featureId,m); getWindow().addFlags(WindowManager.LayoutParams.FLAG_D...

How to fix IllegalStateException error when trying to update a listview?

Hi guys, I am trying to get this code to run, but I get an IllegalStateException when I run this code saying that the content of the listview wasn't notified, yet I have a notification upon updating the data. This is a custom listview adapter. Here is the relevant part of my code: class LoadingThread extends Thread { public void r...

How to center viewport at center of the sphere

I want to create panorama view with opengl in Android. Is it possible using spherical view and centering viewpoint at the sphere center to show bounded image on screen? Will this be a good aproach? I haven't used opengl but want to achive this effect in Android. Am I going in right direction? Any pointers for this will be great help. Th...