Looks like this user group is all about Employers looking for employess.  I 
got fooled by the description so Moderator go ahead and delete this post.  
I have moved my question to Stack Overflow.

On Thursday, May 13, 2021 at 4:57:34 AM UTC-4 Horace Johnson wrote:

> Hi,
>
> I'm new to Java and Android Studio but handling it quite well because of 
> my years of programming with python (basic concepts carry from language to 
> language).
>
> I have a practice project set up and the only propose of this project is 
> for me to learn how to do things the java/android studio way, logic wise.
>
> So logically, the last python based api I used, there was a way to issue 
> your own ID to touches and keep track of those touches; therefore you knew 
> if a touch still existed or not.
>
> That's where I am right now.  I know how to get the touch ID and then get 
> the Index that holds the touch data.  Basically I'm using a For Loop on the 
> motion event to process all touches to the screen.
>
> Here's the thing....
>
> Lets say I have 10 touches to process and what I do in a loop is basically 
> collect the info of the touches and store them in a hashtable, so I can 
> then later process all the touches in the hashtable.
>
> So as I pull a touch data from the hashtable to process, I want to first 
> check to see if the touch still exits.  I'm guessing once a touch enters 
> the "UP" state, it goes out of scope after that because a touch is over 
> after release.
>
> Sure I can just check the "Action" to see if it's equal to "UP" but if the 
> touch doesn't exits anymore, that would raise and exception...right?
>
> What I thought about doing was, calling "getPointerCount" again, looping 
> through and getting the IDs again and see if the ID of a touch in my 
> hashtable still exits in the MotionEvent and if the ID exists and the 
> "Action" is still equal to "DOWN", then process the touch.  Otherwise, if 
> the ID does not exists or the "ACTION" is equal to "UP", do a release 
> button event if needed or just delete the touch from my hashtable because 
> it doesn't exits anymore.
>
> I can't help but get the feeling of redundancy though when considering 
> that approach.
>
> Is there a way or method I don't know about that allows you to check if a 
> touch still exits before you process actions relating to it?
>
> I was thinking just now....  Well, kind of guessing that, if you have five 
> touches that hit the screen and one of the touches triggers the opening of 
> a menu and that button had higher priority over the other four touches, you 
> could simply ignore the other for touches for that frame and open the menu 
> and in the next frame of the app, if the other four touches are still down, 
> you can deal with them then accoring to their priority.....  But then 
> again, the touch could still exists in the next frame but the "Action" may 
> be "UP" or "MOVE" instead of down, thus allowing one to write code for a 
> release or move event.  With this thought, storing touch data in a 
> hashtable is really not needed then, granted a touch this is on action "UP" 
> will go out of scope in the very next frame (I'm guessing).
>
> ......hum......
>
> Maybe I'm just over thinking it.
>
>
> Forgive any "typos", eyes are that super any more.
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/0b895dfc-207d-45d1-8283-ca42efcee9e8n%40googlegroups.com.

Reply via email to