更新时间:2023-02-02 13:28:55
使用 putExtra 发送 Uri 路径:
use with putExtra to send the Uri Path:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent .setClass(ThisActivity.this, NewActivity.class);
intent .putExtra("KEY", Uri);
startActivity(intent );
在 newActivity OnCreate 方法中:
In the newActivity OnCreate method:
Bundle extras = getIntent().getExtras();
if (extras != null && extras.containsKey("KEY")) {
Uri= extras.getString("KEY");
}
使用这些功能:Uri 到字符串:
Use those func: Uri to String:
Uri uri;
String stringUri;
stringUri = uri.toString();
字符串到 Uri:
Uri uri;
String stringUri;
uri = Uri.parse(stringUri);