'Kotlin, android

MainActivity.kt I have successfully moved my app to background using MoveTaskToBack (true) I am trying to get it back to show I having difficulty

I had even included the person for task reorder in kotlin manifest, still am having problems this is my code same below. `` // Declaring and initializing the

    // TextView from the layout file 

    val mTextView = findViewById<TextView>(R.id.text_view) 

      

    // Getting the instance of ActivityManager 

    val mActivityManager = getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager 

      

    // Getting the tasks in the form of a list 

    val mRecentTasks: List<ActivityManager.RunningTaskInfo> = Objects.requireNonNull(mActivityManager).getRunningTasks(Int.MAX_VALUE) 



    var mString = ""



    // Creating a string of each index of the list 

    for (i in mRecentTasks.indices){           

if(mRecentTasks[i].baseActivity?.toShortString() .indexOf("com.example.myassisant") > -1) {
mActivityManager.moveTaskToFront( mRecentTasks[i].get(i).id, ActivityManager.MOVE_TASK_WITH_HOME) }

    } 


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source