android

Android - View setText from SharedPreference Value using XML

Hello, I've chosen the path to have each Activity implement a onSharedPreferenceChangedListener. In order for a service to update values to be sent back to several Activities at once (it doesn't care which one has the focus) When the Listener is called, I only have the key. I then have to perform a lookup of that key to get the corresp...

Light sensor on Nexus One returns only two distinct values

I´m trying to read the values of the Light Sensor of my Nexus One, but I´mgetting only following values: 10.0 225.0 and in a few cases some values much higher. The used code: sensorManager = (SensorManager) context .getSystemService(Context.SENSOR_SERVICE); sensor = sensorManager.getDefaultSensor(Sensor.TYPE_...

Android appication is not running when mainout.xml created

Hi every one in my Android application the file with name "mainout.xml" is creating, where ever this file created the application is not running. any one know how to solve this problem?? Thanks. ...

How to navigate one Gallery/ViewFlipper from another?

I am trying to use one gallery on fill parent and one with a specific height over the first one. I want the second one to be something like a menu for the first and when you click on any of the items in it the big one will change to that item too. I tried using gallery and ViewFlipper but I can change the position of the ViewFlipper o...

How to install Google Voice Action on emulator

Ho do I install the new Google Voice Actions on the emulator? Android Market is not available on emulator. I found one APK at android.modaco.com, but it's not working. The application crashes with following error (via ddms.bat): 08-13 22:44:51.658: ERROR/AndroidRuntime(434): FATAL EXCEPTION: main 08-13 22:44:51.658: ERROR/AndroidRunti...

AutoCompleteTextView doesn't show dropdown

Hello! I extend AutoCompleteTextView and override preformFiltering function in order to get results from database. I'm getting the results but then nothing is shown. And getView in custom adapter is never called. The strange thing that If I preload items (inside init() function) I can see them... May by anyone can point me to the right...

Android Notification intent to clear it self

Hello, I have read many examples of how to create notification messages. What i wanted to achieve, is because the notification will be executed by a widget, i would like the notification intent when clicked to clear it self when the user clicks on it.I do not have an activity to return to. The notification for my purposes will just plain...

App crashes after receving phone call

After I either receive a phone call or make one, (and other undocumented interruptions) my application gets a NullPointerException when resuming my activity. Can any explain to me where it is and/or how to fix it? When my activity resumes, it is calling onCreate it seems, and it is trying to execute something that is null after Resuming....

Getting SharedPreference From XML

Hello, I am having problems finding a way to populate a TextView with the value of a SharedPreference using XML. Is there a way to reference the preference like a string resource. Something like TextView android:text="@preference/name" ...

Small architecture question

I have a ListActivity which lists a bunch of "things." If you click on one of these "things," you're taken to another ListActivity which lists a bunch of "stuff" for that "thing." Say I want to give the user the ability to edit the name of some of the "stuff"; or even delete some of the "stuff." At what point should I actually perform...

Identical FTPClient code, one works one doesn't

I have an AIDL-accesible service that downloads files via FTP, and uses FTPClient to obtain the file stream. The service obtains the host path and the file path and FTPClient.getFileStream() returns a fileStream for some files I have tested that are around 1MB in size. However for large files, the getFileStream returns null, and THROWS a...

How to nicely scale a background image of a TextView for Android

Hi stackies, I'm battleing with extending a TextView for my Android app. I'd like to create "bubbles" to display text messages in a conversation, similar to the native iPhone SMS conversations. Is there a way to implement the resizing of a background image without just stretching it? I'd like to have a single background image that kee...

Write problem on android application

Below is the code to write to a file after downloading an image from the web. But somehow, it's just stuck while writing to File Stream. No Exception at all. It just stays on while loop then displays force close popup. it happens 2 or 3 out of 10. private void saveImage(String fullPath) { File imgFile = new File(fullPath); try { ...

Is it possible to get the HTML code from WebView

I would like to preemptively get the HTML code of a webpage that is to be loaded in a webView, parse it using regex, and display only the HTML code that I want, while letting the webpage still think it has loaded everything. Is there any way to do that in the WebViewClient.onLoadResource() or similar methods? EDIT: I tried this: clas...

Android Force Mount USB Storage when SD card is formatted to HFS+

I'm not exactly sure if this is the best place for this topic but here goes.. I've reformatted my Android SD card (16GB) to HFS+ format, and pushed a Mac OS X 10.6 boot image (from a .dmg file) onto the card. I did this because I don't want to go out and buy a DL DVD-R to reinstall my operating system, and because it's a nice little exp...

Can not call getApplicationContext() inside a thread.

Hello all, I am developing an application on Android Froyo system, everything is fine, except that when I create a service, and the service will spawn several thread. In one of the thread, I want to stop the service. Apparently stopService() is out of scope in the thread class, and so is the getApplicationContext() calls. So inside a th...

Database seems to disappear after my application downloads it. Ideas?

One of my applications downloads a database from a server. When I install the application onto my phone, it downloads the file correctly and loads the information, no exceptions thrown or anything. However, when I upload the apk into the Android Market Place and download it onto the phone, the application downloads the database and then...

Registering my broadcast receiver to run when an app is launched?

I want to run some code when an app is launched, so my broadcast receiver has to be notified when user open any app. Is there any way to do it? ...

How do you install an APK file in the Android simulator?

I finally managed to obfuscate my android app, now I want to test it by installing the apk file and running it on the simulator. Does anybody know how I can install an apk file on the Android simulator? Thanks ...

Trying to UNINSTALL_SHORTCUT but shortcut won't go away

I created a test Activity that installs a shortcut of itself on the Android Home screen. When you click a button, the Activity is supposed to remove the same shortcut it just created. However, nothing I do seems to delete the shortcut. Here is the Java code (ShortcutTest.java): import java.net.URISyntaxException; import android.app.A...