摘要:
升级到Android Studio Bumblebee | 2021.1.1 Patch 1之后,ndk build 失败。 IDE抛出ModelCache.safeGet(androidProjectResult.androidProject::getNdkVersion, "") must no 阅读全文
摘要:
有些时候我们使用Service的时需要采用隐私启动的方式,但是Android 5.0一出来后,其中有个特性就是Service Intent must be explitict,也就是说从Lollipop开始,service服务必须采用显示方式启动。 而android源码是这样写的(源码位置:sdk/ 阅读全文
摘要:
FrameLayout fl = (FrameLayout) findViewById(R.id.content); View v = null; try { Context context = createPackageContext("com.sohu.news", Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURIT... 阅读全文
摘要:
在将自己写的工具打成.jar包的时候,有时候会需要引用到res中的资源,这时候不能将资源一起打包,只能通过反射机制动态的获取资源. 特别用在自己定义一个工具将其打成.jar包时,特别注意资源的获取 1、封装成一个工具类 2、资源的获取 TextView.setText(String.format(t 阅读全文
摘要:
public View getView(final int position, View convertView, ViewGroup parent) { if (convertView == null) convertView = LayoutInflater.from(mContext).inflate(R.layout.item, parent, f... 阅读全文
摘要:
MediaStore.Video.Thumbnails.getThumbnail(ContentResolver cr, long origId, int kind, BitmapFactory.Options options) 阅读全文
摘要:
BigDecimal b = new BigDecimal(hour).setScale(1, BigDecimal.ROUND_HALF_UP); setScale(int newScale, int roundingMode);//第一个参数表示保留几位小数。 阅读全文
摘要:
Android textView: setTextSize(TypedValue.COMPLEX_UNIT_PX,22); //22像素 setTextSize(TypedValue.COMPLEX_UNIT_SP,22); //22SP setTextSize(TypedValue.COMPLEX_UNIT_DIP,22);//22DIP 阅读全文
摘要:
在OnPageChangeListener中的onPageScrolled方法里判断@Overridepublic void onPageScrolled(int arg0, float arg1, int arg2) { if(arg0==list.size()-1){ ... 阅读全文