android

Force close message when preferences are called via menu button

I see no problem in the code. Help? preferences.xml <?xml version="1.0" encoding="utf-8"?> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"&gt; <ListPreference android:title="Gender" android:summary="Are you male or female?" android:key="genderPref" android:defaultValue="male" android:entries="@array/gende...

Eclipse - Force Refresh of IDs

I'm using eclipse for Android development, and the editor always seems to take a while to actually update and recognize if I change an ID in a layout, then try to use it in a class with R.id.someId. Is there a way to force a refresh? ...

Call .NET Webservice with Android

Hi, I know this question has been asked here before, but I don't think those answers were adequate for my needs. We have a SOAP webservice that is used for an iPhone application, but it is possible that we need an Android specific version or a proxy of the service, so we have the option to go with either SOAP or JSON. I have a few conc...

Android GPS timeout

Edit: I'm rewriting this question because I apparently wasn't clear. Sometimes the GPS service on Android phones takes a long time to get a fix. Sometimes it's fast, sometimes it takes hours. I know and accept this. I have an application that does many things. One of the things it must do is allow the user to click a button to send the...

How to get the number of unread gmail mails (on android)

I've been trying to get the number of unread gmail mails with no luck. I've read Gmail.java and gmail4j both links taken out of this site from this question: Android - How can I find out how many unread email the user has? But still after having read all of that and a couple of other sites that talked about this particular subject my q...

How to persist options selected in AlertDialog spawned from ItemizedOverlay onTap method

In the description of how to add a list of options to an AlertDialog the official Android documentation alludes to saving a users preferences with one of the "data storage techniques." The examples assume the AlertDialog has been spawned within an Activity class. In my case I've created a class that extends ItemizedOverlay. This class ...

Android Activity call another Activity method

Hello, A TabActivity start other activity when i click on a tab, How to send information to parent (tabActivity) and don't finish current activity? My tabactivity start another activity like this : mTabHost.addTab( mTabHost.newTabSpec(TAB_OPTIONS) .setIndicator(TabImgFond5) .setContent(intentOptions)); Inside my n...

UI Design Tips and Tutorials for Android

Does anyone have any good pointers on designing the UI for an android application and some good practises? Obviously I'm aware of the basic principles involved with designing the layout in XML. Also, that you have a stack of activities. But I'm interested in some approaches to creating the interfaces and also how to design an applicat...

How to set an alarm to fire properly at fixed time?

I have this code Calendar c = new GregorianCalendar(); c.add(Calendar.DAY_OF_YEAR, 1); c.set(Calendar.HOUR_OF_DAY, 23); c.set(Calendar.MINUTE, 22); c.set(Calendar.SECOND, 0); c.set(Calendar.MILLISECOND, 0); // We want the alarm to go off 30 seconds from now. long firstTime = Syste...

A non-ugly way to persist dialog contents across orientation changes?

So I have a managed AlertDialog with a number of EditTexts & separate portrait + landscape layouts. The user opens the dialog in portrait mode, enters some text and then all of a sudden decides to pop out the keyboard. Now, I need to remove the dialog and recreate it for the changed layout persisting the text entered. What I can think of...

Is there a way to distribute content for an application on the android market?

Does the android market support distribution of content packages? Is there any way a dependency structure can be created so that to obtain a content package for the app depends on the app to be installed as well? ...

Android - Linkify Problem

I seem to be having trouble with the linkify I am using in my Custom Adapter. For some reason I recieve the following stack track when I click on one of the links: 06-07 20:49:34.696: ERROR/AndroidRuntime(813): Uncaught handler: thread main exiting due to uncaught exception 06-07 20:49:34.745: ERROR/AndroidRuntime(813): android.util.An...

Android: How to create an onclick event for a SimpleCursorAdapter?

I have this code: db=(new DatabaseHelper(this)).getWritableDatabase(); constantsCursor=db.rawQuery("SELECT _ID, title, subtitle, image "+ "FROM news ORDER BY title", null); ListAdapter adapter=new SimpleCu...

Android WakeLock and KeyGuard

Hi! I'm just wondering if I do this correctly; I'm programming a notification app which can display a notification when the phone is sleeping Disable keyguard lock Aquire a wake lock show notification Set alarm for timeout and reenabling keyguard and release wakelock is the user dont touches the screen. 4.1 User touches the screen, a...

How do i run the Android command line tools?

I'm still pretty new to Android and programming in general, and I can't seem to get the command line tools packaged with the Android SDK to work. I'm running Mac OSX and each time I try to run layoutopt, for example, the terminal returns, *-bash: cmd: command not found * Also, is it okay to have my SDK located in the Developer directory...

I get java.lang.NullPointerException when trying to get the contents of the database in Android

I am using 8 EditText boxes from the NewCard.xml from which i am taking the values and when the save button is pressed i am storing the values into a database, in the same process of saving i am trying to get the values and present them into 8 different TextView boxes on the main.xml file and when i press the button i get an FC from the ...

Android: emulator's lauch options doesn't work in Eclipse plugin?

I need to change the emulator's default time zone. It worked in command line with -timezone option. But when I tried it in eclipse android's launch options. it didn't work. I set it in Window->preferences->android->launch->default emulator options. Am I setting it in a wrong place? ...

Use android.app.Service and SensorEventListener while screen is off (Android 2.1)

Hi: I'm using Android 2.1 on a HTC Nexus One. I want to collect sensor data while the device is turned off. By using android.app.Service this works well while the app is in the background but stops working when the display is turned off by the hardware button. Is there a possibility to collect sensor data while the display is turned of...

How to mock location during a presentation on a real device?

I've read this post about mocking location with custom provider, but I am looking for a way to mock the location during a presentation, is that possible? ...

How to enumerate strings in a string resources file ?

Hi all I have a resources file called string.xml in res/valus directory the file has many string resources how can I obtain these items in an array from code ? I tried Field[] x=R.string.class.getFields(); but it does not work. thanks ...