android

android color menu icons

Is there are a reason why android menu icons are always monochrome and not color? Is there any reason why i shouldn't use color menu icons? ...

Can't pick build target when importing Android project from existing source

I'm trying to import an Android project into my Eclipse workspace, using existing source code. When I point Eclipse to my existing source location, it doesn't populate the Build Target area on the New Android Project dialog. Why isn't it letting me pick a build target? ...

Alternating styles on ListView using extended ArrayAdapter<E> random results

Currently my ListView is filling up with the given String[] but I wanted to alternate some styles on the ListView items. Something weird is happening (I'm surely missing something obvious); The ListView Index is not fixed and the styles are not alternating as supposed. My Code is the following: package com.blah.blah; import android.a...

Javascript maturity on Blackberry, Android, Windows Phone 7 and iPhone

What is the state of maturity of javascript on these platforms? Is safe write a prototype app and trust that it'll work on all of these devices without headaches? ...

Android - Spacing between CheckBox and text

Is there an easy way to add padding between the checkbox in a CheckBox control, and the associated text? I cannot just add leading spaces, because my label is multi-line. As-is, the text is way too close to the checkbox: ...

Are the ByteBuffer/IntBuffer/ShortBuffer Java classes fast??

I'm working on an Android application (in Java, obviously) and I recently updated my UDP reader code. In both versions, I set up some buffers and receive a UDP packet: byte[] buf = new byte[10000]; short[] soundData = new short[1000]; DatagramPacket packet = new DatagramPacket (buf, buf.length); socket.receive (packet); In the initia...

In Eclipse, why additional plugin break the Android plug-in?

I had Eclipse running with the Android plug-in and I decided to add the Emacs plug-in. I downloaded and it worked. Then I decided to go back to the Eclipse key bindings and the Android plug-in disappeared. I could not update it, because Eclipse said it was installed, but it was not showing up in the menu. I had to re download Eclipse, a...

Android: onItemClick only returns first selected Item

Hi. I'm using and ArrayAdapter to populate a ListView. After selecting and item, it displays a confirmation Y/N dialog. If the user's choice is negative, then he should be able to select another item showing the same dialog. And so on. Here's my code: lView.setOnItemClickListener(new OnItemClickListener() { public void onItemClic...

How do I retrieve the logged in Google account on android phones?

I am developing an Android application and I need to retrieve the Google account used on the phone. I want to do this for the C2DM, but I don't want to ask the user to enter in his/her Google email account if they are already logged in. Is there any way to do it? ...

Avoid animation when changing Views visibility

My application has an Activity and this Activity displays different Views depending on the context. I switch Views by using a combination of setVisibility() because I have only 1 XML file with every different View. The problem is that when changing Views like: mCurrentView.setVisibility(View.GONE); mNextView.setVisibility(View.VISIBLE);...

Android: Go back to previous activity

Hi! I want to do something simple on android app. How is it possible to go back to a previous activity. What code do I need to go back to previous activity ...

SAX on Android is getting called multiple times with the same data but offset

I am trying to parse an xml file using SAX with Android and the problem is that the function characters(...) is getting called multiple times with what appears to be the same data just offset by a few characters. As you can tell from the output below the first time it gets called with "\talabama" and the second time it gets called with ...

Program will not switch to activity on my phone

public class TestCamera extends Activity implements SurfaceHolder.Callback, View.OnClickListener { ... Camera.PictureCallback mPictureCallback = new Camera.PictureCallback() { @Override public void onPictureTaken(byte[] data, Camera camera) { // TODO Auto-generated method stub picture = data; } }; @Override...

Implementing a robust persistent undo/redo feature

I'm writing a bitmap editor where I use the Command Pattern to represent actions that will transform the document. I keep all the commands executed so far in a list and, to implement undo, I restore the document to its initial state and then replay all but the last command. I would like my undo/redo system to have the following feature:...

Null-pointer issue displaying an image from assets folder Android 2.2 SDK

I looked at the 2 examples on Stack, but can't get them to work. I'm simply trying to grab an image from a folder in assets and set it as in ImageView, but get a null pointer returned. What am I doing wrong? Main Activity: package com.xxx.xxx; import java.io.InputStream; import android.app.AlertDialog; import android.graphics.Bi...

Debugging on my phone (Eclipse, Android)

I want to run and debug my Android apps on my HTC Incredible. On http://developer.android.com/guide/developing/device.html it says I have to install the Windows USB driver. And the instructions for that says: "1. Connect your Android-powered device to your computer's USB port. Windows will detect the device and launch the Hardwa...

Usnig ProGuard with Android.

I am trying to use ProGuard with Android. I have found several ProGuard scrips to use, with the following one being an example (I have found several others that are the same or very similar). However, when I try and run ProGuard using this script, I get the error: "Expecting java type before ';' in line 23 of file ..." I am completel...

Draw From Old Canvas - Android

Hey guys, I'm making an App that needs to be able to draw new graphics on top of the last set. This is my current onDraw() method - protected void onDraw(Canvas canvas) { canvas.drawColor(Color.WHITE); if(points.size() > 0) { //do some stuff here - this is all working ok canvas.drawLine(p1.x, p1.y, p2.x, p2....

Android Emulator Debugging, Code will not Update

I'm having a troubling problem testing some code for and Android app. My app has two parts, and activity where the user changes some settings, and a broadcast receiver that responds to SMS messages, both in the same package. Here's the problem, I first implemented some simple code to test out the broadcast receiver and the activity, an...

Debugging SimpleCursorAdapter

Hello, I'm working on my first Android app and can't figure out how to get my SimpleCursorAdpater to populate the view. The cursor that I'm passing in has results in it, so the problem must be somewhere in instantiating the adapter or in binding it to the view. I'm sort of at my wits end since no exceptions are thrown and I can't real...