Code example for ConditionVariable

Methods: block

0
	// Verify that our credentials are correct by opening the API URL. If they are,  
	// we'll get 'auth:1' in the result. We also check for the min API version (3). 
	public Boolean verifyLogin()
	{ 
		login_ok = false;
		condv = new ConditionVariable();
 
		class ltask extends AsyncTask<Void, Void, Void>
		{ 
			protected Void doInBackground(Void... params)
			{ 
				setLoginResult(checkAuth()); 
				return null; 
			} 
		} 
		new ltask().execute();
		 
		if (!condv.block(10000L))
			Log.w(TAG, "Timed out on login check!");
		return login_ok;
	} 
	 
	// Validate that the auth token is correct and that we have at least API level 3.