Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/188.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 意图使用数据kotlin连接到另一个应用程序_Android_Android Studio_Kotlin - Fatal编程技术网

Android 意图使用数据kotlin连接到另一个应用程序

Android 意图使用数据kotlin连接到另一个应用程序,android,android-studio,kotlin,Android,Android Studio,Kotlin,我需要将数据传递到我制作的另一个应用程序,但希望将其他应用程序的信息回送到此应用程序,就像put putExtra()函数一样。。。。还需要一个不同的项目的帮助,我需要使用OTG相机应用程序,但它必须与kotlin和Androidx合作 home_cat.setOnItemClickListener { adapterView, view, i, l -> val urlString = "http://mysuperwebsite"

我需要将数据传递到我制作的另一个应用程序,但希望将其他应用程序的信息回送到此应用程序,就像put putExtra()函数一样。。。。还需要一个不同的项目的帮助,我需要使用OTG相机应用程序,但它必须与kotlin和Androidx合作

 home_cat.setOnItemClickListener { adapterView, view, i, l ->

            val urlString = "http://mysuperwebsite"
            val intent = Intent(Intent.ACTION_VIEW, Uri.parse(urlString))
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
            intent.setPackage("com.android.chrome")
            try {
                startActivity(intent)
            } catch (ex: ActivityNotFoundException) {
                // Chrome browser presumably not installed so allow user to choose instead
                intent.setPackage(null)
                startActivity(intent)
            }
        }