美文网首页
BA中的错误手札

BA中的错误手札

作者: _chuuuing_ | 来源:发表于2016-08-20 23:48 被阅读0次

adb

adb: command not found的时候,安装adb

try...catch

try 语句提供一种机制,用于捕捉在块的执行期间发生的各种异常。在try语句中定义的变量就是只能在try语句中使用
用得好:用户友好性💯
用得不好:隐藏Bug,未解决根本问题!

Google API in Android-Developer

Google API在Android Studio

implement和import之间

import的是包,
implements的是接口
别弄错了!

Android项目包的命名习惯

com.example.app.activity Activity 类
com.example.app.widget 自定义的小UI
com.example.app.db 数据库相关操作
com.example.app.bean 实体
com.example.app.engine 存放业务层,因为service冲突
com.example.app.service 服务
com.example.app.util 工具类
com.example.app.constant 常量包类
com.example.app.adapter 适配器类
com.example.app.receiver 广播接收器
com.example.app.listener 监听器
com.example.app.模块名称.api 第三方模块包

自动生成Setter/Getter

Code -> generate -> 选择你要的 -> 确定


generate选项

new一个对象 vs 类名.getInstance()

new一个新对象包括两步:
-> 加载类
-> 实例化

类名.getInstance()
-> 就是实例化,不一定要新建对象(比如我只想调用某类中的int类型的方法,那我就用int i=类名.getInstance().方法名())

final

final是java中的一个关键字,可以用来修饰变量、方法、类和域。
-> final变量:一旦赋值就不能改变,也称为常量。
-> final类:这个类不能被继承

Activity.findViewById( ) vs View.findViewById( ) vs findViewByTag( )

转载自这里

Tag在监听事件里面的使用

转载自这里

Serializable - Wrong 2nd argument!

程序有建立一个实体类Plant.class,这里报错,说对象无法序列化!

ERROR
解决方法:
在Plant这个类中继承Serializable接口Class Plant implements Serializable 即可解决

相关文章

  • BA中的错误手札

    adb adb: command not found的时候,安装adb try...catch try 语句提供一...

  • 【Linux】yum安装软件报错

    错误提示 yum安装软件显示错误:cannot find a valid baseurl for repo: ba...

  • 安装rpmbuild缺失的依赖

    错误: rpmbuild -ba ~/rpmbuild/SPECS/ceph.specerror: Failed ...

  • 山海手札——目录

    山海手札,引子——第一话,天地浩劫 山海手札,引子——第二话,麒麟崖 山海手札,引子——第三话,无名神祗 山海手札...

  • iOS---Xib字体,怎样在纯代码中使用

    开发中遇到一个问题,UI想要的字体,在Xib中显示为“手札体-简” 但是如果想要在纯代码中使用此字体,不可能写手札...

  • nginx+php显示 502 bad gateway的解决方法

    502 Bad Gateway nginx/1.2.9 在百度上查找错误信息:nginx+PHP 错误502 ba...

  • nginx+php显示 502 bad gateway的解决方

    502 Bad Gateway nginx/1.2.9 在百度上查找错误信息:nginx+PHP 错误502 ba...

  • ba ba

    宝宝最近牙牙学语,会在着急的时候憋出mama、mama的发音了。 看到宝妈陶醉又得意的样子,宝爸那个羡慕啊!嫉妒啊...

  • ba~ba

    爸!一个字的简称,包含了天、地、海三种这世间最为伟大的创造! 他像天,给了我无尽的包容撑起我的世界的那片天…… 他...

  • ba~ba

    爸!一个字的简称,包含了天、地、海三种这世间最为伟大的创造! 他像天,给了我无尽的包容撑起我的世界的那片天…… 他...

网友评论

      本文标题:BA中的错误手札

      本文链接:https://www.haomeiwen.com/subject/gvxisttx.html