Code example for Activity

Methods: runOnUiThread

0
        View view = activity.findViewById(id);
        if (view != null) clickOnView(activity, view);
    } 
 
    public static void clickOnView(Activity activity, final View view) {
        activity.runOnUiThread(new Runnable() {
            @Override 
            public void run() { 
                view.callOnClick();
                lock.release();
            } 
        }); 
        try { 
            lock.acquire();
        } catch (InterruptedException e) {
            Log.e("cucumber-android", e.toString());
        } 
    } 
}