Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 07ebc38

Browse files
author
haohao
authored
Update README.md
1 parent ea616e1 commit 07ebc38

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

‎README.md‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -912,4 +912,30 @@ superFunc("这是一个高阶函数 ") { argFun() }
912912

913913
```
914914
---
915+
### 简单异步
916+
**Java (Java 8)**
917+
```java
918+
new Thread(() -> {
919+
920+
data = DataSource.obtain(); //耗时操作
921+
922+
runOnUiThread(() -> {
923+
924+
view.load(data); //更新 UI
925+
926+
});
927+
928+
}).start();
929+
930+
```
931+
**Kotlin (Kotlin Anko)**
932+
```kotlin
933+
async {
934+
data = DataSource.obtain(); //耗时操作
935+
936+
uiThread {
937+
view.load(data); //更新 UI
938+
}
939+
}
940+
---
915941
## 持续更新中。。。

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /