android

Proper reuse of ContactHeaderWidget

I am trying to reuse the header layout for contact details display view. I was able to add the widget of ContactHeaderWidget to my XML file as it is in this file and it shows up empty when I run the apk. But now how do I set the name of the contact, and the image of the contact? I've tried the method in line 197 here but I couldn't im...

Forcing the Soft Keyboard open

I am trying to force the Soft Keyboard open in an Activity and grab everything that is entered as I want to handle the input myself, I don't have an EditText. Currently I have tried this but it does not work. I would like the Soft Keyboardto open below mAnswerTextView (Note: it is a TextView not EditText). InputMethodManager mgr =...

Setting color in two different ways @*android:color/color1 vs @android:color/color1

I have seen this example: @*android:color/secondary_text_light What's that * asterisk doing there? What is the difference when using or not? ...

How long does the Android Emulator take to start? Do you need to close/start if every time you change Java code?

When developing for Android do you typically need to stop the emulator and restart it every time you make a change to your Java code or is there a faster way? The emulator takes about 1.5 minutes to start for me, is this normal? ...

Multiple overlay items in android

I seem to be having a problem with using ItemizedOverlay and OveralyItems in it. I can get the first overlayItem to appear on the map but not any items after that. Code sample is on: http://www.anddev.org/multiple_overlay_items-t12171.html Quick overview here: public class Markers extends ItemizedOverlay { private Context ctx; p...

Notify a service from a PhoneStateListener

Hi I have built an application that listen to call state changes, and I want to notify a service when the call_state became IDLE. All the components I have are functional, I just need to notify (not start) a service for this. What's the correct practice, maybe using AIDL? Because, in a PhoneStateListener, I can't bind to a service....

how can I get MOBILE phone number from contacts

Hi, I am trying to get mobile phone number from Android contacts. I found several examples using People.NUMBER, but it seems that brings home phone number not MOBILE phone number. I want to accomplish this using old way instead of using ContactsContract. Can somebody show simple code example how this can be done? Thank you very much. ...

Android: how to tell if a view is scrolling

in iPhone, this would be simple---each view has a scrollViewDidScroll method. I am trying to find the equivalent in Android. My code works, but it isn't giving me what I want. I need to execute code the entire duration that a view is scrolling. So, even though I use OnGestureListener's onScroll method, it only fires when the finger is o...

Problem with setting visibility in a Listview & BaseAdapter

Hi i'am working on an autogrowing listview. Everytime before i call mAdapter.notifyDataSetChanged(); i toggle the latest item on the list with a progress circle. /** * displays a progress banner instead of the last item. * @param reload boolean */ protected void showReloadView(boolean reload){ View ...

Get Phone Number in Android SDK

Is there a way to get the phone that is running my app's number within the app? Thanks, Josh ...

How to check if Contact has Image?

I am assigning to an ImageView contacts images using this code: mPhotoView = (ImageView) findViewById(R.id.photo); mPhotoView.setImageURI(objItem.getPhotoUri()); If the contact has no image, this does nothing, and no error is raised. When there is no image, I want to add a default image. So I need to check either if the image was add...

Can you redeploy an Android application via Intellij 9 Ultimate's Android support?

I know that eclipse can do this, can Intellij via the new Android support do this? ...

Did anyone create the Java Code Formatter Profile for Eclipse IDE that conforms to the Android Code Style Rules?

Android Code Style Guide defines "Android Code Style Rules". To conform to these rules one have to change quite a number of settings of the Java Code Formatter (Window->Preferences->Java->Code Style->Formatter) default profile (in Eclipse IDE). Did anyone manage to configure the formatter to follow the "Android Code Style Rules" already...

How to save preferences to somewhere other than SharedPreferences

My application is used on multiple platforms so it saves it preferences to a file (rather than to the standard Android SharedPreferences). Is there any easy of reusing the PreferenceActivity to save preferences to a file or is it a case of creating a whole new activity to do the job? If the latter is the case is there a layout I can use...

Is the Android Google Maps directions dialog a separate activity?

I'm trying to mimic the functionality in Google Maps on Android. When you press the directions option on the options menu, and it shows "My Location, End Point" on top of the map and dims the map. Is that running in a separate activity, or is that somehow a modal dialog on top of the map? ...

android.app.Application subclass, onTerminate is not being called

From the documentation for android.app.Application: "Base class for those who need to maintain global application state" I am using my own subclass to maintain an object that I'm using to query a server. Also from the documentation: "onTerminate() Called when the application is stopping." However, onTerminate() in my class is never ...

SQLiteQueryBuilder.buildQuery not using selectArgs?

Alright, I'm trying to query a sqlite database. I was trying to be good and use the query method of SQLiteDatabase and pass in the values in the selectArgs parameter to ensure everything got properly escaped, but it wouldn't work. I never got any rows returned (no errors, either). I started getting curious about the SQL that this genera...

Set margins in a LinearLayout programmatically.

I'm trying to use Java (not XML) to create a LinearLayout with buttons that fill the screen, and have margins. Here is code that works without margins: LinearLayout buttonsView = new LinearLayout(this); buttonsView.setOrientation(LinearLayout.VERTICAL); for (int r = 0; r < 6; ++r) { Button btn = new Button(this); btn.setTe...

Synchronize the position of two ScrollView views

I am trying to synchronize the positions of two ScrollViews. I'm trying to do this to display a tv guide listing. I have created a custom class that extends RelativeLayout to display the guide. This relative layout has four children: an imageview in the top left corner, a HorizontalScrollView to display the column headers in the top r...

Android: Determine when an app is being finalized vs destroyed for screen orientation change

Hi all, I am relatively new to the Android world and am having some difficultly understanding how the whole screen orientation cycle works. I understand that when the orientation changes from portrait to landscape or vice versa the activity is destroyed and then re-created. Thus all the code in the onCreate function will run again. So he...