@rick9055

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

kotlin

package com.example.mymovie

import android.os.Bundle
import android.os.Environment
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import com.example.mymovie.ui.theme.MyMovieTheme
import java.io.File

class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
MyMovieTheme {
// A surface container using the 'background' color from the theme
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
/内部ストレージのパス取得/
val path = Environment.getExternalStorageDirectory().getPath()
val dir = File(path)

                /*内部ストレージのファイルオブジェクトを渡す*/
                val imgserch=ImgFilecon()
                imgserch.extract(dir)

                ImgFilecon().extract(dir)
                val list=ImgFilecon().dirurllist()
                Text(text=list.toString())
            }
        }
    }
}

}

class ImgFilecon() {

var imgdirurl: MutableList<String> = mutableListOf()

fun extract(dir: File) {
    for (i in dir.listFiles()) {
        if (i.listFiles() != null) imgserch(0, i.listFiles().reversed(), false, i)
    }
}

tailrec fun imgserch(i: Int, filelist: List<File>, flag: Boolean, dir: File): Boolean {
    if (flag && !dir.isDirectory) return true

    if (filelist[i].isFile && !flag) {
        when (Extension().extensionsplit(i.toString(), ".")) {
            "mp4", "MP4" -> {
                val data = i.toString()
                imgdirurl.add(data)


            return imgserch(i + 1, filelist, true, dir)
        }
        else -> { return imgserch(i + 1, filelist, false, dir) }
    }
}


if(filelist[i].isFile && flag) return imgserch(i+1,filelist,true,dir)

    if (filelist[i].isDirectory && flag) return imgserch(0, filelist[i].listFiles().reversed(), false, filelist[i])
    if (filelist[i].isDirectory && !flag) return imgserch(i+1, filelist,false,filelist[i])

        return true
}
fun dirurllist():MutableList<String>{
    return imgdirurl
}

}

class Extension {

/*区切り文字で分割するメソッド*/
fun extensionsplit(filename: String, splitps: String): String {

    /*splitpsで指定した文字のindex*/
    val point = filename.lastIndexOf(splitps)

    if (point != -1) {
        /*pointより下の部分を切り出す*/
        /* 例 xxxx.jpg→jpg*/
        return filename.substring(startIndex = point + 1)
    }
    else return null.toString()
}

}

解決したいこと

index 4 outofbounds length 4がでます。
どうしたらいいのでしょう。

0 likes

2Answer

index 4 outofbounds length 4がでます。

どこの行で発生しますか?


↓こちらを参照して、コードブロックを正しく使うように修正してください。

1Like

