Instrumentation sendKeyDownUpSync - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Instrumentation sendKeyDownUpSync method.

This code example shows how to use the following methods:sendKeyDownUpSync
        assertEquals(displayVal(), mActivity.getString(R.string.minus) + "600");
    } 
   
    // helper functions 
    private void press(int keycode) {
        mInst.sendKeyDownUpSync(keycode);
    } 
     
    private boolean tap(int id) {
        View view = mActivity.findViewById(id);
        if(view != null) {
            TouchUtils.clickView(this, view);
            return true; 
        } 
        return false; 
    } 
   
    private String displayVal() {
        CalculatorDisplay display = (CalculatorDisplay) mActivity.findViewById(R.id.display);
        assertNotNull(display);
6
CodeRank
This code example shows how to use the following methods:sendKeyDownUpSync, waitForIdleSync
6
CodeRank
This code example shows how to use the following methods:sendKeyDownUpSync, sleep
5
CodeRank
This code example shows how to use the following methods:sendKeyDownUpSync, waitForIdleSync
 
    private void enterRecordingMode() { 
        if (View.INVISIBLE == mButtonRecord.getVisibility()) {
            makeFMPowerUp(); 
        } 
        mInstrumentation.sendKeyDownUpSync(KeyEvent.KEYCODE_MENU);
        mInstrumentation.waitForIdleSync();
        mInstrumentation.sendKeyDownUpSync(KeyEvent.KEYCODE_DPAD_UP);
        mInstrumentation.sendKeyDownUpSync(KeyEvent.KEYCODE_DPAD_DOWN);
        mInstrumentation.sendKeyDownUpSync(KeyEvent.KEYCODE_DPAD_LEFT);
        mInstrumentation.sendKeyDownUpSync(KeyEvent.KEYCODE_DPAD_CENTER);
        mInstrumentation.waitForIdleSync();
    } 
 
    private boolean isExistInChannelList(int station) {
        boolean find = false;
        float frequency = 0;
        int stationInList = 0;
        ListView listView = (ListView) mFMRadioFavorite.findViewById(R.id.station_list);
        assertNotNull(listView);

5
CodeRank
This code example shows how to use the following methods:sendKeyDownUpSync, sleep
		WebView myWebView = (WebView) findViewById(R.id.myWebView);
		new Thread(new Runnable() {         
	        @Override 
	        public void run() { 
	            try { 
	            Instrumentation inst = new Instrumentation();
	           // for ( int i = 0; i < 10; ++i ) { 
	                inst.sendKeyDownUpSync(KeyEvent.KEYCODE_S);
	                System.out.println("downPressed");
	                Thread.sleep(2000);
	             //   inst.sendKeyDownUpSync(KeyEvent.KEYCODE_BACK); 
	             //   Thread.sleep(2000); 
	           // } 
	            } 
	            catch(InterruptedException e){
	            } 
	        }    
	    }).start();
	} 
} 
5
CodeRank
This code example shows how to use the following methods:sendKeyDownUpSync, sleep
    } 
 
    private void sleepFor(long time) {
        Log.v(TAG,TAG2+":sleepFor "+time+" ms");
        try { 
            Thread.sleep(time);
        } catch (InterruptedException e) {
        } 
    } 
 
    // 
    //  Make sure the all the UI shows correctly when the activity pop up. 
    // 
    public void testCase01_activityDisplay() { 
        try { 
            //get worker thread filed 
            Field f = GalleryPicker.class.getDeclaredField("mWorkerThread");
            f.setAccessible(true);
            Thread t = (Thread)f.get(mActivity);
            //wait till this thread finished 

5
CodeRank
This code example shows how to use the following methods:sendKeyDownUpSync, sendStringSync, waitForIdleSync
5
CodeRank
This code example shows how to use the following methods:sendKeyDownUpSync, waitForIdleSync, sleep
	} 
	 
	private void showHomescreen() { 
		if (mLauncher.isAllAppsVisible() || mLauncher.isWorkspaceLocked()) {
			// send back key to home screen 
			mInstrumentation.sendKeyDownUpSync(KeyEvent.KEYCODE_BACK);
			mInstrumentation.waitForIdleSync();
			try { 
				Thread.sleep(2000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			} 
		} 
		assertFalse(mLauncher.isAllAppsVisible());
	} 
	 
	/** 
	 * Get a screen index of workspace than contains a widget 
	 * @param workspace 
	 * @return 
5
CodeRank
This code example shows how to use the following methods:sendKeyDownUpSync
	 
	/*模拟back键 */ 
	private void simulateKey(int KeyCode){
		Log.v(TAG,"ActionBarActivity ---> simulateKey");
		try{ 
			Instrumentation inst = new Instrumentation();
			inst.sendKeyDownUpSync(KeyCode);
		}catch(Exception e){
			Log.e(TAG,e.toString());
		} 
	} 
} 
5
CodeRank
This code example shows how to use the following methods:sendKeyDownUpSync
        sendKey(KeyEvent.KEYCODE_DPAD_DOWN);
    } 
 
    private void sendKey(int key) {
        try { 
            instrumentation.sendKeyDownUpSync(key);
        } catch (SecurityException ignored) {
        } 
    } 
 
    private Solo solo() { 
        return TestRunInformation.getSolo(); 
    } 
 
} 
5
CodeRank

Related Instrumentation sendKeyDownUpSync Questions & Answers:

sendKeyDownUpSync Method Overview
Sends an up and down key event sync to the currently focused window.
See Code Examples for other Android Instrumentation Methods: