is Activity Exist by class name - Android Activity

Android examples for Activity:Activity Feature

Description

is Activity Exist by class name

Demo Code


//package com.java2s;

import android.content.Context;
import android.content.Intent;

public class Main {
    public static boolean isActivityExist(Context context, String className) {
        Intent intent = new Intent();
        intent.setClassName("com.fy.administrator.superbook", className);
        if (context.getPackageManager().resolveActivity(intent, 0) == null) {

            return false;
        } else {//from   ww w.  j  av a  2 s.  c  o  m
            return true;
        }
    }
}

Related Tutorials