kaleai / android-best-practices Goto Github PK
View Code? Open in Web Editor NEWAndroid最佳实践示例
License: Apache License 2.0
Android最佳实践示例
License: Apache License 2.0
看了你前面提出的需求,发现我写的AssemblyAdapter https://github.com/xiaopansky/AssemblyAdapter 基本都满足,我们可以有进一步的交流
为什么不使用以下方式定义LOG_TAG
private static final String LOG_TAG = MainActivity.class.getSimpleName();
这是google给的方法,看上去比getClassName()函数简洁很多
最后的结果:
对于MainActivity
LOG_TAG = "MainActivity"
以上
可以使用BuildConfig.DEBUG来管理Log,打包时会自动置为false。
Failed to resolve: com.github.tianzhijiexian:logger:2e4dca7ea8
请问是什么原因啊?设置问题?
关于守护进程拉起application初始化的问题,测试结果如下:小米推送是在点击 推送通知后才会拉起,因为用户点击推送消息的时间点不一样,不存在问题;而个推是在守护进程唤醒后会走application。会存在你说的情况。
今天刚看到了commonAdapter的实现,感觉非常不错。但是想到了一个如果AdapterItem中,有时候需要调用onActivityResult方法的回调,楼主有什么解决方案么?
在第一个方法中,StatusBarManager 的对象是从 mContext.getSystemService("statusbar") 获取的,然后利用反射调用了该对象的展开和关闭的方法。
但是在第二个JOOR,create了一个对象,然后调用了这个对象的相应方法。
在第二个方法中,创建的对象不是Context中的对象,所以我怀疑该方法不能起作用。我还没有写的代码验证,但是我感觉这是错的。
不知道我没有说清楚,如果我的理解有误,请指正。
写的挺好的
在Logger中作者丢掉了这个方法,所以现在这么写是报错的。。
平时用得比较多的那种判断convertView
是否为空再去决定convertView
能否被复用。
它复用的原理是,同一种viewType
的时候,只要convertView
不为空,不管多少item都可以复用的。
但是你的这种方式,是否只是item
自己复用自己的view
呢?假如同种类型的item
有100条,是不是创建100个view呢?因为看你的TextItem
类里面貌似都是每次创建一个新的。
如理解错误,请指出。谢谢~
求指导。。
如题
第一个问题:object,map,list,array。能不能和在一起,用一个方法
第二个问题:要支持文件写入,以便后续查找
期待回归。
如果调用位置在匿名内部类的话,就会产生MainActivity$3
这样的TAG, 可以把$后面的去掉,会不会好点
/**
* @return 当前的类名(simpleName)
*/
private static String getClassName() {
String result;
StackTraceElement thisMethodStack = (new Exception()).getStackTrace()[2];
result = thisMethodStack.getClassName();
int lastIndex = result.lastIndexOf(".");
result = result.substring(lastIndex + 1, result.length());
//return result;
int i = result.indexOf("$");
return i == -1 ? result : result.substring(0, i);
}
zan
tools还能这么用
不需要取 lastIndexOf(".")
为什么认为adapter应该是作为Fragment 或者 Activity的内部类? 还是应该根据情况来区分?
您好, 我想加入, 谢谢您啦
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.