HBiSoft / PickiT

An Android library that returns real paths from Uri's

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Check if the selected file is a local file

HollisCheng opened this issue · comments

When i choose not local file , can i stop download function and just jump to PickiTonStartListener to show that online file are not supported, please choose local file

Currently, you can't but if you give me 30 minutes I will implement this into the library.

In the new release (0.1.7) you can check if a local file was selected by doing the following:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == SELECT_VIDEO_REQUEST) {
        if (resultCode == RESULT_OK) {
            // Check if local file was selected
            if (pickiT.wasLocalFileSelected(data.getData())){
                // Local file was selected, continue with getting the path
                pickiT.getPath(data.getData(), Build.VERSION.SDK_INT);
            }else{
                // The selected file was not a local file
                Toast.makeText(this, "Please select a local file", Toast.LENGTH_LONG).show();
            }
        }
    }
}

Perfect ,thank you very much