GithubHelp home page GithubHelp logo

Comments (4)

passy avatar passy commented on August 15, 2024

Hey @Hofferic,

thanks for the bug report. I'm a bit confused. Does this happen when using the chooser as a fragment or an activity? Since the error message can only be thrown from the activity I assume it's the latter, but your code is for a fragment. Can you clarify this for me?

from android-directorychooser.

Hofferic avatar Hofferic commented on August 15, 2024

That is exactly what confuses me, I only use the above method and a nearly exact copy with slightly different permission handling in the onboarding activity. I only ever use the fragment and cannot explain for the life of me how the activity comes into this. Here is the second method I use to call the library:

private void setDownloadFolder(){
        if(!Globals.PERMISSION_STORAGE){
            Hacks.coerceFullWidth(
                    Snackbar.make(findViewById(R.id.oobe_gestureOverlayView), R.string.snackbar_permission_storage, Snackbar.LENGTH_LONG)
            ).setAction(R.string.snackbar_permission_action, new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Intent intent = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
                    intent.setData(android.net.Uri.parse("package:com.hoffmann.eric.calibrebox"));
                    startActivity(intent);
                }
            }).show();
            return;
        }

        final DirectoryChooserConfig config = DirectoryChooserConfig.builder()
                .newDirectoryName("EBooks")
                .initialDirectory(getSharedPreferences(Globals.SETTINGS_NAME, MODE_PRIVATE).getString(Globals.DOWNLOAD_DIR,
                        Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getPath()))
                .allowNewDirectoryNameModification(true)
                .allowReadOnlyDirectory(false)
                .build();
        mDialog = DirectoryChooserFragment.newInstance(config);
        mDialog.show(getFragmentManager(), null);
    }

And here is the crash trace (as it is in onCreate I would guess it happens during configuration changes, as the dialog is only opened after the user clicks a button. But rotating while the fragment is open did not reproduce the issue on any of my test devices)

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.hoffmann.eric.calibrebox/net.rdrei.android.dirchooser.DirectoryChooserActivity}: java.lang.IllegalArgumentException: You must provide EXTRA_CONFIG when starting the DirectoryChooserActivity.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
at dalvik.system.NativeStart.main(NativeStart.java)
Caused by java.lang.IllegalArgumentException: You must provide EXTRA_CONFIG when starting the DirectoryChooserActivity.
at net.rdrei.android.dirchooser.DirectoryChooserActivity.onCreate(DirectoryChooserActivity.java:32)
at android.app.Activity.performCreate(Activity.java:5133)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
at dalvik.system.NativeStart.main(NativeStart.java)

from android-directorychooser.

Hofferic avatar Hofferic commented on August 15, 2024

I just had an Idea where the Activity version is referenced - In the Manifest!

<!-- file picker -->
<activity android:name="net.rdrei.android.dirchooser.DirectoryChooserActivity" />

Not sure if that contributes to this mysterious crash though :/

from android-directorychooser.

nghelam2008 avatar nghelam2008 commented on August 15, 2024

same problem! However, I use in Activity with your code so it work well. Thanks!

from android-directorychooser.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.