这会阻塞 UI 线程,但如果我使用 GlobalScope,则 UI 不会被阻塞。
lifecycleScope.launch {
activity?.runOnUiThread {
Toast.makeText(activity, getString(R.string.txt_savinginprogress), Toast.LENGTH_SHORT).show()
}
val fileName = "Picture" + System.currentTimeMillis().toString()
val folderName = "BucketList"
val bitmap: Bitmap? = photoURI?.let { it1 -> getBitmapFromUri(it1) }
activity?.let {
bitmap?.let { it1 ->
PhotoSaveHelper(it).savePhoto(fileName, folderName, it1)
}
}
activity?.runOnUiThread {
Toast.makeText(activity, getString(R.string.txt_saved), Toast.LENGTH_SHORT).show()
}
}
}
Run Code Online (Sandbox Code Playgroud) https://material.io/develop/android/components/buttons#text-button
从这个参考文献中有一个 setIcon 方法,但我如何才能到达它?

std::vector<int> temp;
temp.insert(temp.begin(), points1.begin(), points1.end());
points1.clear();
std::vector<int> points1(temp.end(), temp.begin());
temp.clear();
Run Code Online (Sandbox Code Playgroud)
我试过这个,但我有一个异常连接到内存分配。