Android调试日志记录导致值存储在ArrayList中以更改

时间:2016-11-20 15:11:15

标签: java android arrays debugging arraylist

我有一个应用程序可以获得点击或移动屏幕上的位置。所有这些代码应该做的是规范化位置,使其与屏幕尺寸无关,然后将其添加到数组列表中。我一直在调试我的应用程序,因为列表是全部0的。但是,当我添加下面代码中看到的日志记录时,会正确添加值。如果没有日志,那么数组的全部为0。老实说,我不知道是什么原因引起的。日志记录如何更改存储在数组中的值?!

工作代码:

                    counter++;
                    int xPercent, yPercent;

                    xPercent = 100 * xInput / maxX;
                    yPercent = 100 * yInput / maxY;

                    Log.d("after", xPercent + " and "+ yPercent);

                    sampleList.add(new Integer(counter).toString());
                    valenceList.add(new Integer(xPercent).toString());
                    arousalList.add(new Integer(yPercent).toString());

数组值:

记录前

Time in seconds,Arousal,Valence
1,0,0
2,0,0
3,0,0
4,0,0
5,0,0
6,0,0
7,0,0
8,0,0
9,0,0
10,0,0

使用日志后:

Time in seconds,Arousal,Valence
1,59,29
2,49,27
3,37,25
4,27,28
5,25,33
6,25,40
7,29,45
8,37,49
9,57,53

0 个答案:

没有答案