Coder Social home page Coder Social logo

Comments (7)

sjwall avatar sjwall commented on May 16, 2024

The closest I can get to replicating this is setTarget(null). I have made it handle this scenario gracefully in v1.8.3. If the target view is null then builder.create() will return null and builder.show() will not show the prompt.

Check that the view you are targeting is not null. Let me know if this helps, if not I will investigate further

from materialtaptargetprompt.

chinmoyeedash avatar chinmoyeedash commented on May 16, 2024

No, As I mentioned code works perfectly with appcompat:23 and design: 23, with materialtaptarget1.1.4 which i have swapped and checked. This error comes the only when i update the build.gradle and sync

from materialtaptargetprompt.

sjwall avatar sjwall commented on May 16, 2024

Ok, I shall investigate further.
How are you targeting the action mode item, by item id or by getChildAt?
Does the null pointer exception still occur with v1.8.3?

from materialtaptargetprompt.

chinmoyeedash avatar chinmoyeedash commented on May 16, 2024

With 1.8.3 as you told it exits gracefully .. Nullpointer does not go to MaterialTapTarget.java but shows on my activity where i create taptarget on mPrompt.

mPrompt=new MaterialTapTargetPrompt.Builder(context)
.setTarget(findViewById(R.id.menu_next)) (have tried declaring view separately also)
.setTargetRenderView(findViewById(R.id.menu_next))
.setSecondaryText("---")
.setPrimaryText("Next")
.setTextPadding(10f)
.setSecondaryTextColour(Color.WHITE)
.setAnimationInterpolator(new FastOutLinearInInterpolator())
//default max is 400dp
.setMaxTextWidth(350f)
.setOnHidePromptListener(----).create();
mPrompt.show();

Also, for your reference, it also shows this log before crashing... totally missed seeing this before

I/dalvikvm: Could not find method android.app.Activity.getColor, referenced from method uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt$Builder.getColour
W/dalvikvm: VFY: unable to resolve virtual method 136: Landroid/app/Activity;.getColor (I)I
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0008
I/dalvikvm: Could not find method android.graphics.drawable.Drawable.setTintList, referenced from method uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt$Builder.create
W/dalvikvm: VFY: unable to resolve virtual method 1386: Landroid/graphics/drawable/Drawable;.setTintList (Landroid/content/res/ColorStateList;)V
D/dalvikvm: VFY: replacing opcode 0x6e at 0x00d0
I/dalvikvm: Could not find method android.app.Activity.getDrawable, referenced from method uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt$Builder.setIcon
W/dalvikvm: VFY: unable to resolve virtual method 139: Landroid/app/Activity;.getDrawable (I)Landroid/graphics/drawable/Drawable;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0008
I/dalvikvm: Could not find method android.app.Activity.getColor, referenced from method uk.co.samuelwall.materialtaptargetprompt.MaterialTapTargetPrompt$Builder.setIconDrawableColourFilterFromRes
W/dalvikvm: VFY: unable to resolve virtual method 136: Landroid/app/Activity;.getColor (I)I

from materialtaptargetprompt.

sjwall avatar sjwall commented on May 16, 2024

With 1.8.3 exiting gracefully in the library it indicates that findViewById(R.id.menu_next) is returning null.
This means that create() will return null as the prompt does not have a valid target.

The extra log information is showing that the methods Drawable.setTintList, Activity.getDrawable and Activity.getColor cannot be found. These methods have been added to Android in Lollipop and Marshmallow.
When running a device that is an older version of Android these "errors" will be shown by Android. But these aren't "errors" as the library checks what Android version it is running on to see if it can use them. The Android JVM will just ignore the fact that the methods don't exist because they aren't reachable in code. An example is below with getColor which was added to Context class in Marshmallow:

            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
            {
                colour = mActivity.getColor(id);
            }
            else
            {
                colour = mActivity.getResources().getColor(id);
            }

from materialtaptargetprompt.

chinmoyeedash avatar chinmoyeedash commented on May 16, 2024

No, view is not returning null(have debugged this) , also as i mentioned, same code works if i change only the gradle file to earlier version of MaterialTapTraget, but then I cannot target sdk 25

from materialtaptargetprompt.

sjwall avatar sjwall commented on May 16, 2024

I have investigated further and not been able to find anything :(
Could you provided the stacktrace now that the null pointer isn't occurring in the library please?

from materialtaptargetprompt.

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.