根据包名字符串跳转Activity

 

/**
     * 跳转到对应activity
     */
    public void toActivity(Context context,String fullName) {
        if (className != null && className.length() > 0) {
            try {
                
                
                
                
                Intent intent = new Intent(context, Class.forName(fullName));

                context.startActivity(intent);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
fullName为完整类名,如com.example.app.MyActivity


posted on 2014-10-28 14:28  屌丝迷途  阅读(1780)  评论(0编辑  收藏  举报

导航