近期在更改程序架构的时候,用引用Library的方式实现程序的共享化过程中发现R.id.xx的文件不能够在 switch cases 中使用 看代码提示,如下信息: As of ADT 14, resource fields cannot be used as switch cases. In other words, the constants are not final in a library project. The reason for this is simple: When multiple library projects are combined, the actual values of the fields (which must be unique) could collide. Before ADT 14, all fields were final, so as a result, all libraries had to have all their resources and associated Java code recompiled along with the main project whenever they were used. This was bad for performance, since it made builds very slow. It also prevented distributing library projects that didn't include the source code, limiting the usage scope of library projects.

解决的方法是把switch cases 改成 if else的方式,在eclipse中可以使用 ctrl+1快捷方式切换。

更多相关文章

  1. 关于Android抛出java.lang.SecurityException: Permission Denia
  2. Android--获取安装的程序信息
  3. 最简单的BufferQueue测试程序(一)
  4. Android(安卓)注解的方式绑定UI ID
  5. android handler 多线程
  6. Android调用系统设置
  7. Android(安卓)在一个应用中如何启动另外一个已安装的应用!!!
  8. Android(安卓)Trusty TEE 2.启动分析
  9. Android短消息推送启动应用程序(SMS PUSH)(BroadCastReceiver)

随机推荐

  1. SQL Server中的T-SQL的基本对象
  2. SQL MSSQL 常用代码大全
  3. MSSQL数据库迁移之用户名问题
  4. sqlserver 数据库被注入解决方案
  5. win2003 安装 sqlserver 2005的方法
  6. sql 版本详解 让你认识跟sql2000的区别
  7. SQLSERVER 时间格式大全
  8. sqlserver replace函数 批量替换数据库中
  9. sql 中 case when 语法使用方法
  10. 将MS SQL SERVER数据库运行在普通用户(独