我正在创建一个 android 应用程序,其中我有一个浏览按钮供用户使用browse an image from the image gallery
。我正在获取选定的图像,但我需要name of the image to be displayed in a textview
在我的活动中我该怎么做????我以这种方式获取图像:
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
if (requestCode == SELECT_PICTURE) {
Uri selectedImageUri = data.getData();
selectedImagePath = getPath(selectedImageUri);
System.out.println("Image Path : " + selectedImagePath);
img.setImageURI(selectedImageUri);
upload_row=new TableRow(this);
appln_no=new TextView(this);
image_name=new TextView(this);
doctype=new TextView(this);
appln_no.setText("Application no.");
image_name.setText(selectedImagePath);
doctype.setText("DOCUMENT_TYPE");
upload_row.addView(appln_no);
upload_row.addView(image_name);
upload_row.addView(doctype);
upload_table.addView(upload_row);
}
}
}
有人可以告诉我如何在字符串中获取图像名称以显示它????
提前致谢!!