相关疑难解决方法(0)

如何从android中的文件路径获取文件名

我想从sdcard文件路径获取文件名.例如:/storage/sdcard0/DCIM/Camera/1414240995236.jpg I want get 1414240995236.jpg 我已经编写了代码来获取相同的但它无法正常工作.请帮忙.
以下是我的代码:

@Override
protected void onActivityResult( int requestCode, int resultCode, Intent data)
{
    if ( requestCode == CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE) {

        if ( resultCode == RESULT_OK) {

            /*********** Load Captured Image And Data Start ****************/

            String imageId = convertImageUriToFile( imageUri,CameraActivity);


            //  Create and excecute AsyncTask to load capture image

            new LoadImagesFromSDCard().execute(""+imageId);

            /*********** Load Captured Image And Data End ****************/


        } else if ( resultCode == RESULT_CANCELED) {

            Toast.makeText(this, " Picture was not taken ", Toast.LENGTH_SHORT).show();
        } …
Run Code Online (Sandbox Code Playgroud)

android android-sdcard android-camera

45
推荐指数
6
解决办法
9万
查看次数

标签 统计

android ×1

android-camera ×1

android-sdcard ×1