Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onclick on the populated images in ZGrid crashing app activity #33

Open
UniqueJoy opened this issue Feb 8, 2019 · 8 comments
Open

onclick on the populated images in ZGrid crashing app activity #33

UniqueJoy opened this issue Feb 8, 2019 · 8 comments

Comments

@UniqueJoy
Copy link

UniqueJoy commented Feb 8, 2019

Image is showing finely in the grid but whenever i click any of the populated images in the grid, the activity crashes showing error

java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.String
java.lang.CharSequence.toString()' on a null object reference
at com.mzelzoghbi.zgallery.activities.ZGridActivity.onClick(ZGridActivity.java:56)
at com.mzelzoghbi.zgallery.adapters.GridImagesAdapter$1.onClick(GridImagesAdapter.java:46)
at android.view.View.performClick(View.java:5721)
at android.view.View$PerformClick.run(View.java:22620)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7409)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

I have used your code to show local images with ZGrid, inside a onclick listener

@agungsus
Copy link

agungsus commented May 6, 2019

Hello, same here.
Do you already found the work around?
If by any chance you are decided to switch to another lib, could I know what is it?
Been wondering but still could not find much like with this zgallery.
Thanks in advance.

@UniqueJoy
Copy link
Author

@agungsus no the problem still exists..

@agungsus
Copy link

agungsus commented May 7, 2019

Hi again,
Finally, in my case, I add this in AndroidManifest and it doesn't crash:

    <activity
        android:name="com.mzelzoghbi.zgallery.activities.ZGridActivity"
        android:label="@string/title_activity"
        android:parentActivityName=".MainActivity"
        android:theme="@style/AppTheme.NoActionBar">
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value="com.myapp.MainActivity" />
    </activity>

    <activity
        android:name="com.mzelzoghbi.zgallery.activities.ZGalleryActivity"
        android:label="@string/title_activity"
        android:parentActivityName=".MainActivity"
        android:theme="@style/AppTheme.NoActionBar">
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value="com.myapp.MainActivity" />
    </activity>

Well, hope it can help. ^^

@UniqueJoy
Copy link
Author

UniqueJoy commented May 8, 2019

@agungsus after using i am getting

java.lang.RuntimeException: Unable to start activity ComponentInfo{joy.creative.uimagesaver/com.mzelzoghbi.zgallery.activities.ZGalleryActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.Toolbar.setVisibility(int)' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3320)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3416) at android.app.ActivityThread.access$1100(ActivityThread.java:230)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1822) at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:7409)
at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void
android.support.v7.widget.Toolbar.setVisibility(int)' on a null object reference at com.mzelzoghbi.zgallery.activities.BaseActivity.onCreate(BaseActivity.java:56)
at android.app.Activity.performCreate(Activity.java:6904) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1136)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3267) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3416) 
at android.app.ActivityThread.access$1100(ActivityThread.java:230)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1822) 
at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:148) 
at android.app.ActivityThread.main(ActivityThread.java:7409)  at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 

@agungsus

can you please describe the style content of

@style/AppTheme.NoActionBar

@agungsus
Copy link

agungsus commented May 8, 2019

Hello,
Here is my style:

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>

    <item name="android:textColor">@android:color/black</item>
</style>

<style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>

<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
Hope it can help, cheers.

@UniqueJoy
Copy link
Author

no improve.. same happening. with same error. @agungsus

@agungsus
Copy link

Hmm, not sure about that error, but do you already use 0.3.1 tag?
com.github.mzelzoghbi:ZGallery:0.3.1
If yes, I don't have any other idea.

@UniqueJoy
Copy link
Author

@agungsus yes it is 0.3.1.. problem still exist😟😔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants