cupcake

How do I create an auto-run Dialog themed Activity in Android 1.5 (Cupcake)?

In the onCreate() of my "main" class I'm checking some things and occasionally need to show a popup. The popup is just another Activity which has been themed as @android:style/Theme.Dialog in the Manifest file. This has worked perfectly for months, but now that I'm on Cupcake it's basically just drawing the screen as all black. Here's ...

Preventing application/screen timeout Android

Hello I have an Android (1.5) application which needs to be constantly running when a button is pressed. So, when a button is pressed I would like the phone to remain on and not want the screen or CPU to time-out. When another button is pressed I would like the phone to be back to normal and time-out as per user settings. Thanks ...

Using a wakelock in a service Android 1.5

Hello I am trying to use a service to control a wakelock so I can permanently leave the screen on when my application is running. I create the wakelock and activate it in onCreate() and release it in onDestroy() however I get the error "wl cannot be resolved". Can someone explain how I can get over this? Code below: public class WakeLoc...

Android wake lock force close

Hello I am trying to implement a wake lock for an application. PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK, "My Tag"); It seems to force close when defining the PowerManager shown in the code above. Whats going wrong? ...

Android Trial Applications

Hello, I have a application which I want to hit the market as a Paid app. I would like to have other version which would be a "trial" version with a time limit of say, 5 days? How can I go about doing this? Thanks. ...

Killing android application on pause

Hello. I have an application which I would like to be fully disabled/closed when it is paused (IE. When the user presses the Home, End (call) and Back button I would like the application to be closed, instead of being saved in the history stack). How do I do this....? Thanks. ...

How to programmatically enable GPS in Android Cupcake

I'm currently writing an app in Android that works with the GPS, at the moment I'm able to work out whether the GPS is enabled, my problem is that I want to enable the GPS on app startup if it is disabled, how can I do this programmaticaly? ...

Android Application and Timers

Hello I have an android application which has a service running. After 20 mins from that service and other systems (such as GPS) starting I would like it to automaticly stop. I assume I need to use a Timer for that? Can someone show an example of how I could do it? ...

Android AlarmManager

Can someone please show me some sample code on how to use an AlarmManager in android. I have been playing around with some code for a few days and it just won't work... I need to trigger a block of code after 20 minutes from the AlarmManager being set. Thanks. ...

Does anyone know whether the Android addProximityAlert on the LocationManager is battery intensive.

I just basically want to add about 20 and sometimes 80 Proximity Alerts with no time expiration with a radius of around 500 meters. Just wondering whether by doing this will suck up the battery real quick? also would it make any difference by reducing the radius? ...

Android Screen Timeout

Hello all. I know its possible to use a wakelock to hold the screen, cpu, ect on but how can I programmatically change the "Screen Timeout" setting on an Android phone. ...

Cake Comparison Algorithm

This is literally about comparing cakes. My friend is having a cupcake party with the goal of determining the best cupcakery in Manhattan. Actually, it's much more ambitious than that. Read on. There are 27 bakeries, and 19 people attending (with maybe one or two no-shows). There will be 4 cupcakes from each bakery, if possible incl...

How to time-bomb an Android application?

Hello does anyone have a code example of how I can time bomb an Android application so It will not work after a given date? I would like to release a "beta" application for testing but would like to make sure it will only work while I have the application officially in beta. Thanks. ...

Android animated GIF (Cupcake)

I've used animated GIFs in Android pre cupcake however my old code no longer works. To be exact: Movie.decodeStream Always returns null... Does anyone have any workarounds/fixes to play animated GIFs? ...

AlertDialog MultiChoiceItems Listener problems.

I am currently using the AlertDialog.builder to create a multichoice list for the user (checkboxes). This works great, except we want one of the buttons to deselect all of the others in the list. builder.setMultiChoiceItems(list, checked, new DialogInterface.OnMultiChoiceClickListener() { public void onClick(DialogInterface dialo...

Possible to only load specific lines of code according to Android OS version?

Is there a simple line of code that would allow only loading the code if the OS version meets the requirements? Lets say I have my target OS as 2.2 but the min sdk is 3 for android 1.5 so even if i have some code in my project that isn't compatable with 1.5 it will still compile since the target OS is 2.2. Anyway, I want to ad a featur...

How to Ignore certain methods and code in a Class? Based on SDK

I was reading over http://android-developers.blogspot.com/2009/04/backward-compatibility-for-android.html But I'm really not grasping how to ignore certain lines of code. I have this Activity (posted below) and it's a simple webview. However, I want to have geolocation enabled(even if it is only for 2.0 and up phones), since these method...

Cupcake(API3) friendly way to pause/stop sound loops in SoundPool? Any ideas?

Quick note: I'm using the SoundPool class http://developer.android.com/reference/android/media/SoundPool.html What I have here is a simple button that plays a looped sound while it's pressed. It works great. However, sounds.autoPause(); wasn't introduced until API 8 and I really need something that is cupcake compatible (API 3) So i wa...

Using reflection in android for backwards compatability

I was reading over at the android dev website about using reflections. But I'm really not grasping how to use it. I need this java file to run on a 1.5(SDK3) device but just ignore the new code and work fine on a 2.0(SDK5) and up phone. I have this Activity (posted below) and it's a simple webview. However, I want to have geolocation ena...

Trying to make a Adapter class to choose .Java file depending on firmware version

What I did was create two .java files. One that can compile and run on a 1.5 phone (SDK3) and then one that works on 2.0(SDK5) So for this example i'll call the 1.5 file ExampleOld and the new one Example. I was wondering if i just made activity like this if it would work sort of like a "portal" and pick the activity to load depending on...