小编Hri*_*pta的帖子

Paytm“网络错误”

我尝试使用这两种方法(“标准结账”和“多合一 SDK”)实施 Paytm,但我的交易页面或 Paytm 应用程序从未打开付款,并且我在 onActivityResult 中收到 networkError

我已经在我的节点服务器上成功生成了校验和和 TransactionToken,但是在将 TxnToken 传递给 paytm sdk 时没有发生任何事情。

有没有想过为什么会这样?

android paytm

6
推荐指数
1
解决办法
1014
查看次数

如何在 Coroutine 中进行同步调用

我想让我的网络请求同步,因为第二个请求的输入来自第一个请求的输出。

override fun onCreate(savedInstanceState: Bundle?) {

retrofit1 =Retrofit.Builder()
        .baseUrl("https://jsonplaceholder.typicode.com/").addConverterFactory(GsonConverterFactory.create()).build()

retrofit2 =Retrofit.Builder()
        .baseUrl("https://samples.openweathermap.org/").addConverterFactory(GsonConverterFactory.create()).build()

button.setOnClickListener { view ->
CoroutineScope(IO).launch {
fakeApiRequest()
}}
Run Code Online (Sandbox Code Playgroud)

在我的 fakeApiRequest() 中,我发出了两个网络请求。

private suspend fun fakeApiRequest() {
val result1 :Geo?= getResult1FromApi()
val result2: Long? = getResult2FromApi(result1)}
Run Code Online (Sandbox Code Playgroud)

由于这是一个异步调用,因此我在 getResult2FromApi(result1) 方法中收到 Null Pointer Exception,因为传递的参数为 null。

为了解决这个问题,我不得不在第一次调用中添加延迟(1500)。

private suspend fun getResult1FromApi(): Geo? {
val service:CallService = retrofit1!!.create(CallService::class.java)
val call = service.getUsers()
call.enqueue(object : Callback<List<User>> {
override fun onResponse(call: Call<List<User>>, response: Response<List<User>>) {
g = users.get(0).address.geo
}
override fun onFailure(call: Call<List<User>>, t: Throwable) …
Run Code Online (Sandbox Code Playgroud)

android coroutine kotlin-coroutines

5
推荐指数
1
解决办法
1254
查看次数

如何将布局背景图像一直拉伸到状态栏?

我已经遵循了可能的解决方案,但没有一个有效。我想知道实现此目的的最简单方法...(背景图像覆盖状态栏)

在此输入图像描述

android android-layout

3
推荐指数
1
解决办法
2669
查看次数