码迷,mamicode.com
首页 > 移动开发 > 详细

Android 页面跳转最简便的方法!

时间:2015-08-06 18:10:15      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:

第一步:

 1     /**
 2      * 获取所有的Activtiy
 3      * 
 4      * @return
 5      */
 6     public static SparseArray<String> getCompanyPackageName() {
 7         String packbackName = "com.tiancheng.business.activity.";
 8         SparseArray<String> array = new SparseArray<String>();
 9         array.put(2, packbackName + "NoticeActivity");
10         array.put(3, packbackName + "ManagerInfoFriendActivity");
11         array.put(6, packbackName + "CompanyTogetherActivity");
12         array.put(11, packbackName + "ServiceNeedApplyActivity");
13         array.put(12, packbackName + "ServiceProgressSearchActivity");
14         array.put(13, packbackName + "ServiceResultScoreActivity");
15         array.put(14, packbackName + "ServiceProjectSearchActivity");
16         array.put(32, packbackName + "ServiceProjectGroupSearchActivity");
17         array.put(38, packbackName + "ComplaintListActivity");
18         array.put(39, packbackName + "PublishMessageActivity");
19         array.put(40, packbackName + "MyMessageActivity");
20         return array;
21     }

第二步:

 1 /**
 2      * 设置权限
 3      */
 4     private void setCompanyAuthority(int position) {
 5         SparseArray<String> array = Utils.getCompanyPackageName();
 6         for (int i = 0; i < array.size(); i++) {
 7             if (position == array.keyAt(i)) {
 8                 Intent intent = null;
 9                 try {
10                     intent = new Intent(this, Class.forName(array.valueAt(i)
11                             .toString()));
12                     intent.putExtra("Flag", 0);
13                     intent.putExtra("ID", 0);
14                     intent.putExtra("FWXMID", 0);
15                 } catch (ClassNotFoundException e) {
16                     e.printStackTrace();
17                 }
18                 startActivity(intent);
19             }
20         }
21     }

到此为止.....

Android 页面跳转最简便的方法!

标签:

原文地址:http://www.cnblogs.com/leichentao0905/p/4708665.html

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