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

This code example shows how to use the following methods:
This code example shows how to use the following methods:
  @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();
  } 
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: loadLabel
                View convertView, ViewGroup parent) {
            TextView textView = getGenericView();
            ActivityInfo activity=getChild(groupPosition, childPosition);
            if(activity!=null){
	            String name=activity.name.replace(activity.packageName, "");
	        	textView.setText(activity.loadLabel(mPackageManager)+"("+name+")");
	        	textView.setLayoutParams(lpChild);
            } 
            return textView;
        } 
        public PackageInfo getGroup(int groupPosition) {
        	return groups.get(groupPosition);
        } 
        public int getGroupCount() { 
        	return groups.size();
        } 
        public long getGroupId(int groupPosition) {
            return groupPosition;
        } 
        public View getGroupView(int groupPosition, boolean isExpanded, View convertView,
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:
    @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();
    } 
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: loadLabel
        PackageManager pm = mParent.getPackageManager();
        ActivityInfo ai = intent.resolveActivityInfo(pm, PackageManager.GET_ACTIVITIES);
        String friendlyName = null;
 
        if (ai != null) {
            friendlyName = ai.loadLabel(pm).toString();
            if (friendlyName == null && !labelOnly) {
                friendlyName = ai.name;
            } 
        } 
 
        return friendlyName != null || labelOnly ? friendlyName : intent.toUri(0);
    } 
 
    private String getFriendlyShortcutName(Intent intent) {
        String activityName = getFriendlyActivityName(intent, true);
        String name = intent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME);
 
        if (activityName != null && name != null) {
            return activityName + ": " + name;
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android ActivityInfo Questions & Answers:

See Code Examples for Android ActivityInfo Methods: