Android開發之路 1

2021-10-06 09:11:22 字數 590 閱讀 6128

1.android 9之後 網路請求需要載入適配檔案:

network_security_config.xml:

android:networksecurityconfig="@xml/network_security_config"
載入配置檔案即可

2.解決handler記憶體溢位問題建立靜態並且繼承handler的類,使用weakreference弱引用載入activity在其中使用handler的各種功能

//防止handler記憶體溢位 建立靜態繼承handler子類

static class myhandler extends handler

@override

public void handlemessage(@nonnull message msg) else if(msg.what == 2) else if(msg.what == 3)

}}

3.runonuithread 重寫run方法 可以在子執行緒中使用在主線程中更新ui介面

android開發之路3

intent intent new intent intent.action call,uri.parse tel textstr startactivity intent android minline 控制textview的顯示行數 1.狀態列通知 2.對話方塊通知 3.吐絲 toast sms...

Android學習開發之路 系列教程

qianqianlianmeng android學習開發之路1 helloworld例子 android學習開發之路2 動態生成介面 android學習開發之路3 自定義view android學習開發之路4 顯示imageview android學習開發之路5 絕對布局 android學習開發之路...

Android開發小結1

settextcolor 定義為settextcolor int color 正確的使用方法為 btn.settextcolor context.getresources getcolor r.color.red context的傳遞 context,sdk中對其說明如下 在很多時候,在執行操作時,...