Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Super Contributor
Posts: 253
Registered: ‎08-19-2010
My Device: BB10, Playbook, 9900, 9800, 9700, 9550, 9530, 9500, 8700.
My Carrier: TT
Accepted Solution

Can someone check the code, which has a wrong point.?

[ Edited ]

Tried to use buffer to collect acceleration, but fail.

Could anyone help me to debug??


                            for (i =0; i < 2; i++){
                                sensor_event_get_xyz(event, &force_x[i], &force_y[i], &force_z[i]);
                                if(force_x[0] != force_x[1]){
                                //if(tmb[0].millitm-tmb[1].millitm > 19){fail without data

                                    fprintf(f,"%ld%d, %7.3f, %7.3f, %7.3f\n", tmb[i].time, tmb[i].millitm, force_x[i], force_y[i], force_z[i]);


Thank you,


-Fight with BB10
BlackBerry Development Advisor
Posts: 15,876
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Can someone check the code, which has a wrong point.?

You are trying to read accelerometer data without checking if the data is ready (event occurred).  Have a look at the following link for an example.


Reading accelerometer forces

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
BlackBerry Development Advisor
Posts: 683
Registered: ‎11-29-2011
My Device: PRIV
My Carrier: Rogers

Re: Can someone check the code, which has a wrong point.?

Hi lyon819,

You have started multiple threads asking the same or similar questions (I just counted maybe 8 or 9 threads which only covered 2 or 3 questions).  Can you please try to direct your related questions to a thread you have already started?  Someone reading a question in one of your threads may not notice that it has already been answered in another thread.