码迷,mamicode.com
首页 > 其他好文 > 详细

根据包名字符串跳转Activity

时间:2014-10-28 15:11:57      阅读:181      评论:0      收藏:0      [点我收藏+]

标签:style   blog   io   color   ar   for   sp   div   on   

 

/**
     * 跳转到对应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


根据包名字符串跳转Activity

标签:style   blog   io   color   ar   for   sp   div   on   

原文地址:http://www.cnblogs.com/l2rf/p/4056743.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!