android

problems comparing two Calendar dates in Android

I wanted to compare the current system date to a fix date, but get the wrong result. By trying to find out what's wrong, I ended with the following Java code: // today, 18th of August 2010 long currSystem = System.currentTimeMillis(); Calendar calToday = Calendar.getInstance(); Calendar calFix = Calendar.getInstance(); ...

How do you select which raw contacts to update when you need to add custom info to your contacts?

As you can know there are aggregated contacts (one 1) and each can have multiple raw contacts linked together to that contact (many N) So there is a 1 contact -> N raw contacts relationship between them. When you need to store a custom info for your contact, you have to store it for one of the raw contacts. The question is, how do you...

Making EditText and Button same height in Android

Hi, i have an EditText and a Button in my LinearLayout and i want to align them closely together so they see seem to belong together (edittext + micButton for speech input). Now they don't have the same height and they aren't really aligned well (button seems to be a little lower than the EditText). I know I can apply a negative margin...

What's the difference between a regular Android APK and one included as part of a device's system image ?

We have a manufacturer that wants to pre-install our application on their Android device. We sent them the APK and even though it installs fine when used by a user, it appears to not get installed correctly when included in the manufacturer's build image. FYI, our application uses the JNI layer and some libraries built with NDK. The exce...

set source of ImageView dynamically android

I have an ImageView on my scene that I would like to set the source of dynamically based on user input. Let's say I have 4 images in my drawable folder: aaa.png, bbb.png, ccc.png, and ddd.png. When my application loads I set the image to: aaa.png myImageView.setImageResource(R.drawable.aaa); now I have an EditText where a user can t...

android.view.WindowManager$BadTokenException Exception. Any pointer?

Hi, I have two webviews and to cut out the common functionality from both the webviews I created a super class with all methods in the super class and use it in the two webviews. Once when I create the object and set the variables from the 1st webview, the WebView displays properly and when I press the 'BACK' button and go to the 2nd W...

How to see javadoc for annotations in Android SDK ?

In "Documentation for Android SKD, API 8", the javadoc for class android.test.InstrumentationTestRunner mentions command-line options for "small", "medium", and "large" tests without explaining how one would define tests as being of those sizes. A clue arrives later in the description in the form of a link to the annotation android.test....

Android: How do you set a spinner to change focus to the next EditText box down after a selection has been made?

I am working on an app that has multiple edittext fields and spinners and i want the focus to be switched to the next edittext box down when a selection is made from the spinner above. Help ...

onKey not called in Froyo 2.2

I have several EditText fields that I reformat on the fly as the user types by looking for onKeyEvents from a onKeyListener on the views. On a phone running 2.1 update 1 and a phone running 1.6, everything works correctly. On a HTC EVO running 2.2, the onKey sub is never called. The activity implements View.onKeyListener, and setOnKeyL...

Android Popping off the Activity Stack

In our app, we have Activities A,B,C,D, and E. The user usually goes from A to E. In Activity E we want to go back to A, and get ride of B,C,D from the stack. We don't want to recreate A from E. How do I 'pop off' B,C,D from the stack and then return to A ? ...

What is the best approach to port an Android application to Windows?

I used Eclipse with the Android SDK to develop the original application. I ask since this was my first Java (and Eclipse, and Android, and XML) project. I assume that most of the Java should run on the PC without too much trouble. I may want to restructure the code to isolate the Android specific functions. Should I stay with Eclipse or ...

Can't download with HttpClient with a different server port.

I am using Apache's HttpClient via httpclient-fluent-builder to download a http page. This is the code: ... try { response = Http.get("http://fr3.ah.fm:9000/played.html") .use(client) // use this HttpClient (required) .charset("windows-1252") // set the encoding... (optional) .asString();...

Application crashes while doing AlertDialog.Builder create() method - Android

Hi. I am testing my application on an LG Eve phone. I have an application that tries to download something from the web, and when it throws an exception, it is supposed to launch an alertdialog saying that there was an error. When the phone has no wifi signal, the program crashes at builder.create() (see code below). However, when there...

Android WebView Reload when the app loads

Hi, I am writing an android application that has a webview. On the first load it works fine, I am able to browse and drill down to pages. My expected behavior is that if I leave the application and come back, it should redirect to the page that I have it set to call in the webView.loadUrl("[page i set here]") but it seems to load the ...

Launching Google Maps and Navigator from Android App

I have an android application which allows the user to open up google maps or navigator to show a certain address. This functionality was working in the past, but now I get the following error and the app crashes: ERROR/AndroidRuntime(2165): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.int...

prevent translate tween from resetting - android

I have a simple translate tween that moves an object up 200 pixels. As soon as it's finished moving, it always bounces back to its original state and I don't want that. I want it to stay where I moved it. I know this is should be an obvious solution, but I can't find the method/property anywhere to make it just stop and not reset... ...

android force keyboard visible

My function, run from the onResume() does not cause the keyboard to appear. Am I doing it wrong? private void showKeyboard() { InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); mgr.showSoftInput(txtSearch, InputMethodManager.SHOW_FORCED); txtSearch.requestFocus();} ...

Filtering the camera preview

I am trying to display a filtered version of the camera preview. The code runs without errors but the device is showing the preview instead of the generated bitmap. This is the code for my (very small) Activity: http://code.google.com/p/ruellia/source/browse/ruellia/src/br/com/ximp/ruellia/RuelliaActivity.java I suspect the view lay...

MapActivity: set APIKey programmatically.

Hello all, I currently use a MapActivity in my application. I use it with 2 API Keys. One for debugging, and one for "production" I am fed up with changing these values in the xml layout: <view class="com.google.android.maps.MapView" android:id="@+id/myGmap" android:layout_width="fill_parent" android:layout...

Style list items as read in android?

How would I go about this? I have a list of news, and I know if it's read or not when I populate an ArrayAdapter with it, but I don't know how to style the read ones differently. ...