Comments (9)
It is because the view is not inflated yet fully, so try posting it using runnable.
smileyRating.post(new Runnable() {
@Override
public void run() {
smileRating.setSelectedSmile(BaseRating.TERRIBLE,true);
}
});
Can you try this?
Thank you :D
from smileyrating.
Are you sure it is null pointer? or IndexOutOfBounds exception
from smileyrating.
Can you post the stackTrace of the error too?
from smileyrating.
I guess mTouchPoints should be 5 (smilies) but it contains 0 because they were never created. I think.
Here is the stacktrace
--------- beginning of crash
09-16 08:35:36.497 3992-3992/com.update.update E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.update.update, PID: 3992
java.lang.NullPointerException: Attempt to read from field 'float com.hsalf.smilerating.BaseRating$Point.x' on a null object reference
at com.hsalf.smilerating.SmileRating$2.onAnimationStart(SmileRating.java:194)
at android.animation.ValueAnimator.notifyStartListeners(ValueAnimator.java:1048)
at android.animation.ValueAnimator.start(ValueAnimator.java:1110)
at android.animation.ValueAnimator.start(ValueAnimator.java:1117)
at com.hsalf.smilerating.SmileRating.setSelectedSmile(SmileRating.java:565)
at com.hsalf.smilerating.SmileRating.setSelectedSmile(SmileRating.java:545)
at com.update.update.DateRatingAdapter.onBindViewHolder(DateRatingAdapter.java:49) -> holder.srRating.setSelectedSmile(5,true);
from smileyrating.
I hope the above will be enough but if you need more info from me, let me know
from smileyrating.
I got the same error
from smileyrating.
@LeooonH It seems that we're the only ones to get this error... I wonder what the problem is. Waiting for @sujithkanna response.
from smileyrating.
Hi all,
I want to ask why when I set true for the animation it gives me java.lang.NullPointerException: Attempt to read from field 'float com.hsalf.smilerating.BaseRating$Point.x' on a null object reference
My code (simplyfied):
public class scoreActivity extends AppCompatActivity{
SmileRating smileRating;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.score_layout);
smileRating = (SmileRating) findViewById(R.id.smile_rating);
smileRating.setIndicator(true);
// this works
smileRating.setSelectedSmile(BaseRating.TERRIBLE);
// this one doesn't works
// smileRating.setSelectedSmile(BaseRating.TERRIBLE,true);
}
What am I doing wrong?
Thank you for your AWESOME work! :D
from smileyrating.
solution by @sujithkanna works! same problem with animate and the snippet works fine
from smileyrating.
Related Issues (20)
- Icon Click listener not working. HOT 1
- In Recyclerview HOT 3
- SmileyRating inside BottomSheetDialog HOT 1
- How to send rating to the mysql database using PHP? HOT 1
- setRating in kotlin not work HOT 1
- what is difference between smileyrating and smilerating
- setRating not work in kotlin HOT 2
- It is possible to select more than one option?
- setRating method is not working HOT 3
- Change smileys HOT 1
- HOW TO CHANGE SMILEY COLOR HOT 1
- Casting error HOT 2
- smileyrating on a recyclerview when disallowSelection(true) HOT 2
- Smiley Title not shown at place of title show a, b , c, d, e
- Not able to reverse or change order of Smiley
- Jcenter is deprecated publish the libray to maven central HOT 5
- Manifest merger failed : android:exported needs to be explicitly specified for <activity>.
- (mInflationDone) setRating in kotlin not work
- How to replace emoji??
- Could not find method compile() for arguments [com.github.sujithkanna:smileyrating:2.0.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. HOT 2
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 smileyrating.