Android ContextWrapper - 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 ContextWrapper class.

This code example shows how to use the following methods: getString, getPackageName, getResources
This code example shows how to use the following methods: getActivity, getApplicationContext, getClass
 
	private MoSyncNFCForegroundUtil(Activity activity, NfcAdapter nfc) {
	    this.activity = activity;
	    this.nfc = nfc;
 
	    intent = PendingIntent.getActivity(activity, 0, new Intent(activity, activity.getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
 
	    // TODO: NDEF!? 
	    IntentFilter ndef = new IntentFilter(NfcAdapter.ACTION_TECH_DISCOVERED);
 
//	    try { 
//	        ndef.addDataType("*/*"); 
//	    } catch (MalformedMimeTypeException e) { 
//	        throw new RuntimeException("Unable to speciy */* Mime Type", e); 
//	    } 
 
	    intentFilters = new IntentFilter[] { ndef };
 
	    // TODO: READ FROM NFC.XML OR SMTHG 
	    techLists = new String[][] {

8
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: getContentResolver
    private Activity activity;
    private ContentResolver contentResolver;
 
    @Before 
    public void setUp() throws Exception { 
        activity = new Activity();
        contentResolver = activity.getContentResolver();
    } 
 
    @Test 
    public void whileApplicationStaysSame_shouldRememberOldSettings() throws Exception { 
        Settings.System.putInt(contentResolver, "property", 1);
        assertThat(Settings.System.getInt(contentResolver, "property", 0)).isEqualTo(1);
 
        activity = new Activity();
        contentResolver = activity.getContentResolver();
        assertThat(Settings.System.getInt(contentResolver, "property", 0)).isEqualTo(1);
    } 
 
    @Test 
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: getSystemService, getClass
        invokeMethod(service, mSetForeground, Boolean.FALSE);
    } 
 
    public ServiceForegroundCompat(Service service) {
        this.service = service;
        mNM = (NotificationManager)service.getSystemService(Context.NOTIFICATION_SERVICE);
 
        Class<?> clazz = service.getClass();
 
        try { 
            mStartForeground = clazz.getMethod("startForeground", mStartForegroundSig);
            mStopForeground = clazz.getMethod("stopForeground", mStopForegroundSig);
        } catch (NoSuchMethodException e) {
            mStartForeground = mStopForeground = null;
        } 
 
        try { 
            mSetForeground = clazz.getMethod("setForeground", mSetForegroundSig);
        } catch (NoSuchMethodException e) {
            mSetForeground = null;
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: getSystemService
      @Override public void run() { 
        Application app = (Application) getTargetContext().getApplicationContext();
        String simpleName = SpoonInstrumentationTestRunner.class.getSimpleName();
 
        // Unlock the device so that the tests can input keystrokes. 
        ((KeyguardManager) app.getSystemService(KEYGUARD_SERVICE)) //
            .newKeyguardLock(simpleName) //
            .disableKeyguard();
        // Wake up the screen. 
        ((PowerManager) app.getSystemService(POWER_SERVICE)) //
            .newWakeLock(FULL_WAKE_LOCK | ACQUIRE_CAUSES_WAKEUP | ON_AFTER_RELEASE, simpleName) //
            .acquire();
      } 
    }); 
 
    super.onStart(); 
  } 
} 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android ContextWrapper Questions & Answers:

See Code Examples for Android ContextWrapper Methods: