android

Updating Button background for a brief time in Android (higlight it)

Hi, I have a button and I want to highlight it for a brief time. For e.g. it's a red button and it should be orange for a second and then turn red again. My code for this looks like the following: button.setBackgroundResource(R.color.orange); //highlight value button.invalidate(); try { Thread.sleep(3000...

How to close another app in Android?

Hello all, I have been developing an app, and I need to close another app in my code. Does anyone know any api to call to close an app? BTW: my app will be pre-installed. thanks ...

Android Activity Testing Example Has Confusing OnPause Expectations

I'm trying to understand the Activity Testing tutorial on the Android site. One of the tests sets a spinner in the SpinnerActivity example, forces a pause, then resets the spinner, forces a resume, and then verifies that the application properly restored the state. I pasted the relevant code at the bottom of this question for reference...

Animating background in Android ?

In Android, is it possible to have a background that is repeated on the background of a view? Is it possible to apply a translation animation to that background? ...

How would you write a library to be used on android?

I've already written a game engine in java using eclipse and opengl es, I had one project (an android project) which contained both of my packages com.logic.engine com.logic.testapp I wanted a way to keep my engine and test app seperate, I've made an earlier post about how this is done, and I figured out how to reference one project in...

Event Handling [Android]

I wrote simple Application for Android: public class Figures extends Activity { DemoView demoview; int figure_type = 1; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //setContentView(R.layout.main); ...

How to get the Access Point Name in Android?

Hi, I would like to know, how do we get the access point name from an Android Phone. Thanks, Sana. EDIT: WifiManager mWiFiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE); WifiInfo w = mWiFiManager.getConnectionInfo(); Toast.makeText(this, "APN Name = "+w.getSSID(), Toast.LENGTH_SHORT).show(); The above code snippet i...

Programmatically clear browser cache/history

Hello, During my activity I'm sending an intent to the browser in order to display a webpage : Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("http://ww.mywebpage.com"); startActivity(i); I need to make sure that before sending the intent the browser cache and history are cleared so that the page get loaded from server ...

Pulling images from Web

I'm using the following code to grab images from the web. It uses Gridview and depending on position, picks a URL from an array. It works but the loading of images is often hit or miss. Almost every time I start the app, a different number of images load. It also has issues when changing from portrait to landscape view, 5 out of 10 imag...

Android: How to start an activity at a specified time?

I'm making an alarm clock of sorts, and I was wondering what the best way to start an activity at a certain time would be. Would it be using the broadcast service or... ...

SecurityException: caller uid XXXX is different than the authenticator's uid

This is for the record only. I received the above exception when trying to implement Sample Sync Adapter application. I have seen numerous posts related to this issue but no satisfactory response. So I will jot down my solution here in case anyone else gets into the same issue. First, check the condition explained on this post http://lo...

How to change size of ListView rows

I have 2 ways of displaying ListView data. I have a class for each type of row. I do not create the rows in an xml layout. (Each row is derived from View and does custom drawing). When I switch from 1 type of row to another how do I get the ListView to layout properly with the correct row heights, and refresh? Is View.forceLayout() ...

Uri from FilePath

I am using the Gallery3D-Code but want it to only display images from a sub-folder on the SD, not all of the images that are stored on it. To do this, I tried to change public static final Uri STORAGE_URI = Images.Media.EXTERNAL_CONTENT_URI; to public static final Uri STORAGE_URI = Uri.fromFile(new File(ROOT_DIR));, where String ...

Problem with spinner on item selected

Hi, I have a problem with spinner. I am trying to create a spinner control which will do something on selection change. However I have noticed that when I call the Spinner.setOnItemSelectedListner() the inner onItemSelected() method gets called (even though no change has yet to have been made to the spinner). my code requires this metho...

Android Layout doesn't fit into contiguous rectangles.

I am a new Android developer, and though I have spent a LOT of time reading through the official developer guide/reference (as well has hours of guessing/checking), I'm still stumped about the best way to do my layout. I am creating a board game, and here is an image of the game board. On that board, the game pieces live on (and move be...

Starting an Android activity as a dialog without using a theme modifier

I want to start an activity as a dialog, which can be simply done by: <activity android:theme="@android:style/Theme.Dialog"> But I want to do control the dialog, so I've to do it programmatically. Basically I want to modify this property of dialog: mCanceledOnTouchOutside = true This will make the dialog cancel itself when touched ...

Android XML layouts: Eclipse spits out a cryptic error message

This is my first time making an app with XML layouts. In the past I have always dynamically generated my layouts at runtime, so don't worry, I am NOT an Android newbie. Still, this is my first time with static layouts. So what's this message all about? [2010-09-22 20:43:23 - Rockport] 'default' is not a best match for any device/loca...

ListPreference is throwing a strange null pointer exception

I have an app that obtains a list of available Calendars and displays them in the Spinner. I have checks to ensure that if the available Calendar list is empty, then ListPreference will still display "None available" in the Spinner. I am using the ListPreference to display the Spinner in the Preferences tab. Here is the preferences.xm...

Save an edited image to the SD card.

I'm opening an image from the gallery, resizing it, and attempting to save the resized version to the apps data file so I can grab it in future. My problem is I keep getting a FileNotFoundException when I try to write it with an input stream. This is the file it's trying to write too. "/mnt/sdcard/Android/data/foundcake.myslide/files/IM...

Sideways View with XML Android

Is there a way to display a View, such as a TextView sideways using the XML layout file? I know you can rotate the view using code in an activity, but is there a way just to do it with layout? ...