close

import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.provider.MediaStore;
import android.widget.Toast;

public class CheckIt extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent theIntent = getIntent();
String attachmentFileName = "No file name found";
if (theIntent != null && theIntent.getData() != null) {
Cursor c = getContentResolver().query(
theIntent.getData(), null, null, null, null);
c.moveToFirst();
final int fileNameColumnId = c.getColumnIndex(
MediaStore.MediaColumns.DISPLAY_NAME);
if (fileNameColumnId >= 0)
attachmentFileName = c.getString(fileNameColumnId);
}
Toast.makeText(this, attachmentFileName, Toast.LENGTH_LONG).show();
}

}

 

轉:

http://stackoverflow.com/questions/6031410/android-get-attached-filename-from-gmail-app

 

http://carvingcode.blogspot.tw/2009/08/how-to-open-gmail-attachments-with.html

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 pcwiki 的頭像
    pcwiki

    pcwiki的部落格

    pcwiki 發表在 痞客邦 留言(0) 人氣()