Markdown Converter
Agent skill for markdown-converter
2. 算法 链表翻转 异或取数组中的不同数
Sign in to like and favorite skills
Gson gson = new Gson(); Reader reader = new FileReader("/path/to/file"); YourBean bean = gson.fromJson(reader,YourBean.class);
largeheap="true",能缓解部分机型即时系统什么鬼
设计模式的几种大的分类
微信,支付宝支付需要准备的参数
锁屏和锁屏30秒发生了什么
gzip炸弹
imageview包含context的回掉
leak canavy
主语从句 状语从句
微博全景图PanoramaImageDetailView, 图片只是ImageView
DialogFragment + 动画方向 = 弹出页面带阴影
builder模式
public class MyBuilder{ private int id; private String num; public MyData build(){ MyData d=new MyData(); d.setId(id); d.setNum(num); return t; } public MyBuilder setId(int id){ this.id=id; return this; } public MyBuilder setNum(String num){ this.num=num; return this; } } public class Test{ public static void main(String[] args){ MyData d=new MyBuilder().setId(10).setNum("hc").build(); } }
阿里 https://www.nowcoder.com/discuss/30553?type=2&order=3&pos=9&page=1
https://www.nowcoder.com/discuss/29609?type=2&order=3&pos=10&page=1
https://www.nowcoder.com/discuss/30334?type=2&order=3&pos=8&page=1
第 1 天
第 2 天
第 3 天 Activity生命周期
第 4 天 如何判断Activity是否在运行
第 5 天
第 6 天
第 7 天 Java的值传递和引用传递
第 8 天
第 9 天 Parcelable和Serializable
第 10 天 context
第 11 天
第 12 天
第 13 天
第 14 天
第 15 天
第 16 天
第 17 天
第 18 天
第 19 天
第 20 天
第 21 天
第 22 天
第 23 天
第 24 天
第 25 天
第 26 天
第 27 天
第 28 天
第 29 天
第 30 天
第 31 天
第 32 天
第 33 天
第 34 天
第 35 天
第 36 天
第 37 天
第 38 天
第 39 天
第 40 天
第 41 天
第 42 天
第 43 天
第 44 天
第 45 天
IntentService
Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path期待的数组,结果返回的是ObjectActivity 上有 Dialog 的时候按 home 键时的生命周期
fragment 各种情况下的生命周期
横竖屏切换的时候,Activity 各种情况下的生命周期
Application 和 Activity 的 context 对象的区别
链表逆序
求二叉树两个节点最短路径
序列化的作用,以及 Android 两种序列化的区别
List 和 Map 的实现方式以及存储方式
线程如何关闭,以及如何防止线程的内存泄漏
Linux 的一些常用指令
ANR
SurfaceView
OpenGL
OkHttp
HttpURLConnection
Android 系统的启动过程
RxJava 如何管理生命周期
图片缓存策略
Okio 源码
OkHttp 中和 WebView 中 Cookie 是怎么处理的
Android 上 Socket 的使用
注解
Android 上的进程通信、共享内存问题
Webp 格式
内存泄漏的根本原因
堆内存和栈内存的区别
弱引用软引用区别
Serializable 和 Parcelable 的区别
ListView 的实现原理
Java 中同步方法
非主线程更新 UI 的可能性
Freeline 插件提升编译速度
Overview 查看任务列表 ,标题怎么修改
ids是 from 自定义的xml文件, android 需要对view设置唯一的标志ID来区分, 自定义空间的命名
<?xml version="1.0" encoding="utf-8"?> <resources> <item name="card_layout" type="id"/> <item name="card_actionarea" type="id"/> <item name="card_contentarea" type="id"/> <item name="card_title" type="id"/> <item name="card_content" type="id"/> <item name="card_overlay" type="id"/> </resources>
Listview 和 ScrillView冲突
StringBuilder的优势(为止长度的字符串才考虑sb).java9使用 makeconcatwithconstants
字面量
知乎上了的三方CameraKit, FloatingActionButton
-10<x<10和Math.abs(x)<10
animator is Running?
androidstudio set up jdk 解决方案: Invalidate Caches and Restart
activity的finish()方法并不会立即执行, 即使最简单的activity都会执行完oncreate后才z执行
.nomedia(https://zmywly8866.github.io/2016/05/05/android-disable-mediascanner-folders.html)
ScrollView撑满全屏: fillViewport
switch和多重if的区别
persistentHead Drawer
珊瑚虫修改pe结构,注入器加载github
equals, ==,hashCode. == 比较对象时看引用地址. equals()是交给开发者去覆写的, String.equals() 覆写了 object 的 equals() 所以.字符串和对象比较用equals(), 但要 注意equals()前的变量是否为空
TextUtils.isEmpty TextUtils.isEmpty(): if (str == null || str.length() == 0) String.isEmpty(): return count == 0
try catch finally参考
先执行try中的return 后的表达式, 并隐性返回(如返回String的地址, 类的地址, 但若return 套了 return 先不执行后一个return),
再执行 finally
最后把 try 的 return 显性执行(),(执行完之前的 return 里的 return)
DecorView 的布局
windowIsTranslucent 设置true, ActivityA 跳到 ActivityB, A的onStop会不走
String indexOf 从第0位开始算
substring(start, end), 左闭右开
path 绘制 Rect 时无法设置起点, 只能用 line 拼接
bitmap 和 drawable * public abstract class Drawable * public final class Bitmap implements Parcelable * public class BitmapDrawable extends Drawable * bitmap 存储像素信息, Drawable 存储的是 canvas 的一系列操作, BitmapDrawable 是把 bitmap 渲染到 Drawable 上. * 前者重数据, 后者重行为 * BitmapDrawable(Resources res, Bitmap bimap), 传入的res 用于获取屏幕密度, 非必须
屏幕适配 * 屏幕尺寸: 屏幕的对角线, 单位:英寸inch, 如5 * px: 屏幕上横向和纵向的像素, 400X800, 宽高的单位, px = density * dp * density = dpi/160, DisplayMetrics.density * px = dp * dpi/160 * dpi: dots per inch, 像素密度, 每英寸像素点数 = DisplayMetrics.densityDpi = 根号下(宽平方+高平方) /屏幕尺寸 * dp/dip: 设备独立像素, dpi=160的屏幕上, 1dp = 1px. -> dip = (dpi/160) * px
Recyclerview 不走 onCreateViewHolder/onBindViewHolder
这样做的好处是相当于取模且效率高于取模. 同时容量为2的n次方的原因也是这个. 当 length = 15时, length - 1 = 14static int indexFor(int h, int length) { return h & (length-1); }
| h | length-1 | h&lengeh-1 | result |
|---|---|---|---|
| 0 | 14 | 0000 & 1110 = 0000 | 0 |
| 0 | 14 | 0001 & 1110 = 0000 | 0 |
| 0 | 14 | 0010 & 1110 = 0010 | 2 |
| 0 | 14 | 0011 & 1110 = 0010 | 2 |
| 0 | 14 | 0100 & 1110 = 0100 | 4 |
| 0 | 14 | 0101 & 1110 = 0100 | 4 |
| 0 | 14 | 0110 & 1110 = 0110 | 6 |
| 0 | 14 | 0111 & 1110 = 0110 | 6 |
| 0 | 14 | 1000 & 1110 = 1000 | 8 |
| 0 | 14 | 1001 & 1110 = 1000 | 8 |
| 0 | 14 | 1010 & 1110 = 1010 | 10 |
| 0 | 14 | 1011 & 1110 = 1010 | 10 |
| 0 | 14 | 1100 & 1110 = 1100 | 12 |
| 0 | 14 | 1101 & 1110 = 1100 | 12 |
| 0 | 14 | 1110 & 1110 = 1110 | 14 |
| 0 | 14 | 1111 & 1110 = 1110 | 14 |
| 共发生了 8 次碰撞, 空间的浪费也是一半, 而选择 2 的 n 次方作为 length 时, 不容易发生碰撞 |
Field[] fields = obj.getClass().getFields(); for(Field field :fields){ if(field.getType()==AAA.class){ AAA oldValue = (AAA)field.get(obj); } }
public interface A{ } public interface B{ } public interface C{ public A a(); public B b(); }
实现C的类们
Animal a = new Bird(); a.eat();
或一个接口的参数要求父类, 也可以穿进去子类
Animal a = new Bird(); Bird b = (Bird)a; b.fly();
常规 GC 算法
分代 年轻代用复制, 老年代用标记压缩
Dalvik GC 算法是 Mark-Sweep.
GC阶段必须stw一次, 防止刚还有引用的对象突然又没了引用. 为了减少stw, 引入了并行的垃圾回收算法 Concurrent GC. ART还并行处理GC
String a = "aaa"; //字面量创建, 编译期就被确定了, 存入常量池
String b = "a"+"a"+"a"; //编译器就被解析为a一样的字面量
String c = new String("aaa"); // 通过 new 关键字按照一般对象创建, 不会放入常量池.
String d = "a" + new String("aa"); //编译期无法创建new String, 所以还是一般对象
String s2 = String.intern(); //在运行时去常量池找是否有相同 Unicode 的字面量常量,没有就把str复制后放进常量池. 1.7不复制, 放进对中str对象的引用
intern()在 jdk 1.6 和 1.7 的改变
数值 | constant pool a| a
“abc”; constant pool 里有
new String("abc"); constant pool 里有
new StringBuilder; 单纯的, constant pool 里有, 如果多了append(), constant pool 里就没有.
new String("a")+new String("bc"); constant pool里没有!(new String + new String 会被翻译成 new StringBuilder)
str.intern == str //当且仅当之前没有""和 new String("")相同内容时
intern 移入的不是 constant pool
Kitkat4.4 引入, 可切换, 5.0 设为默认特性, 主要特征是 ART 解释器.
ART(Android Run Time) 是一种 AOT 编译器, 在运行前就把中间代码编译成本地代码. 安装慢, 占用空间, 但是执行时省电, 而老版本的 JIT 是运行时动态编译,
android打包流程: Java 编译器将所有 Java 文件编译为 class 文件 dx工具将 class 文件转为 dex 字节码, 即 dex 文件 之后签名, 对齐, 变为 APK(APK中包含dex文件) Dalvik 可以看作 JVM, 负责将dex文件解释为机器码, 如果不做处理, 每次都需要将 dex 代码编译成微处理器指令, 效率不高. 于是2.2加入了 JIT, 当 App 运行时, 每当遇到一个新类, JIT 会对这个类进行编译, 编译后的代码会被优化为相当精简的原生型指令码, 这样下次执行相同逻辑时会更快 当然编译也是花时间的, 如果执行次数很少, 编译花的时间可能还比执行多, 所以谷歌没对所有代码编译, 只编译执行次数较多的代码为本地机器码, 但是弊端仍然是 dex 编译为机器码需要耗费时间 同样, JIT 编译发生在 app 运行时, 所以每次打开 app 时, 都需要 JIT 编译 5.0 开始默认的 AOT, 第一次安装时dex字节码就全部编译成机器码存在了本地, 每次运行时也不需要编译, 直接读取本地机器码,
Android 4.x(Interpreter + JIT)参考
Android 5.0/5.1/6.0(Interpreter + AOT)
Android 7.0/7.1 Hybrid(Interpreter + JIT + AOT)
/** * 调整窗口的透明度 * @param from>=0&&from<=1.0f * @param to>=0&&to<=1.0f * * */ private void dimBackground(final float from, final float to) { final Window window = getWindow(); ValueAnimator valueAnimator = ValueAnimator.ofFloat(from, to); valueAnimator.setDuration(500); valueAnimator.addUpdateListener(new AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { WindowManager.LayoutParams params = window.getAttributes(); params.alpha = (Float) animation.getAnimatedValue(); window.setAttributes(params); } }); valueAnimator.start(); }
调用
/** 窗口背景变暗*/ dimBackground(1.0f,0.5f); /** 窗口背景变亮*/ dimBackground(0.5f,1.0f);
window.setBackgroundDrawableResource(android.R.color.transparent);
才能让xml按照设定的UI展示,
//存 Gson gson = new Gson(); String s = gson.toJson(markedMemberList); SharePrefUtil.setStr("markMemberList", s);
//取 Gson gson = new Gson(); List<String> markedMemberList = gson.fromJson(markMemberList, new TypeToken<List<String>>(){}.getType());
@Override public void onStart() { super.onStart(); WindowManager.LayoutParams attributes = getDialog().getWindow().getAttributes(); float dimAmount = attributes.dimAmount; attributes.dimAmount = 0.4f;//此处设置透明度 LogUtil.i("dimAmount", dimAmount+""); getDialog().getWindow().setAttributes(attributes); getDialog().getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); }
textview 需要多个空格,
" "无效, 使用   , 但是需注意, replace(" ","")无效, 需replaceAll("\\s*", "").
textview 添加多个 String, 不能直接
%s, 而需要 %1$s 和 %2$s
studio 报错 Error:Failed to complete Gradle execution. Cause: Write access is allowed from event dispatch thread only
drawPath drawPath 画线时须设置为Stroke.
自定义view画虚线.
PathMeasure, 需要在path画完后在setPath
LinearGradient 的变色构造方法, x,y 的正负会影响变色的顺序.
canvas.translate 会影响
miui8及以上, 裁剪照片bug.参考 裁剪后的图片通过Intent的putExtra("return-data",true)方法进行传递,miui系统问题就出在这里,return-data的方式只适用于小图,miui系统默认的裁剪图片可能裁剪得过大,或对return-data分配的资源不足,造成return-data失败。
解决思路是:裁剪后,intent保存图片的资源路径Uri,在onActivityResult()方法中,再提取对应的Uri图片资源转换为Bitmap使用。
/** * 裁剪图片 */ private void startPhotoZoom(Uri uri, int size) { Intent intent = new Intent("com.android.camera.action.CROP"); intent.setDataAndType(uri, "image/*"); // crop为true是设置在开启的intent中设置显示的view可以剪裁 intent.putExtra("crop", "true"); // aspectX aspectY 是宽高的比例 intent.putExtra("aspectX", 1); intent.putExtra("aspectY", 1); // outputX,outputY 是剪裁图片的宽高 intent.putExtra("outputX", size); intent.putExtra("outputY", size); /** * 此方法返回的图片只能是小图片(sumsang测试为高宽160px的图片) * 故只保存图片Uri,调用时将Uri转换为Bitmap,此方法还可解决miui系统不能return data的问题 */ //intent.putExtra("return-data", true); //裁剪后的图片Uri路径,uritempFile为Uri类变量 uritempFile = Uri.parse("file://" + "/" + Environment.getExternalStorageDirectory().getPath() + "/" + "small.jpg"); intent.putExtra(MediaStore.EXTRA_OUTPUT, uritempFile); intent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString()); startActivityForResult(intent, PHOTO_REQUEST_CUT); }
/** * 处理返回结果 */ @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // TODO Auto-generated method stub case PHOTO_REQUEST_CUT: //将Uri图片转换为Bitmap Bitmap bitmap = BitmapFactory.decodeStream(getContentResolver().openInputStream(uritempFile)); //TODO,将裁剪的bitmap显示在imageview控件上 break; } super.onActivityResult(requestCode, resultCode, data); }
java.sql.SQLException: queryForLong from database failed: SELECT COUNT(*) FROM `uploadmissionbean` WHERE `id` = ?
表未创建/更新
多个 notification NotificationManager.notify(id, builder.build()); 不同 id 创建不同通知栏
Service Service Intent must be explicit 5.0 开始 service 的intent 需要显示调用
Service 弹 Toast, 需要切换到主线程(Toast需要加进Looper)
Looper.loop(); 是个死循环, 其后的代码无法运行
2018-11-12T07:41:25Z 格林尼治时间线
数据库的设计: 所有字段都是不可分解的原子值, 每一列都和主键相关,
热点下gradle 速度慢, 梯子
Animation 在 RecyclerView 下会被打断, 替换为 ValueAnimator
边缘阴影
Service 的 onStartCommand 中, 传入的 intent 可能为null, 因为是系统杀掉的, 再次打开的时候没intent, 所以补充判断, 并且return START_REDELIVER_INTENT;
UpdateManager
x.compareTo(y)
git rm -r --cached . git add . git commit -m 'update .gitignore'
layoutAnimation http://www.jcodecraeer.com/a/anzhuokaifa/androidkaifa/2017/0807/8348.html
MAT, GIMP 查看heap
FinalizerReference 内存泄漏
daemon
singleTop 和 startActivityForResult 冲突
依赖查询
所有请求放入service 地址: https://github.com/taoliuh/v2ex/blob/master/v2ex/src/main/java/com/sonaive/v2ex/provider/V2exProvider.java
Service 替换 WorkManager
GlideApp, 需要创建在 Application 同级别下的注解 class
module 引入 jar, gradle 添加
sourceSets { main() { jniLibs.srcDirs = ['libs'] } }
implementation 只针对当前包可用, module 引入 jar, 需使用 compile, 这样别的引用了这个 module 的 app 才可以用里面的 jar
共享元素的finish(), 替换为 supportFinishAfterTransition();
蓝牙scanMode 使用 SCAN_MODE_LOW_POWER, SCAN_MODE_LOW_LATENCY 会导致结束的时候多扫出一个设备 https://codeday.me/bug/20180714/195217.html
ConcurrentModificationException, 增强for/remove 导致 https://juejin.im/post/5a992a0d6fb9a028e46e17ef
Timer already cancelled, timerTask只可被schedule 1 次
Android Studio 获取SHA1
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
keytool -list -v -keystore /Users/fred/Documents/GitHub/lanbuff-coach-app-android/lanbufflite.jks -alias key0 -storepass lan123 -keypass lan123
tvLessonTime.setTextSize(TypedValue.COMPLEX_UNIT_PX, itemView.getResources().getDimension(R.dimen.dp_24));
((SimpleItemAnimator)recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
recyclerView.getItemAnimator().setChangeDuration(0);
<provider android:name="android.support.v4.content.FileProvider" android:authorities="${applicationId}.fileprovider" android:grantUriPermissions="true" android:exported="false"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" /> </provider>
public boolean canScrollVertically() { return false; }
https://blog.csdn.net/dawanganban/article/details/51148070 https://www.jianshu.com/p/27530fbbe5a3
7.0拍照 https://blog.csdn.net/u010356768/article/details/70808162
setResult 不能放在onDestroy 嵌套activity, 每个都要onActivityResult
%s, 单独的时候直接, 2个及以上是%1$s, %2$s, 序号和$必不可少
NestedScrollView
simplePagerTitleView.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimensionPixelSize(R.dimen.dp_32)); 设置textSize.
使用tint修改颜色
ViewRootImpl: jank_removeInvalidNode jank list is null 华为9.0P20pro折线图 bug
retrofit, compose()里设置为DESTROY, 否则PAUSE时会被权限请求打断请求 艺术开发探索25页
super构造方法, 须super在前, 其他不必须
旋转屏幕, activity 调用 onSaveInstance, 此时的 FragmentManager 的 commit 会导致运行时异常.
onRestoreInstance, 需在 activity 被销毁后才调用, 非必须和 onSaveInstance 同时出现
No static method/NoSuchMethodError, 可能导入了一个包的不同版本.
elevation, 必须是background, image 设置 src无效
Edittext 在投屏状态下无法展示
gradiant, 设置的angle 需要是45的倍数
json optString(); 获取不存在的字段时不会报异常
LOCATION_HARDWARE 为隐私级权限, 三方app无法获取
设置+app 两个界面切换, 设置打开权限, app 正常 onPause->onResume; 设置关闭权限, app 重启 onCreate
华为8.0.0 权限问题, 说明地址, 地址2 SplashActivity, 在acitvity 刚打开时弹出dialog会报activity的setcontentView为空 报错内容:
unable to start activity ComponentInfo android.content.res.Resources$NotFoundException: Resource ID #0x0 DeadObjectException
webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
urlConnection.setRequestProperty("Accept-Encoding", "identity");
关闭压缩
//打开vim, 如果没有则新建 touch .bash_prifile vim .bash_profile //进入编辑, 底部变成 --INSERT-- 按 i //输入内容 //退出编辑模式, 隐藏 --INSERT-- 按 esc //保存 :wq! //生效配置 source .bash_profile
Error:Execution failed for task ':app:compileDebugKotlin'. > Compilation error. See log for more details
解决:点开右侧Gradle, 选择"project名称"->":app"->"Tasks"->"build"->"assembleDebug"或者"assembleMyFlavor"参考 调度算法 245. 向下兼容 = 向后兼容 back compatibility(后:落后,对过去的兼容负责) 246. ARM,X86(参考)[https://zhuanlan.zhihu.com/p/21266987]
gnustl_static, c++_static 或 c++_shared 二选一sudo gedit .bashrc
~/.bashrc : 该文件包含专用于你的bash shell的bash信息,当登录时以及每次打开新的shell时,该该文件被读取。 ~/.profile : 在登录时用到的第三个文件 是.profile文件,每个用户都可使用该文件输入专用于自己使用的shell信息,当用户登录时,该文件仅仅执行一次!默认情况下,他设置一些环境变量,执行用户的.bashrc文件。 /etc/bashrc : 为每一个运行bash shell的用户执行此文件.当bash shell被打开时,该文件被读取. /etc/profile : 在登录时,操作系统定制用户环境时使用的第一个文件 ,此文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行。
sudo vi /Library/Preferences/VMware\ Fusion/vmnet8/nat.conf
找到[incomingtcp]部分,配置
[incomingtcp] # Use these with care - anyone can enter into your VM through these... # The format and example are as follows: #<external port number> = <VM's IP address>:<VM's port number> #8080 = 172.16.3.128:80 你MAC的端口 = VM的IP:VM的端口
重启服务
sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli --stop sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli --start
permission 报错
Permission denied, please try again.
打开 ssh 的 root 权限
E325: ATTENTION
rm -rf 删除xxx.swap文件
ByteArrayOutputStream output = new ByteArrayOutputStream();//初始化一个流对象 qrBitmap.compress(Bitmap.CompressFormat.PNG, 100, output);//把bitmap100%高质量压缩 到 output对象里 byte[] result; //将bitmap转化的byte数组 result = output.toByteArray();//转换成功了 result就是一个bit的资源数组 Intent intent = new Intent(getActivity(), ShareActivity.class); intent.putExtra("qrbitmap", result); startActivity(intent);
接收
byte[] qrbitmapByte = getIntent().getByteArrayExtra("qrbitmap"); mQrBitmap = getPicFromBytes(qrbitmapByte,null); //下面的这个方法是将byte数组转化为Bitmap对象的一个方法 public static Bitmap getPicFromBytes(byte[] bytes, BitmapFactory.Options opts) { if (bytes != null) if (opts != null) return BitmapFactory.decodeByteArray(bytes, 0, bytes.length, opts); else return BitmapFactory.decodeByteArray(bytes, 0, bytes.length); return null; }
HTTP/1.1 200 Connection Established), 这个 HEAD 结束后的内容均为远程服务器返回的内容,直到TCP通道关闭一个完整的请求至少包含请求行,请求头,CRLF这三部分Ref:RFC2016的第五章Request
根据Content-Type的内容, 分为

RequestBody requestBody = new MultipartBody.Builder() .setType(MultipartBody.FORM) .addFormDataPart("userId", SharedPreferencesUtils.getStringData(this, Constant.sp_user_id, "")) .addFormDataPart("version", Utility.getVerName(LanbuffApp.getInstance())) .addFormDataPart("device", Utility.getDeviceId()) .addFormDataPart("phone", uploadMissionBean.getPhone()) .addFormDataPart("studentIds", uploadMissionBean.getStudentIds()) .addFormDataPart("coachId", uploadMissionBean.getCoachId()) .addFormDataPart("footprintTime", DateStrUtil.dateToStrSS(new Date())) .addFormDataPart("content", uploadMissionBean.getContent()) .addFormDataPart("images", imageFile.getName(), RequestBody.create(MediaType.parse("image/*"), imageFile)) .build(); uploadApi.sync2FootprintUrl(requestBody) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Subscriber<BaseResponseBean>() { 以及请求api中: @POST(Constant.url_sync_2_footprint) Observable<BaseResponseBean> sync2FootprintUrl(@Body RequestBody body);
POST /servlet/default.jsp HTTP/1.1 Accept: text/plain; text/html Accept-Language: en-gb Connection: Keep-Alive Host: localhost Referer: http://localhost/ch8/SendDetails.htm User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows 98) Content-Length: 33 Content-Type: application/x-www-form-urlencoded Accept-Encoding: gzip, deflate LastName=Franks&FirstName=Michael
HTTP/1.1 200 OK Server: Microsoft-IIS/4.0 Date: Mon, 3 Jan 1998 13:13:33 GMT Content-Type: text/html Last-Modified: Mon, 11 Jan 1998 13:23:42 GMT Content-Length: 112 < html> < head> < title>HTTP Response Example</title></head><body> Welcome to Brainy Software < /body> < /html>
270度时会失效,反向用45加颜色对调替代
Module:app中添加
lintOptions { checkReleaseBuilds false abortOnError false }
tabLayoutMultiMain.getTabAt(0).setCustomView(getTabView("工作台",R.drawable.icon_workbench_notselect)); tabLayoutMultiMain.getTabAt(1).setCustomView(getTabView("我",R.drawable.icon_workbench_notselect)); public View getTabView(String title, int image_src) { View v = LayoutInflater.from(getApplicationContext()).inflate(R.layout.tab_multi_main, null); TextView textView = v.findViewById(R.id.tv_item_multi_main_name); textView.setText(title); ImageView imageView =v.findViewById(R.id.iv_item_multi_main_icon); imageView.setImageResource(image_src); v.setTag(title);//因为我用tag去区分点击的item,如果你用的tab.getPosition可以不设置这个值 return v; }
泛型在编译期类型被擦除导致
gradlew compileDebugSources --stacktrace -info
android:focusable="true" android:focusableInTouchMode="true"
allprojects { repositories { google() jcenter() maven { url "https://maven.google.com" } maven { url "http://dl.bintray.com/laobie/maven" } } }
private 只可自己用 默认多一个同包里的类 protected子类也可以 public 跨包
###274. 嵌套RecyclerView 第二个RecyclerView的高度不能是0dp
剪切下错误的部分再贴回去
placeholder 设置为当前图片的Drawable placeholder(imaveView.getDrawable())
in.readTypedList(orderList, OrderListBean.CREATOR); 和 dest.writeTypedList(orderList);