Android Pair - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android Pair class.

This code example shows how to use the following methods:
    assertThat(lastEnabled).isEqualTo(new Pair<Integer, Boolean>(666, true));
 
    int anotherNetworkId = 777;
    wifiManager.enableNetwork(anotherNetworkId, false);
    lastEnabled = shadowWifiManager.getLastEnabledNetwork();
    assertThat(lastEnabled).isEqualTo(new Pair<Integer, Boolean>(777, false));
  } 
 
  @Test 
  public void shouldReturnSetScanResults() throws Exception { 
    List<ScanResult> scanResults = new ArrayList<ScanResult>();
    shadowWifiManager.setScanResults(scanResults);
    assertThat(wifiManager.getScanResults()).isSameAs(scanResults);
  } 
 
  @Test 
  public void shouldRecordTheLastAddedNetwork() throws Exception { 
    WifiConfiguration wifiConfiguration = new WifiConfiguration();
    wifiConfiguration.networkId = -1;
    int networkId = wifiManager.addNetwork(wifiConfiguration);
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
    @Test 
    public void shouldEnableNetworks() throws Exception { 
        int networkId = 666;
        wifiManager.enableNetwork(networkId, true);
        Pair<Integer, Boolean> lastEnabled = shadowWifiManager.getLastEnabledNetwork();
        assertThat(lastEnabled).isEqualTo(new Pair<Integer, Boolean>(666, true));
 
        int anotherNetworkId = 777;
        wifiManager.enableNetwork(anotherNetworkId, false);
        lastEnabled = shadowWifiManager.getLastEnabledNetwork();
        assertThat(lastEnabled).isEqualTo(new Pair<Integer, Boolean>(777, false));
    } 
 
    @Test 
    public void shouldReturnSetScanResults() throws Exception { 
        List<ScanResult> scanResults = new ArrayList<ScanResult>();
        shadowWifiManager.setScanResults(scanResults);
        assertThat(wifiManager.getScanResults()).isSameAs(scanResults);
    } 
 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
					(System.currentTimeMillis() - start));
		} catch (Exception e) {
			L.w(e);
			ex = e;
		} 
		return new Pair<Exception, Result>(ex, res);
	} 
 
	@Override 
	protected final void onPostExecute(Pair<Exception, Result> result) {
		// try-catch to avoid lifecycle-related crashes 
		try { 
			if (progressListener != null) {
				progressListener.dismiss();
			} 
			if (result.first != null) {
				onFailurePostExecute(result.first);
			} else { 
				onSuccessPostExecute(result.second);
			} 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
	} 
 
	@Override 
	public void onLocationChanged(Location location) {
		@SuppressWarnings("unchecked") 
		Fix lqLocation = new Fix(location, new Pair<String, String>("battery", "" + batteryLevel));
		 
		if (isConnected()) { 
			fixSocket.pushFix(lqLocation);
		} else { 
			// TODO: This is a crude check. Should probably be rolled into UDPClient class directly. 
			Log.w(TAG, "Network unavailable, failed to push location fix!");
		} 
	} 
 
	@Override 
	public void onProviderDisabled(String provider) {
	} 
 
	@Override 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
    @Override 
    public Request addHeader(String headerKey, String headerValue) {
      if (headers == null) {
        headers = new ArrayList<Pair<String, String>>();
      } 
      headers.add(new Pair<String, String>(headerKey, headerValue));
      return this;
    } 
     
    @Override 
    public String getHeaderValue(String headerKey) {
      for (Pair<String, String> keyVal : headers) {
        if (keyVal.first.equals(headerKey)) {
          return keyVal.second;
        } 
      } 
      return null; 
    } 
 
    @Override 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android Pair Questions & Answers:

See Code Examples for Android Pair Methods: