Comments (7)
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.
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.
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.
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.
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.
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.
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)
- Display multiple prompt target and go them step by step HOT 1
- Change opacity of background HOT 1
- NullPointerException at onAnimationEnd(MaterialTapTargetPrompt.java:529) on some devices running Android 6.0 HOT 1
- Bintray is closing any plans to publish somewher else? HOT 1
- java.lang.NullPointerException: at android.graphics.Typeface.create (Typeface.java:849) HOT 6
- JCenter shuts down in May HOT 4
- Crash on OnePlus IN2021: java.lang.NullPointerException: Attempt to read from field 'boolean android.graphics.Path.isSimplePath' on a null object reference HOT 1
- How to set target for Toolbar overflow menu HOT 1
- Jetpack Compose HOT 5
- How to adjust the spacing of secondary text lines? HOT 1
- 3.3.1 update causes text to render weirdly with alpha effected by view background HOT 4
- Please how I can use it for multiple buttons HOT 1
- Show on an android.app.Dialog HOT 8
- java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.View.findViewById(int)'
- Localisation is not working in these promts.
- Sequence keep repeating in viewpager2
- The text is incorrectly positioned.
- Prompt not showing on dynamically created view
- How we can add multiple target on it. HOT 1
- Fatal Exception: java.lang.NullPointerException
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from materialtaptargetprompt.