android

Why does not this work - Android - onCreate()

The following code does not work, and throws a RuntimeException caused by NullPointerException public class ListFilteredActivity extends Activity { LinearLayout typeSelector = new LinearLayout(this) ; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ScrollView...

Android String Array Manipulation

I have a lengthy string in my Android program. What I need is, I need to split each word of that string and copy that each word to a new String Array. For eg: If the string is "I did android program" and the string array is named my_array then each index should contain values like: my_array[0] = I my_array[1] = did my_array[2] = Android...

Storage of Static data within android app

I am currently developing a simple info app on various uni campuses. I want the app to operate predominantly in an offline state thus I want to store all my information locally. The data within the app will not be subject to any change thus I was wondering what the best (practice) method was to store such data? Basically should I be sto...

Android: IllegalStateException - When is it thrown?

In my application, sometimes the following exception is thrown: 07-28 14:49:25.398: ERROR/AndroidRuntime(8097): java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread. ...

Android 2.1 & HTC Desire: Is there a bluetooth problem? (CorruptedStreamException)

I made an application that is using Android SDK 2.1. This application uses bluetooth to connect to multiple devices. I have 3 HTC Dreams (Google G1) as test devices. The application is running really fine on them. They are rooted and Android 2.1 is running on them. If I join with my HTC Desire (Android 2.1 Update 1), the streams that r...

[Android] Running activity in hidden(stealth mode).

Please can anyone give me links or code or concept for Running an activity in hidden mode.. That is, it has to run in background without disturbing the user.. It should not display any window or layout. ...

Adding TextViews to a TableLayout "stackable"

Ok, my problem is, I have got n-TextViews and they will be added programmatically into a TableLayout. It totally doesnt matter, how I style these TextViews or the TableLayout, everytime I add something, it adds the TextView on the bottom after the other TextViews. These Views have got a variable width, which is calculated out of their te...

Android special directories

I see that as of API Level 8, you can request a handle to special directories with Environment.getExternalStoragePublicDirectory. This takes a type such as DIRECTORY_MUSIC, DIRECTORY_PICTURES, etc. I'm looking for an equivalent directory for other media types such as documents (Word docs, PDFs, etc.). My HTC Desire has a "/sdcard/My Doc...

[Andriod] How to autorun an application when the Phone is switched ON.

hi.. Can anyone please give me code or links or concept for running an android application on android device automatically.. whenever the device is switched on, application should start on its own, with out the interference of the user. Thank you.. ...

Insert word in User Dictinary for all input methods (both android and htc)

Hi guys, i need to insert words into t9 dictionary. I'm able to insert in default content provider with the addWord method [addWord method][1] My problem is that htc-ime (and probably other input methods) use differents content provider then added word in the default content provider are not recognized. Any solution for this? [1]: ht...

recursive + 900 elements + neighbor check = causes stackoverflow

Hi, I have a city simulation game and try to find a way to check the flow of our power system. The basics: The map for the city is based on tiles (30 by 30 tiles = 900 tiles). Now i start at a power plant and do a recursive neighbor check (top, left, right, bottom) to check if there is something that will transport the power. If there i...

How to parse XML (Fogbugz XML API)?

I am creating an Android application that connects to the Fogbugz XML API (sends a request to the API, receives back an XML file). Right now, I am creating a service that will handle these requests, and parse each in order to access usable information. What would be the best way to do this? If I am getting an inputStream, should I use th...

Underlying technique of Android's FaceDetector

I'm implementing a face tracker on Android, and as a literature study, would like to identify the underlying technique of Android's FaceDetector. A brief Google search didn't yield anything informative, so I thought I'd take a look at the code. By looking at the Java source code, FaceDetector.java, there isn't much to be learned: FaceD...

Retrieve Permissions list

Hi all, I'm trying to retrieve the permissions of the apps in my device. The weird thing is, for some apps I do get results, and in some of them I can't retrieve any permissions. Maybe in order to get the permissions list of an app, the app has to set some specific flag? Because if I try to get the permission list of my app in this wa...

Instantiating activities into new tasks and processes

I have an application with a multi-instance activity. I would like each instance of the activity to appear in a new task and process. Any suggestions on how to do this? By manipulating the manifest I can cause all instances of the activity to appear in a specific task and process, but I haven't found any way to cause each instance to ap...

Object Oriented scope and inheritance in Android activity classes

I'm still very new to Object Oriented programming and am having problems with the class inheritance and the scope of variables from one instantiated class to another. I'm trying to build an android application that can read multiple XML feeds and save them to the phone's SQLite database. Each feed has a different name ("news", "audio_mi...

How to obtain the android_id of a device?

In the licensing documentation the android developers mention an easy way to more or less securely identify an android device. They are using android.Settings.Secure.ANDROID_ID. They say they query the system settings for this. But they don't explain this any further. How do I obtain the android_id and do I need special permissions fo...

EditText wont display above ListView

Hi, I have a ListView activity and I want an EditText (and ultimately a button along with it) to display above it. I believe my xml is fine, but for some reason the EditText is not displaying. The ListView takes up the entire screen :( Here's what my XML looks like: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=...

How to create a transparent Activity programmatically?

I want to launch an Activity with a webView as its content from current Activity. This new activity needs to be transparent and webview should be in the center. I looked around the web but only solutions I found were using style xmls. I want to do it using pure code i.e. no xml declarations. if anybody has come across this then please sh...

Android: Tweetie Style List Refresh

I've come from iPhone background and am writing an android app. I've got a list which is cached locally, but primary is stored on the our webserver as the app is an interface to our service. What I really want is a simple way for the user to refresh the list. So I'm trying to replicate the tweetie pulldown to refresh list. Does anybod...