调用图库
2023-01-24 09:16:15 最后更新
//初始化参数
javags(agc,"android.content.Intent","android.content.Intent.ACTION_GET_CONTENT")
//初始化intent
javanew(it,"android.content.Intent","String",agc)
//配置intent
java(c,it,"android.content.Intent.setType","String","image/*")
java(c,it,"android.content.Intent.putExtra","String","crop","boolean",true)
java(c,it,"android.content.Intent.putExtra","String","return-data","boolean",true)
java(c,activity,"android.app.Activity.startActivityForResult","android.content.Intent",it,"int",2)
/.
需要权限
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
./
//以下代码放到回调事件中

/.
注意如果是文件管理器则报错
返回值在ss.rnpath
./
javags(ro,activity,"android.app.Activity","RESULT_OK")
f(st_lC == ro)
{
  f(st_sC == 2)
  {
    java(uri,st_iT,"android.content.Intent.getData")
    //处理值(/external路径)
    //java(uri,uri,"android.net.Uri.getPath")
    //绝对路径
    call(ss.rnpath,"mlua","lua.getRealPath",uri)
    ufnsui()
    {
    us(7,"text",uri)
    us(8,"text",ss.rnpath)
    }
  }
}