android

Alternatives to static variables in Android

I am using static Arrays and HashMaps to store some values in my AppWidgetProvider class. But they are becoming null when the process dies, so the widget does not work anymore. Are there any alternatives to using static members to store data for an AppWidgetProvider in Android? ...

Dynamic Context Menu options

Is it possible to create a dynamic context menu in android? What I mean is, for example, if I have a list of items, that can be in two states: "read" and "unread". I want to be able to bring up a context menu with an option of "Mark as Read" for the unread items, and "Mark as Unread" for the read items. So clicking on: > read > unread...

Android TitleBar / NavBar ?

I am not sure what the proper term is, but I am trying to add a "TitleBar" to the top of one of the windows in my App. Much like the Contacts App, I have several Tabs along the top of the screen. When you select an item from the list, it loads the next Activity, but that Activity no longer has the Tabs at the top of the screen. I don't...

Unable to import example projects from book (newbie question)

I am trying to import projects from a book "Beginning Android 2" but when I choose the root directory the "Finish" button is still grayed out. I've tried importing the project from scratch with no success, and I've also tried to create a template project with the same name and everything and then importing into that (Import existing proj...

Accessing android:installLocation manifest attribute

I'm trying to write an Android 2.2 app that will find installed apps that can be moved to the SD card. The permission to do this is encoded in the AndroidManifest.xml file as the root-level attribute "android:installLocation". PackageInfo seems to have an interface to everything but this attribute. I can open the installed apk and ext...

onclickView not working...runuithread solution?

hi..i m new to android....i m stuck at a point would really appreciate if ne1 cn help pls.. i m developing an pp which has grid of colored rectangles..made changing the background of textView..dere are 3 buttons which cause the backgroundcolor to change according to some algo..n 2 textview which show the current sts f game now the pr...

android expanded notification view

I have an app that puts the date in the status bar, but in order to make it look decent, I have to use two notifications. This causes it to use two expanded notifications when you pull down the status bar. Is there any way to get rid of one of the expanded views(or both of them)? ...

How to change sync settings through Android API?

Is there a way to change the sync settings of a Gmail account programmatically with an Android app? For instance, I'd like to enable/disable syncing of a Gmail account from my app, without the user having to do anything. I took a look at AccountManager, but that doesn't seem to be the right place to look. ...

Button click event not firing in second view of a viewflipper

I have a layout in xml that, when the user clicks a "next" button I inflate, populate with the next screen's data, and create and set the onclicklistener for an imagebutton in the new view. I then add this view to my main ViewFlipper and call showNext() on it. The view slides into place and the button is there but there are problems: ...

How to change ScrollView's position after touch?

I'm trying to make a ScrollView with a list of numbers in it that the user can select from. After the user touches and scrolls, after the finger is lifted I want the scroll to "snap" to the item in the middle of the ScrollView and give me the output. My ScrollView contains a vertical linear layout with TextView objects in it. The ScrollV...

Give my android app a widget option

My users are asking me to make one of my apps into a widget. Is there a way to ask if they want a widget in app and then add the widget to their home screen? I am having a tough time finding this on Google. Edit: Is there add a widget option to an existing app or do I have to have to write a whole new program? ...

Android - Service and Activity interaction

I want to create an app that contains a Service S and an Activity A. The Service S is responsible for preprocessing, such as preparing the data shown on the UI of the Activity A, before the Activity A gets invoked. I want to be able to invoke the Service S from outside the package, say from another Android app's Activity class B, do the...

Building a specific piece of Android platform?

Hi, I have been trying to build only the "/libcore" directory of the Android platform. When I try mmm libcore I end up with the following output: ============================================ PLATFORM_VERSION_CODENAME=REL PLATFORM_VERSION=2.1-update1 TARGET_PRODUCT=generic TARGET_BUILD_VARIANT=eng TARGET_SIMULATOR=false TARGET_BUILD_TY...

Android Webview : Display numberpad?

Hi all, I implemented a WebView in my android app displaying a web form. One of the fields ask for the user to manually enter his phone number (in case the phone does not allow extracting of phone number). Right now, the qwerty soft keyboard pops up when user selects the field. Is there a way I can have the numberpad display instead? ...

How to represent a Many-To-Many relationship in XML or other simple file format?

I have a list management appliaction that stores its data in a many-to-many relationship database. I.E. A note can be in any number of lists, and a list can have any number of notes. I also can export this data to and XML file and import it in another instance of my app for sharing lists between users. However, this is based on a lega...

Android Screen Density Compatibility on 1.5

Hi, I'm getting ready to release my first application the marketplace. It's being written for devices running Android 1.5 and above, however there aren't any specific folders for the three different screen densities (I think those came around in 1.6). Should I make these folders myself? Where should I put image resources for the differe...

How often to run getWritableDatabase() and getReadableDatabase()?

I'm writing a Service, a Content Provider, and multiple apps. The Service writes new data to the Content Provider's SQLite database every 5 minutes or so plus at user input, and is intended to run pretty much forever in the background. The app, when running, will display data pulled from the Content Provider, and will be refreshed whenev...

android] usage of activitymanager

hi, i have a quick question about the usage of activitymanager. i've looked at the source code and read through it and as expectedly, it gave info about how it worked. however, i am interested in at what place(s) in android OS uses this activity to actually manage activities. for example, when an activity starts, android will keep t...

include an APK in Android.mk

I'm writing a Android.mk to make a APK-A. and APK-A would use other classes defined in APK-B. I wonder that how should I wrote the Android.mk to include APK-B. Which tag should I use? Thanks. ...

How to import shape resource(xml) to code?

I've been trying to import shape xml to customized View. like this, <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="#f0600000"/> <stroke android:width="10dp" android:color="#00FF00"/> <corners android:radius="15dp" /> <padding android:left="10dp" android...