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

Crashing when emit is present #7

Closed
bartando opened this issue Nov 16, 2014 · 6 comments
Closed

Crashing when emit is present #7

bartando opened this issue Nov 16, 2014 · 6 comments

Comments

@bartando
Copy link

Hi, I'm trying to create a falling snowflakes but my app crashes whenever i use the .emit function
this is my code

@OverRide
public void onClick(View arg0) {
new ParticleSystem(this, 80, R.drawable.snowflake, 10000)
.setSpeedModuleAndAngleRange(0f, 0.1f, 180, 180)
.setRotationSpeed(144)
.setAcceleration(0.000017f, 90)
.emit(findViewById(R.id.emiter_top_left), 8);
}

i have the emiter_top_left and snowflake in the xml file so that shouldnt be the problem. Snowflake isnt any big image so that shouldnt be it either. Could you help me please?

@plattysoft
Copy link
Owner

Hi,

Can you post the stack trace of the crash?

By looking at the code everything looks right, and the examples work fine with similar code, so without the stack trace I don't think I can do much.

You said snowflake is an image, that is fine. It must be either a BitmapDrawable or an AnimationDrawable, so shapes or other xml drawables will crash, but that should not be your problem (actually you don't need the snowflake in the xml, just inside the drawables folder).

The other possible problem is that emiter_top_left is null, but you said it is there, so not much else can go wrong...

@bartando
Copy link
Author

Here is the stack of trash

https://dl.dropboxusercontent.com/u/65953495/log.txt

@plattysoft
Copy link
Owner

Mmm, a divide by 0. This is clearly a bug, but I'm not sure when I'll have time to fix it.

One more question: Are you using the latest code or the jar file?

Anyway, in the meantime, you can bypass this bug by doing

.setSpeedModuleAndAngleRange(0f, 0.1f, 179, 180)

Instead of:

.setSpeedModuleAndAngleRange(0f, 0.1f, 180, 180)

I remember fixing this or a similar divide by 0 issue, will need to check in which version the crash appears.

@bartando
Copy link
Author

Am i supposed to choose between jar or the code? I thought both are needed

Ok i did it with the jar and it works pefectly. Thank you .. i was bit confussed ... now you can close and thank you for your help... :) 👍

@plattysoft
Copy link
Owner

You can either add the jar file OR checkout the project to add it as a library, you don't need both.

Apparently this is an issue introduced recently, so I'll keep it open until I fix it again.

Thanks for the report!

@plattysoft
Copy link
Owner

This has been fixed on master

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