小编Jos*_*aba的帖子

(Kotlin) Backend Internal error: Exception during code generation

I am creating a very thorough converter for Android with Kotlin, using the latest Android Studio Canary build and latest Kotlin. I am suddenly getting a compiling error, even thought Android Studio doesn't see any bug in the code, it is complaining about a backend error, so I think my project is good but the Android Studio has a bug?? Please help confirm, this has been a lot of work....

It is complaining about my class MassCalc, which is 6500 …

java android code-generation exception kotlin

14
推荐指数
4
解决办法
6364
查看次数

Flutter 无法从剪贴板读取

我来问一个关于 Flutter 和 Future 的非常具体的问题,并且等待机制似乎有效,但是我的剪贴板在使用我的可编辑文本字段时并没有真正起作用,即使遵循谷歌关于实施的建议......

这是我的粘贴代码:

onPressed: () async {
  await getMyData('text');
  _encodingController.text = clipData;
  Scaffold.of(context).showSnackBar(
    new SnackBar(
      content: new Text(
        "Pasted from Clipboard"),
      ),
    );
},
Run Code Online (Sandbox Code Playgroud)

什么不起作用是我的粘贴功能......在调试以下函数的结果时为空,wth?????????

static Future<ClipboardData> getMyData(String format) async {
    final Map<String, dynamic> result =
        await SystemChannels.platform.invokeMethod(
      'Clipboard.getData',
      format,
    );

    if (result == null) {
      return null;
    } else {
      clipData = ClipboardData(text: result['text']).text;
      return ClipboardData(text: result['text'].text);
    }
  }
Run Code Online (Sandbox Code Playgroud)

我可能正在使用期货和异步等待错误,希望得到一些指导!!!使用剪贴板管理器插件进行复制!非常感谢!

clipboard asynchronous future dart flutter

5
推荐指数
2
解决办法
6620
查看次数

Kotlin BitmapFactory IllegalStateException

我目前正在处理的应用程序加载一个片段并将其呈现到 activity_main.xml ,这工作正常。问题是我实现了一个 RecyclerView 和一个 CardView,以便动态列出我的技能。得到如下错误:

java.lang.IllegalStateException: 
BitmapFactory.decodeResource(ic_launcher_foreground) must not be null
Run Code Online (Sandbox Code Playgroud)

此代码位于加载相应片段的 Kotlin 片段中 ( SkillFragment )

package smartline.jjba.storyofmylife

import android.graphics.BitmapFactory
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.RecyclerView
import smartline.jjba.storyofmylife.R.id.rv
import androidx.recyclerview.widget.LinearLayoutManager


class SkillFragment : Fragment() {

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? =
        inflater.inflate(R.layout.fragment_skills, container, false)

companion object {
    fun newInstance(): SkillFragment = SkillFragment()
}

fun addItemsToCard(items: ArrayList<MyData>) {

    items.run {
        add(MyData("text 1", BitmapFactory.decodeResource(resources, R.drawable.ic_launcher_foreground)))
        add(MyData("text 2", BitmapFactory.decodeResource(resources, …
Run Code Online (Sandbox Code Playgroud)

android exception bitmap kotlin

4
推荐指数
1
解决办法
2336
查看次数