Android Intent-Filter custom filetype

前端 未结 1 1974
刺人心
刺人心 2020-12-11 09:58

First of all, I have scoured the SO and internet about this, an no solutions work. I\'ve been trying to use the filebrowsers AndExplorer and Root Ex

1条回答
  •  不知归路
    2020-12-11 10:49

    It looks like the big issue with file type intent filters is that allot of different programs handle the intents differently. I couldn't get AndExplorer to respond to any thing I found(i.e get it to open the .eva file). However I did get file manager and astro file browser working using the intent filters below. As an alternative having the app launch an activity to select the file dose work for all the file browsers I tried(if your using file manager it dose not return data like the other ones, so some adjustments have to be made(just saw this in debugging didnt write code to fix it), but instead I am just working on creating a custom file chooser, as it avoids any issues that other file managers users may have): ...

    
                 
                 
                 
                 
                
            
            
                 
                 
                 
                 
                 
                
            
    

    ...

        Intent intent2Browse = new Intent();
        Toast.makeText(this, R.string.Choose_EVAKey_File, Toast.LENGTH_LONG).show();
        intent2Browse.addCategory(Intent.CATEGORY_OPENABLE);
        intent2Browse.setType("application/xml");
        intent2Browse.setAction(Intent.ACTION_GET_CONTENT);
        startActivityForResult(intent2Browse,Select_EVA_FILE);
    

    ....

    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if(requestCode == Select_EVA_FILE && resultCode == RESULT_OK) {
            Uri currFileURI = data.getData();
            path2Key = currFileURI.getPath();
    

    ...

    0 讨论(0)
提交回复
热议问题