How to run the 'AllTests' of ApiDemos in the android sdk sample

by Gavin Aiken » Sun, 15 Mar 2009 04:47:47 GMT

Sponsored Links

You can't run these tests as simple java JUnit tests, they need to be run on
the device. The process is pretty straight forward and is best explained

What I am currently trying to work out is how to debug my tests now that I
can run them! I'm sure it's a flag that I need to pass to the command line
argument but I can't work it out.

Hope this helps,



Other Threads

1. [WTHelp] HTC Magic Stuck di logo android

Teman teman tolong donk HTC magic teman q stuck di logo android
Gara2 dia instal radio gitu

Ada yang tau ga solusinya gmn?????

Best Regrads,
Stefanus Gilang Chresna
LinkedIn :
contact me : 628883813525
email :
YM : gg_desain
Skype : steve.gilang


2. AlertDialog error with events

I am new to java/android. I am trying to create an AlertDialog inside
my SmartApp class when an event is fired in my DataRobot class. I am
getting an error when doing this. The event is firing and calling the
function successfully in SmartApp, but when it gets to
the following error is printed to logcat. Does anyone know what i am
doing wrong or a better way to implement what i am wanting? The
AlertDialog does not pop up on screen, logcat just complains about
something. Code and logcat output below:

    02-06 10:27:30.673: VERBOSE/SmartApp(276): data alert event caught
    02-06 10:27:31.013: WARN/System.err(276):
java.lang.RuntimeException: Can't create handler inside thread that
has not called Looper.prepare()
    02-06 10:27:31.042: WARN/System.err(276):     at
    02-06 10:27:31.052: WARN/System.err(276):     at
    02-06 10:27:31.052: WARN/System.err(276):     at
    02-06 10:27:31.062: WARN/System.err(276):     at
    02-06 10:27:31.082: WARN/System.err(276):     at
    02-06 10:27:31.082: WARN/System.err(276):     at
    02-06 10:27:31.102: WARN/System.err(276):     at
    02-06 10:27:31.102: WARN/System.err(276):     at
    02-06 10:27:31.122: WARN/System.err(276):     at
    02-06 10:27:31.122: WARN/System.err(276):     at
    02-06 10:27:31.133: WARN/System.err(276):     at
    02-06 10:27:31.133: WARN/System.err(276):     at
    02-06 10:27:31.153: WARN/System.err(276):     at


    // datarobot class
    public class DataRobot extends Activity {
        /* This class is for analyzing the data */
        private List _listeners = new ArrayList();
        private List<DataAlertListener> _listeners2 = new
        private SmartDataObject data;
        private int sI1;
        private int sI2;
        private float w1;
        private float w2;
        private float w3;
        private int hRB;
        private int hRVMin;
        private int hRVMax;

        public boolean analyzeData(SmartDataObject temp) {
                /* Analyze the data
                 * Returns true if data was successfully analyzed
                 * Returns false if an error occurred
                data = temp;
                if(data.getHeartRate()>290) {
                return true; //for now this will always return true

        public synchronized void addDataAnalyzedListener(DataAnalyzedListener
listener) {
        public synchronized void
removeDataAnalyzedListener(DataAnalyzedListener listener) {
        private synchronized void fireDataAnalyzedEvent(SmartDataObject temp)
                DataAnalyzedEvent dRE = new DataAnalyzedEvent(this, temp);
                Iterator listeners = _listeners.iterator();
                while(listeners.hasNext()) {
        public interface DataAnalyzedListener {
                public void dataAnalyzedReceived(DataAnalyzedEvent event);

        public synchronized void addDataAlertListener(DataAlertListener
listener) {
        public synchronized void removeDataAlertListener(DataAlertListener
listener) {
        private synchronized void fireDataAlertEvent() {
                DataAlertEvent dAE = new DataAlertEvent(this);
                Iterator listeners = _listeners2.iterator();
                while(listeners.hasNext()) {
        public interface DataAlertListener {
                public void dataAlertReceived(DataAlertEvent event);


    public class DataAlertEvent extends EventObject {
        public DataAlertEvent(Object source) {
                // TODO Auto-generated constructor stub


    public class SmartApp extends Activity implements
OnSharedPreferenceChangeListener {
        TextView smartConnectionStatus;
        TextView testOutputView;
        Thread cThread;
        private ConnectDevice cD = new ConnectDevice();
        private DataRobot dR = new DataRobot();
        private DataBuilder dB = new DataBuilder();
        private DataSender dS = new DataSender();

        /** Called when the activity is first created. */
        public void onCreate(Bundle savedInstanceState) {

        final AlertDialog alert = new
                Log.v("SmartApp", "inside sendalert");
                //AlertDialog alert = new AlertDialog.Builder(this).create();
                Log.v("SmartApp", "after builder1");
                //{*filter*} {*filter*};
                //{*filter*} = ({*filter*}) 
                alert.setMessage("Testing alert dialog...");
                alert.setButton("Ok", new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int which) {
                                // TODO Auto-generated method stub
                Log.v("SmartApp", "after builder2");
                //AlertDialog alert = builder.create();

                cD.addDataReceivedListener(new DataReceivedListener() {
                        public void dataReceivedReceived(DataReceivedEvent 
event) {
                                // TODO Auto-generated method stub
                dR.addDataAlertListener(new DataAlertListener() {
                        public void dataAlertReceived(DataAlertEvent event) {
                                Log.v("SmartApp", "data alert event caught");



3. lg ally android cant connect to blocks editor

4. How to save geolocation data on server.....

5. Where is best to start?

6. Emulator Uninstall to Previous One (2.3 to 2.2)

7. Problems with notification bar when called from a widget