小编Ali*_*adi的帖子

使用kotlin在android studio中共享意图文本

我想使用kotlin使用共享Intent 在我的CardView中共享文本但是kotlin代码中的最后一行有问题代码

 val shareIntent = Intent()
            shareIntent.action = Intent.ACTION_SEND
            shareIntent.putExtra(Intent.EXTRA_STREAM, "ali")
            shareIntent.type = "text/plain"
            startActivity(Intent.createChooser(shareIntent, getResources().getText(R.string.send_to)))
Run Code Online (Sandbox Code Playgroud)

这是代码中的问题

startActivity(Intent.createChooser(shareIntent, getResources().getText(R.string.send_to)))
Run Code Online (Sandbox Code Playgroud)

请帮我

看图像了解我

图片

https://ibb.co/jQwYXw

https://ibb.co/id0tXw

https://ibb.co/fbCU5G

适配器完整代码

class MyAdapter(context: Context, listItem: ArrayList<com.EliteTeam.comedytaste.Model.Movie>) : RecyclerView.Adapter<MyAdapter.MyViewHolder>() {

var Context = context
var movieList = listItem;
var layoutInflator = LayoutInflater.from(context)

override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): MyViewHolder {

    var inflateView = layoutInflator.inflate(R.layout.single_item, parent, false)

    return MyViewHolder(inflateView)
}

override fun onBindViewHolder(holder: MyViewHolder?, position: Int) {

    holder?.moviewTitle?.text = movieList[position].name
    holder?.movieDescription!!.text=   movieList[position].description
    //holder!!.cardImageView!!.background= …
Run Code Online (Sandbox Code Playgroud)

android android-intent kotlin android-studio share-intent

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