android

Nexus One & Windows XP USB Driver

I've been unable to get my Nexus One working as a development phone on Windows XP. I've got the driver (revision 3 for N1 support), I've got it installed according to the official installation guide, and the phone appears in the Device Manager just as the guide says it should. However, adb still can't find the phone. 'adb devices', for ...

Animate change of view background color in Android

How do you animate the change of background color of a view in Android? For example: I have a view with a red background color. The background color of the view changes to blue. How can I do a smooth transition between colors? If this can't be done with views, an alternative will be welcome. ...

Is there any way to access files in your source tree in Android?

Hi all, This is a bit unorthodox but I'm trying to figure out if there's a way to access files stored in the src tree of my applications apk in Android. I'm trying to use i-Jetty (Jetty implementation for Android) and rather than use it as a separate application and manually download my war file, I'd rather just bake i-jetty in. How...

Discrete seekbar in Android app?

i would like to create a seekbar for an Android app that allows the user to select a value between -5 and 5 (which maps to "strongly disagree" and "strongly agree"). how do i make a seekbar with discrete values? or is there a better UI widget i could use for this? thanks. ...

How do I get the SharedPreferences from a PreferenceActivity in Android?

Hi, I am using a PreferenceActivity to show some settings for my application. I am inflating the settings via a xml file so that my onCreate (and complete class methods) looks like this: public class FooActivity extends PreferenceActivity { @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); addPreferencesFr...

How to manage a MotionEvent going from one View to another?

I have a SurfaceView that takes up part of the screen, and some buttons along the bottom. When a button is pressed and the user drags, I want to be able to drag a picture (based on the button) onto the SurfaceView and have it drawn there. I want to be able to use clickListeners and the like, and not just have a giant SurfaceView with m...

[android] How to center buttons on screen horizontally and vertically plus equidistant apart?

I've been racking my brain (android newbie here, so not hard to do) for awhile trying to figure out how to accomplish this: Desired Layout using a RelativeLayout or something other than AbsoluteLayout which is what this was created with. I'm coming from a Windows programming background where the device adjusts the 'absolute' positioning...

Android "gen" folder and SVN - bitter enemies.

It seems that I accidentally checked in my "gen" folder from an Android project (this folder contains the R.java generated class). When I realized I did this I deleted it from SVN and tried to ignore it. Now I am now getting the error... "Could not add gen to the ignore list! Working copy 'C:\code\guru' locked. When I try to ...

Android - Adding external library to project

Hi, I am having a lot of trouble adding the WEKA library to a project I am working on. I have followed several tutorials that explain how to do this including the Android Developers guide: http://developer.android.com/guide/appendix/faq/commontasks.html#addexternallibrary and several of the postings on SO. I have created a folder in...

PreferenceActivity and theme not applying

Hi all I have set the theme in the manifest file like this: android:theme="@android:style/Theme.Light" But I have a problem in the Preferences Activity, in the main preferences the theme shows ok, but if I get to a sub preference, the theme gets messy, it is not white as it should, it is all dark, and the font is black so you can't se...

Triggering event when Button is pressed down in Android

I have the following code for Android which works fine to play a sound once a button is clicked: Button SoundButton2 = (Button)findViewById(R.id.sound2); SoundButton2.setOnClickListener(new OnClickListener() { public void onClick(View v) { mSoundManager.playSound(2); } }); My problem is that I want the sound ...

"Android 2.x" vs "Google APIs" for Android AVD Setup

In the Android AVD manager (or a new project for that matter), it will give two options for the same API level. For example, for Level 7 (2.1) it will show "Google APIs - Level 7" and "Android 2.1 - Level 7" in the selection drop down. What, if any, is the actual difference between these two and why would I want one over the other? ...

android call log like design

I'm trying to create a design for a list that looks like (and mostly behaves like) the call log, like shown here: I don't need all the design, but what I'm trying to achieve is the two-columned design with the splitter in-between, and the behavior that if I click on the main item (the left part) one thing happens (in this case, you ope...

Android insert into sqlite database

I know there is probably a simple thing I'm missing, but I've been beating my head against the wall for the past hour or two. I have a database for the Android application I'm currently working on (Android v1.6) and I just want to insert a single record into a database table. My code looks like the following: //Save information to my ...

Problem in setting path for android sdk in ubuntu

export PATH=${/home/mohit/}:<android-sdk-linux_86>/tools this is what i am using.. error:-- bash: PATH=${/home/mohit/}:: bad substitution this is the path of sdk mohit@mohit-laptop:~/android-sdk-linux_86$ pwd /home/mohit/android-sdk-linux_86 ...

How to send KeyEvents through an input method service to a Dialog, or a Spinner menu?

I'm trying to implement an input method service that receives intents sent by a remote client, and in response to those sends an appropriate KeyEvent. I'm using in the input method service this method private void keyDownUp(int keyEventCode) { getCurrentInputConnection().sendKeyEvent( new KeyEvent(KeyEvent.ACTIO...

How do I pass data from a BroadcastReceiver through to an Activity being started?

I've got an Android application which needs to be woken up sporadically throughout the day. To do this, I'm using the AlarmManager to set up a PendingIntent and have this trigger a BroadcastReceiver. This BroadcastReceiver then starts an Activity to bring the UI to the foreground. All of the above seems to work, in that the Activity la...

How to adjust text font size to fit textview

Hi, Is there any way in android to adjust the textsize in a textview to fit the space it occupies? E.g. I'm using a TableLayout and adding several textviews to each row. Since I don't want the textviews to wrap the text I rather see that it lowers the font size of the content. Any ideas? I have tried measureText, but since I don't kn...

Animating translation and scaling of view in Android

I have to animate a view from state A to B with changes to its scale, position and scrolling. The following code almost does the trick: AnimationSet animation = new AnimationSet(true); int fromXDelta = view.getScrollX(); int fromYDelta = view.getScrollY(); view.scrollTo(0, 0); float scale = (float) widthB / (float) widthA; // Calculat...

Is there a way to make Android tabs slide?

Hi all, I'm new to Android development, and I was wondering if anyone knew either how to make Tabs slide, or how to get a similar effect without tabs. I have quite a few tabs in my application, and it does not look good on devices with smaller screens. Or maybe tabs are not what I am looking for. If you don't know what I'm talking about...