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

This code example shows how to use the following methods:
  } 
 
  @Test 
  public void resolveActivity__Match() throws Exception { 
    Intent i = new Intent(Intent.ACTION_MAIN, null).addCategory(Intent.CATEGORY_LAUNCHER);
    ResolveInfo info = new ResolveInfo();
    info.nonLocalizedLabel = TEST_PACKAGE_LABEL;
    rpm.addResolveInfoForIntent(i, info);
 
    assertThat(rpm.resolveActivity(i, 0)).isSameAs(info);
  } 
 
  @Test 
  public void resolveActivity__NoMatch() throws Exception { 
    Intent i = new Intent();
    i.setComponent(new ComponentName("foo.bar", "No Activity"));
    assertThat(rpm.resolveActivity(i, 0)).isNull();
  } 
 
  @Test 
8
CodeRank
This code example shows how to use the following methods:
This code example shows how to use the following methods:
    } 
 
    @Test 
    public void resolveActivity__Match() throws Exception { 
        Intent i = new Intent(Intent.ACTION_MAIN, null).addCategory(Intent.CATEGORY_LAUNCHER);
        ResolveInfo info = new ResolveInfo();
        info.nonLocalizedLabel = TEST_PACKAGE_LABEL;
        rpm.addResolveInfoForIntent(i, info);
 
        assertThat(rpm.resolveActivity(i, 0)).isSameAs(info);
    } 
 
    @Test 
    public void resolveActivity__NoMatch() throws Exception { 
        Intent i = new Intent();
        i.setComponent(new ComponentName("foo.bar", "No Activity"));
        assertThat(rpm.resolveActivity(i, 0)).isNull();
    } 
 
    @Test 
8
CodeRank
This code example shows how to use the following methods:loadLabel
  } 
 
  @Test 
  public void testLoadLabel() { 
    mShadowInfo.setLabel("test");
    assertThat((CharSequence) "test").isEqualTo(mResolveInfo.loadLabel(null));
  } 
 
  @Test 
  public void testNewResolveInfoWithActivity() { 
    assertThat(mResolveInfo.loadLabel(null).toString()).isEqualTo("name");
    assertThat(mResolveInfo.activityInfo.packageName).isEqualTo("package");
    assertThat(mResolveInfo.activityInfo.applicationInfo.packageName).isEqualTo("package");
    assertThat(mResolveInfo.activityInfo.name).isEqualTo("fragmentActivity");
  } 
} 
6
CodeRank
This code example shows how to use the following methods:loadLabel
        new Intent(Intent.ACTION_VIEW,
                   Uri.parse("http://commonsware.com"));
    ResolveInfo ri=
        mgr.resolveActivity(i, PackageManager.MATCH_DEFAULT_ONLY);
 
    Toast.makeText(this, ri.loadLabel(mgr), Toast.LENGTH_LONG).show();
     
    startActivity(i);
    finish();
  } 
} 
7
CodeRank
This code example shows how to use the following methods:loadLabel
    } 
 
    @Test 
    public void testLoadLabel() { 
        mShadowInfo.setLabel("test");
        assertThat((CharSequence) "test").isEqualTo(mResolveInfo.loadLabel(null));
    } 
 
    @Test 
    public void testNewResolveInfoWithActivity() { 
        assertThat(mResolveInfo.loadLabel(null).toString()).isEqualTo("name");
        assertThat(mResolveInfo.activityInfo.packageName).isEqualTo("package");
        assertThat(mResolveInfo.activityInfo.applicationInfo.packageName).isEqualTo("package");
        assertThat(mResolveInfo.activityInfo.name).isEqualTo("fragmentActivity");
    } 
} 
7
CodeRank
This code example shows how to use the following methods:loadIcon, loadLabel
This code example shows how to use the following methods:queryIntentActivities, loadIcon
        return System.currentTimeMillis();
    } 
 
    public static Drawable getIconForIntent(final Context context, Intent i) {
        PackageManager pm = context.getPackageManager();
        List<ResolveInfo> infos = pm.queryIntentActivities(i, PackageManager.MATCH_DEFAULT_ONLY);
        if (infos.size() > 0) {
            return infos.get(0).loadIcon(pm);
        } 
        return null; 
    } 
 
} 
6
CodeRank
This code example shows how to use the following methods:
    private ResolveInfo mResolveInfo;
    private ShadowResolveInfo mShadowInfo;
 
    @Before 
    public void setup() { 
        mResolveInfo = new ResolveInfo();
        mShadowInfo = Robolectric.shadowOf(mResolveInfo);
    } 
 
    @Test 
    public void testLoadLabel() { 
        mShadowInfo.setLabel("test");
        assertThat("test", equalTo(mResolveInfo.loadLabel(null)));
    } 
 
    @Test 
    public void testNewResolveInfo() { 
        ResolveInfo info = ShadowResolveInfo.newResolveInfo("name", "package");
        assertThat(info.loadLabel(null).toString(), equalTo("name"));
        assertThat(info.activityInfo.packageName, equalTo("package"));
6
CodeRank
This code example shows how to use the following methods:loadIcon, loadLabel

Related Android ResolveInfo Questions & Answers:

See Code Examples for Android ResolveInfo Methods: