小编San*_*ana的帖子

Android:Kotlin TypeCastException:null无法强制转换为非null类型的kotlin.String

我是Kotlin的新手,我正在尝试开发一个音乐应用程序.

我收到了这个我无法解决的错误.当我打开我的应用程序时,会显示歌曲列表,点击一首歌曲,它会重定向到现在播放的屏幕,但点击下一个或上一个按钮,我的应用程序崩溃了.

logcat给出了一个我不明白的TypeCast错误.

守则如下:

class SongPlayingFragment : Fragment() {

var myActivity: Activity? = null
var mediaplayer: MediaPlayer? = null
var startTimeText: TextView? = null
var endTimeText: TextView? = null
var playpauseImageButton: ImageButton? = null
var previousImageButton: ImageButton? = null
var nextImageButton: ImageButton? = null
var loopImageButton: ImageButton? = null
var seekbar: SeekBar? = null
var songArtistView: TextView? = null
var songTitleView: TextView? = null
var shuffleImageButton: ImageButton? = null
var currentPosition: Int = 0
var fetchSongs: ArrayList<Songs>? = null
var …
Run Code Online (Sandbox Code Playgroud)

android android-fragments kotlin

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

标签 统计

android ×1

android-fragments ×1

kotlin ×1