Intent getComponent - top ranked examples from Open Source projects

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

This code example shows how to use the following methods:getComponent
  } 
 
  @Override 
  public boolean onShareTargetSelected(ShareActionProvider source,
                                       Intent intent) {
    Toast.makeText(this, intent.getComponent().toString(),
                   Toast.LENGTH_LONG).show();
 
    return(false); 
  } 
 
  @Override 
  public void afterTextChanged(Editable s) {
    shareIntent.putExtra(Intent.EXTRA_TEXT, editor.getText());
    share.setShareIntent(shareIntent);
  } 
 
  @Override 
  public void beforeTextChanged(CharSequence s, int start, int count,
                                int after) {
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getComponent, hasExtra
            return mContext.getPackageName();
        } 
 
        @Override 
        public void startActivity(Intent intent) {
            ComponentName component = intent.getComponent();
            assertEquals(SubActivity.class.getCanonicalName(), component.getClassName());
            assertTrue(intent.hasExtra("hoge"));
            assertEquals("hogehoge", intent.getStringExtra("hoge"));
        } 
    } 
} 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getComponent
    @Test 
    public void queryActivityIcons__Match() throws Exception { 
        Intent i = rpm.getLaunchIntentForPackage(TEST_PACKAGE_NAME);
        Drawable d = new BitmapDrawable();
 
        rpm.addActivityIcon(i, d);
 
        assertThat(rpm.getActivityIcon(i)).isSameAs(d);
        assertThat(rpm.getActivityIcon(i.getComponent())).isSameAs(d);
    } 
 
    @Test 
    public void hasSystemFeature() throws Exception { 
        // uninitialized 
        assertThat(rpm.hasSystemFeature(PackageManager.FEATURE_CAMERA)).isFalse();
 
        // positive 
        rpm.setSystemFeature(PackageManager.FEATURE_CAMERA, true);
        assertThat(rpm.hasSystemFeature(PackageManager.FEATURE_CAMERA)).isTrue();
 
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getAction, getCategories, getComponent, getData, getPackage
  // cribbed from Android source 
  public boolean filterEquals(Intent other) {
    if (other == null) {
      return false; 
    } 
    if (getAction() != other.getAction()) {
      if (getAction() != null) { 
        if (!getAction().equals(other.getAction())) {
          return false; 
        } 
      } else { 
        if (!other.getAction().equals(getAction())) {
          return false; 
        } 
      } 
    } 
    if (getData() != other.getData()) {
      if (getData() != null) { 
        if (!getData().equals(other.getData())) {
          return false; 

8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getComponent, setComponent
    assertThat(rpm.resolveService(i, 0)).isNull();
  } 
 
  @Test 
  public void queryActivityIcons__Match() throws Exception { 
    Intent i = new Intent();
    i.setComponent(new ComponentName(TEST_PACKAGE_NAME, ""));
    Drawable d = new BitmapDrawable();
 
    rpm.addActivityIcon(i, d);
 
    assertThat(rpm.getActivityIcon(i)).isSameAs(d);
    assertThat(rpm.getActivityIcon(i.getComponent())).isSameAs(d);
  } 
 
  @Test 
  public void hasSystemFeature() throws Exception { 
    // uninitialized 
    assertThat(rpm.hasSystemFeature(PackageManager.FEATURE_CAMERA)).isFalse();
 
9
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getAction, getCategories, getComponent, getData, getPackage
    // cribbed from Android source 
    public boolean filterEquals(Intent other) {
        if (other == null) {
            return false; 
        } 
        if (getAction() != other.getAction()) {
            if (getAction() != null) { 
                if (!getAction().equals(other.getAction())) {
                    return false; 
                } 
            } else { 
                if (!other.getAction().equals(getAction())) {
                    return false; 
                } 
            } 
        } 
        if (getData() != other.getData()) {
            if (getData() != null) { 
                if (!getData().equals(other.getData())) {
                    return false; 

8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getComponent, putExtra
	 * @param data 
	 * @return false if it callback cannot be made 
	 */ 
	public boolean call(Context context, String dataName, Parcelable data) {
		if (intent != null) {
			Log.d(TAG, "attempting callback via intent: "+intent.getComponent());
			intent.putExtra(dataName, data);
			context.startService(intent);		
			return true;			 
		} 
		return false; 
	} 
} 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getComponent
 
    public static final ValueProvider COMPONENT_NAME = new ValueProvider("component-name") {
        @Override 
        public String getValue(Intent intent, ApplicationInfo callerApp, String resolvedType, 
                ApplicationInfo resolvedApp) { 
            ComponentName cn = intent.getComponent(); 
            if (cn != null) { 
                return cn.getClassName(); 
            } 
            return null; 
        } 
    }; 
 
    public static final ValueProvider COMPONENT_PACKAGE = new ValueProvider("component-package") {
        @Override 
        public String getValue(Intent intent, ApplicationInfo callerApp, String resolvedType, 
                ApplicationInfo resolvedApp) { 
            ComponentName cn = intent.getComponent(); 
            if (cn != null) { 
                return cn.getPackageName(); 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related Intent getComponent Questions & Answers:

getComponent Method Overview
Retrieve the concrete component associated with the intent.
See Code Examples for other Android Intent Methods: