Code example for ActivityInfo

0
  @Test 
  public void removeResolveInfosForIntent_shouldCauseResolveActivityToReturnNull() throws Exception { 
    Intent intent = new Intent(Intent.ACTION_MAIN, null).addCategory(Intent.CATEGORY_LAUNCHER);
    ResolveInfo info = new ResolveInfo();
    info.nonLocalizedLabel = TEST_PACKAGE_LABEL;
    info.activityInfo = new ActivityInfo();
    info.activityInfo.packageName = "com.org";
    rpm.addResolveInfoForIntent(intent, info);
 
    rpm.removeResolveInfosForIntent(intent, "com.org");
 
    assertThat(rpm.resolveActivity(intent, 0)).isNull();
  } 
 
  @Test 
  public void resolveService__NoMatch() throws Exception { 
    Intent i = new Intent();
    i.setComponent(new ComponentName("foo.bar", "No Activity"));
    assertThat(rpm.resolveService(i, 0)).isNull();
  } 
Contextual code suggestions in your IDE  Get Codota for Java