Comments

  1. @rick9055

    Questioner

    W Method java.lang.Object androidx.compose.runtime.snapshots.SnapshotStateMap.mutate(kotlin.jvm.functions.Function1) failed lock verification and will run slower.
    Common causes for lock verification issues are non-optimized dex code
    and incorrect proguard optimizations.
    2023-12-15 12:14:04.768 7478-7478 example.mymovie com.example.mymovie W Method void androidx.compose.runtime.snapshots.SnapshotStateMap.update(kotlin.jvm.functions.Function1) failed lock verification and will run slower.
    2023-12-15 12:14:04.769 7478-7478 example.mymovie com.example.mymovie W Method boolean androidx.compose.runtime.snapshots.SnapshotStateMap.removeIf$runtime_release(kotlin.jvm.functions.Function1) failed lock verification and will run slower.
    2023-12-15 12:14:04.800 7478-7478 AndroidRuntime com.example.mymovie D Shutting down VM
    2023-12-15 12:14:04.806 7478-7478 AndroidRuntime com.example.mymovie E FATAL EXCEPTION: main
    Process: com.example.mymovie, PID: 7478
    java.lang.IndexOutOfBoundsException: Index 4 out of bounds for length 4
    at jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
    at jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
    at jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266)
    at java.util.Objects.checkIndex(Objects.java:359)
    at java.util.ArrayList.get(ArrayList.java:434)
    at com.example.mymovie.ImgFilecon.imgserch(MainActivity.kt:57)
    at com.example.mymovie.ImgFilecon.extract(MainActivity.kt:50)
    at com.example.mymovie.ComposableSingletons$MainActivityKt$lambda-1$1.invoke(MainActivity.kt:33)
    at com.example.mymovie.ComposableSingletons$MainActivityKt$lambda-1$1.invoke(MainActivity.kt:26)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
    at androidx.compose.material3.SurfaceKt$Surface$1.invoke(Surface.kt:129)
    at androidx.compose.material3.SurfaceKt$Surface$1.invoke(Surface.kt:113)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
    at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
    at androidx.compose.material3.SurfaceKt.Surface-T9BRK9s(Surface.kt:110)
    at com.example.mymovie.ComposableSingletons$MainActivityKt$lambda-2$1.invoke(MainActivity.kt:23)
    at com.example.mymovie.ComposableSingletons$MainActivityKt$lambda-2$1.invoke(MainActivity.kt:21)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
    at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
    at androidx.compose.material3.TextKt.ProvideTextStyle(Text.kt:261)
    at androidx.compose.material3.MaterialThemeKt$MaterialTheme$1.invoke(MaterialTheme.kt:81)
    at androidx.compose.material3.MaterialThemeKt$MaterialTheme$1.invoke(MaterialTheme.kt:80)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
    at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
    at androidx.compose.material3.MaterialThemeKt.MaterialTheme(MaterialTheme.kt:73)
    at com.example.mymovie.ui.theme.ThemeKt.MyMovieTheme(Theme.kt:65)
    at com.example.mymovie.ComposableSingletons$MainActivityKt$lambda-3$1.invoke(MainActivity.kt:21)
    at com.example.mymovie.ComposableSingletons$MainActivityKt$lambda-3$1.invoke(MainActivity.kt:20)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
    at androidx.compose.ui.platform.ComposeView.Content(ComposeView.android.kt:428)
    at androidx.compose.ui.platform.AbstractComposeView$ensureCompositionCreated$1.invoke(ComposeView.android.kt:252)
    at androidx.compose.ui.platform.AbstractComposeView$ensureCompositionCreated$1.invoke(ComposeView.android.kt:251)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
    at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
    at androidx.compose.ui.platform.CompositionLocalsKt.ProvideCommonCompositionLocals(CompositionLocals.kt:194)
    at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt$ProvideAndroidCompositionLocals$3.invoke(AndroidCompositionLocals.android.kt:123)
    2023-12-15 12:14:04.809 7478-7478 AndroidRuntime com.example.mymovie E at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt$ProvideAndroidCompositionLocals$3.invoke(AndroidCompositionLocals.android.kt:122)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
    at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
    at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt.ProvideAndroidCompositionLocals(AndroidCompositionLocals.android.kt:114)
    at androidx.compose.ui.platform.WrappedComposition$setContent$1$1$2.invoke(Wrapper.android.kt:156)
    at androidx.compose.ui.platform.WrappedComposition$setContent$1$1$2.invoke(Wrapper.android.kt:155)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
    at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
    at androidx.compose.ui.platform.WrappedComposition$setContent$1$1.invoke(Wrapper.android.kt:155)
    at androidx.compose.ui.platform.WrappedComposition$setContent$1$1.invoke(Wrapper.android.kt:140)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
    at androidx.compose.runtime.ActualJvm_jvmKt.invokeComposable(ActualJvm.jvm.kt:78)
    at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:3352)
    at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:3342)
    at androidx.compose.runtime.SnapshotStateKt__DerivedStateKt.observeDerivedStateRecalculations(DerivedState.kt:341)
    at androidx.compose.runtime.SnapshotStateKt.observeDerivedStateRecalculations(Unknown Source:1)
    at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:3342)
    at androidx.compose.runtime.ComposerImpl.composeContent$runtime_release(Composer.kt:3277)
    at androidx.compose.runtime.CompositionImpl.composeContent(Composition.kt:587)
    at androidx.compose.runtime.Recomposer.composeInitial$runtime_release(Recomposer.kt:966)
    at androidx.compose.runtime.CompositionImpl.setContent(Composition.kt:519)
    at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:140)
    at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:131)
    at androidx.compose.ui.platform.AndroidComposeView.setOnViewTreeOwnersAvailable(AndroidComposeView.android.kt:1099)
    at androidx.compose.ui.platform.WrappedComposition.setContent(Wrapper.android.kt:131)
    at androidx.compose.ui.platform.WrappedComposition.onStateChanged(Wrapper.android.kt:181)
    at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.kt:314)
    at androidx.lifecycle.LifecycleRegistry.addObserver(LifecycleRegistry.kt:192)
    at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:138)
    at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:131)
    at androidx.compose.ui.platform.AndroidComposeView.onAttachedToWindow(AndroidComposeView.android.kt:1174)
    at android.view.View.dispatchAttachedToWindow(View.java:21305)
    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3491)
    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3498)
    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3498)
    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3498)
    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3498)
    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2774)
    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2289)
    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8958)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1319)
    2023-12-15 12:14:04.809 7478-7478 AndroidRuntime com.example.mymovie E at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1327)
    at android.view.Choreographer.doCallbacks(Choreographer.java:985)
    at android.view.Choreographer.doFrame(Choreographer.java:916)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1302)
    at android.os.Handler.handleCallback(Handler.java:942)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:346)
    at android.os.Looper.loop(Looper.java:475)
    at android.app.ActivityThread.main(ActivityThread.java:7950)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:942)
    2023-12-15 12:14:04.829 7478-7478 Process com.example.mymovie I Sending signal. PID: 7478 SIG: 9

    こんなんなんですが...
    初心者なのでさっぱりです。

  2. @rick9055

    Questioner

    if (filelist[i].isFile && !flag) {

    ここでしょうか?

どこでエラーになっているのかが明確じゃないので、これじゃないかもですが、とりあえず間違ってそうなところを連携しますね。

- Extension().extensionsplit(i.toString(), ".")
+ Extension().extensionsplit(filelist[i].getName(), ".")

0Like

Comments

  1. @rick9055

    Questioner

    W Method java.lang.Object androidx.compose.runtime.snapshots.SnapshotStateMap.mutate(kotlin.jvm.functions.Function1) failed lock verification and will run slower.
    Common causes for lock verification issues are non-optimized dex code
    and incorrect proguard optimizations.
    2023-12-15 12:14:04.768 7478-7478 example.mymovie com.example.mymovie W Method void androidx.compose.runtime.snapshots.SnapshotStateMap.update(kotlin.jvm.functions.Function1) failed lock verification and will run slower.
    2023-12-15 12:14:04.769 7478-7478 example.mymovie com.example.mymovie W Method boolean androidx.compose.runtime.snapshots.SnapshotStateMap.removeIf$runtime_release(kotlin.jvm.functions.Function1) failed lock verification and will run slower.
    2023-12-15 12:14:04.800 7478-7478 AndroidRuntime com.example.mymovie D Shutting down VM
    2023-12-15 12:14:04.806 7478-7478 AndroidRuntime com.example.mymovie E FATAL EXCEPTION: main
    Process: com.example.mymovie, PID: 7478
    java.lang.IndexOutOfBoundsException: Index 4 out of bounds for length 4
    at jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
    at jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
    at jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266)
    at java.util.Objects.checkIndex(Objects.java:359)
    at java.util.ArrayList.get(ArrayList.java:434)
    at com.example.mymovie.ImgFilecon.imgserch(MainActivity.kt:57)
    at com.example.mymovie.ImgFilecon.extract(MainActivity.kt:50)
    at com.example.mymovie.ComposableSingletons$MainActivityKt$lambda-1$1.invoke(MainActivity.kt:33)
    at com.example.mymovie.ComposableSingletons$MainActivityKt$lambda-1$1.invoke(MainActivity.kt:26)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
    at androidx.compose.material3.SurfaceKt$Surface$1.invoke(Surface.kt:129)
    at androidx.compose.material3.SurfaceKt$Surface$1.invoke(Surface.kt:113)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
    at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
    at androidx.compose.material3.SurfaceKt.Surface-T9BRK9s(Surface.kt:110)
    at com.example.mymovie.ComposableSingletons$MainActivityKt$lambda-2$1.invoke(MainActivity.kt:23)
    at com.example.mymovie.ComposableSingletons$MainActivityKt$lambda-2$1.invoke(MainActivity.kt:21)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
    at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
    at androidx.compose.material3.TextKt.ProvideTextStyle(Text.kt:261)
    at androidx.compose.material3.MaterialThemeKt$MaterialTheme$1.invoke(MaterialTheme.kt:81)
    at androidx.compose.material3.MaterialThemeKt$MaterialTheme$1.invoke(MaterialTheme.kt:80)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
    at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
    at androidx.compose.material3.MaterialThemeKt.MaterialTheme(MaterialTheme.kt:73)
    at com.example.mymovie.ui.theme.ThemeKt.MyMovieTheme(Theme.kt:65)
    at com.example.mymovie.ComposableSingletons$MainActivityKt$lambda-3$1.invoke(MainActivity.kt:21)
    at com.example.mymovie.ComposableSingletons$MainActivityKt$lambda-3$1.invoke(MainActivity.kt:20)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
    at androidx.compose.ui.platform.ComposeView.Content(ComposeView.android.kt:428)
    at androidx.compose.ui.platform.AbstractComposeView$ensureCompositionCreated$1.invoke(ComposeView.android.kt:252)
    at androidx.compose.ui.platform.AbstractComposeView$ensureCompositionCreated$1.invoke(ComposeView.android.kt:251)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
    at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
    at androidx.compose.ui.platform.CompositionLocalsKt.ProvideCommonCompositionLocals(CompositionLocals.kt:194)
    at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt$ProvideAndroidCompositionLocals$3.invoke(AndroidCompositionLocals.android.kt:123)
    2023-12-15 12:14:04.809 7478-7478 AndroidRuntime com.example.mymovie E at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt$ProvideAndroidCompositionLocals$3.invoke(AndroidCompositionLocals.android.kt:122)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
    at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
    at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt.ProvideAndroidCompositionLocals(AndroidCompositionLocals.android.kt:114)
    at androidx.compose.ui.platform.WrappedComposition$setContent$1$1$2.invoke(Wrapper.android.kt:156)
    at androidx.compose.ui.platform.WrappedComposition$setContent$1$1$2.invoke(Wrapper.android.kt:155)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
    at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
    at androidx.compose.ui.platform.WrappedComposition$setContent$1$1.invoke(Wrapper.android.kt:155)
    at androidx.compose.ui.platform.WrappedComposition$setContent$1$1.invoke(Wrapper.android.kt:140)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
    at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
    at androidx.compose.runtime.ActualJvm_jvmKt.invokeComposable(ActualJvm.jvm.kt:78)
    at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:3352)
    at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:3342)
    at androidx.compose.runtime.SnapshotStateKt__DerivedStateKt.observeDerivedStateRecalculations(DerivedState.kt:341)
    at androidx.compose.runtime.SnapshotStateKt.observeDerivedStateRecalculations(Unknown Source:1)
    at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:3342)
    at androidx.compose.runtime.ComposerImpl.composeContent$runtime_release(Composer.kt:3277)
    at androidx.compose.runtime.CompositionImpl.composeContent(Composition.kt:587)
    at androidx.compose.runtime.Recomposer.composeInitial$runtime_release(Recomposer.kt:966)
    at androidx.compose.runtime.CompositionImpl.setContent(Composition.kt:519)
    at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:140)
    at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:131)
    at androidx.compose.ui.platform.AndroidComposeView.setOnViewTreeOwnersAvailable(AndroidComposeView.android.kt:1099)
    at androidx.compose.ui.platform.WrappedComposition.setContent(Wrapper.android.kt:131)
    at androidx.compose.ui.platform.WrappedComposition.onStateChanged(Wrapper.android.kt:181)
    at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.kt:314)
    at androidx.lifecycle.LifecycleRegistry.addObserver(LifecycleRegistry.kt:192)
    at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:138)
    at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:131)
    at androidx.compose.ui.platform.AndroidComposeView.onAttachedToWindow(AndroidComposeView.android.kt:1174)
    at android.view.View.dispatchAttachedToWindow(View.java:21305)
    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3491)
    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3498)
    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3498)
    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3498)
    at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3498)
    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2774)
    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2289)
    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8958)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1319)
    2023-12-15 12:14:04.809 7478-7478 AndroidRuntime com.example.mymovie E at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1327)
    at android.view.Choreographer.doCallbacks(Choreographer.java:985)
    at android.view.Choreographer.doFrame(Choreographer.java:916)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1302)
    at android.os.Handler.handleCallback(Handler.java:942)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:346)
    at android.os.Looper.loop(Looper.java:475)
    at android.app.ActivityThread.main(ActivityThread.java:7950)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:942)
    2023-12-15 12:14:04.829 7478-7478 Process com.example.mymovie I Sending signal. PID: 7478 SIG: 9

    こんなんなんですが...
    初心者なんでさっぱりです。

  2. @rick9055

    Questioner

    if (filelist[i].isFile && !flag) {

    ここでしょうか?

Your answer might help someone💌