我正在創建一個Android應用程序,其中我有一個用戶瀏覽按鈕到browse an image from the image gallery
。 我得到選定的圖像,但我需要在我的活動name of the image to be displayed in a textview
我該怎麼做? 我越來越像這樣:如何讓圖像名稱顯示在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);
}
}
}
有人可以告訴我,我怎麼能在一個字符串獲取圖像名稱以顯示它????
在此先感謝!
嘗試回答以下 – Raghunandan 2013-05-09 11:06:27