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
 Hey,

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
here;

 http://dtmilano.blogspot.com/2008/11/android-testing-on-android-platf.html 

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,

Gav





--~--~---------~--~----~------------~-------~--~----~



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
http://www.steve-gil.blogspot.com
http://www.sembarangkalir.com
LinkedIn : steve.gil...@gmail.com
contact me : 628883813525
email : steve-...@gmail.com
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 alert.show()
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
android.os.Handler.<init>(Handler.java:121)
    02-06 10:27:31.052: WARN/System.err(276):     at
android.view.ViewRoot.<init>(ViewRoot.java:231)
    02-06 10:27:31.052: WARN/System.err(276):     at
android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148)
    02-06 10:27:31.062: WARN/System.err(276):     at
android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
    02-06 10:27:31.082: WARN/System.err(276):     at
android.view.Window$LocalWindowManager.addView(Window.java:424)
    02-06 10:27:31.082: WARN/System.err(276):     at
android.app.Dialog.show(Dialog.java:241)
    02-06 10:27:31.102: WARN/System.err(276):     at
cpe495.smartapp.SmartApp$4.dataAlertReceived(SmartApp.java:80)
    02-06 10:27:31.102: WARN/System.err(276):     at
cpe495.smartapp.DataRobot.fireDataAlertEvent(DataRobot.java:96)
    02-06 10:27:31.122: WARN/System.err(276):     at
cpe495.smartapp.DataRobot.analyzeData(DataRobot.java:32)
    02-06 10:27:31.122: WARN/System.err(276):     at
cpe495.smartapp.SmartApp$2.dataReceivedReceived(SmartApp.java:66)
    02-06 10:27:31.133: WARN/System.err(276):     at
cpe495.smartapp.ConnectDevice.fireDataReceivedEvent(ConnectDevice.java:
71)
    02-06 10:27:31.133: WARN/System.err(276):     at
cpe495.smartapp.ConnectDevice.run(ConnectDevice.java:42)
    02-06 10:27:31.153: WARN/System.err(276):     at
java.lang.Thread.run(Thread.java:1096)

---


    // datarobot class
    public class DataRobot extends Activity {
        /* This class is for analyzing the data */
        private List _listeners = new ArrayList();
        private List<DataAlertListener> _listeners2 = new
ArrayList<DataAlertListener>();
        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) {
                        fireDataAlertEvent();
                }
                fireDataAnalyzedEvent(data);
                return true; //for now this will always return true
        }

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



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



---

    public class DataAlertEvent extends EventObject {
        public DataAlertEvent(Object source) {
                super(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. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.intro);

        final AlertDialog alert = new
AlertDialog.Builder(this).create();
                Log.v("SmartApp", "inside sendalert");
                //AlertDialog alert = new AlertDialog.Builder(this).create();
                Log.v("SmartApp", "after builder1");
                //{*filter*} {*filter*};
                //{*filter*} = ({*filter*}) 
getSystemService(Context.{*filter*}_SERVICE);
                //{*filter*}.vibrate(500);
                alert.setMessage("Testing alert dialog...");
                alert.setCancelable(false);
                alert.setButton("Ok", new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                                // TODO Auto-generated method stub
                                dialog.cancel();
                        }
                });
                Log.v("SmartApp", "after builder2");
                //AlertDialog alert = builder.create();
                alert.setTitle("Title");

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

    }

-- 

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