Detecting whether user is standing or sitting - java

I want to predict a standing to sitting transition and vice versa of a user in Android. But I guess, currently Google's DetectedActivity Api gives everything but sitting-standing transition. What are the other ways of doing this? Also, I have tried gathering the accelerometer values, but don't know how to get a pattern from the values and then later predict transitions using that pattern. So how should I proceed?

According to the documentation:
public static final int TILTING
The device angle relative to gravity changed significantly. This often occurs when a device is picked up from a desk or a user who is sitting stands up.
I have highlighted the key phrase. This would appear to be the answer you seek.

Related

How to detect the mouse cursor/click in a previously recorded video/image frame

I have some screencasts that explain how to perform a task in a specific software. My objective is to detect where the user clicks on a button or menu item or anything else that leads to a change. One solution to this work is to detect the mouse cursor's location. There are several challenges:
The cursor's icon changes and is not always the same in all videos (e.g. Mac vs Win, arrow shaped and hand shaped cursors).
I tried template matching, but I did not get good results because the display settings of each person who is capturing the video may be different and therefore the size of the cursor will be different.
Calculating the difference between two consequent images can give the mouse cursors only in the output but I need to have only the second or the last image's cursor's location in the output not both of them.
I also tried to find an object tracking sample solution, but they are either for live videos or for multiple objects ( I only need to spot the mouse cursor or the locations where the mouse was clicked on)
I would appreciate if if anyone could suggest a solution, ready to use code (in Java/Matlab/Python), software or API for this work.

Adding 5900+ markers to Google Maps on Android. How to do efficiently

I am creating an app that uses Google Maps to show locations of stores. I have an array of 5900+ locations that I would like to have on the map. I am currently using https://github.com/MadsFrandsen/MapStateListener to make markers in a location visible and hide all other markers that are not in the screen range.
However the problem is mainly how loading 5900 markers onto the map on initialization takes quite a few seconds and reduces the devices speed and I keep retrieving errors about skipped frames.
What methods do I have that will best allow me to have these locations available when a user scrolls from state to state (as I load 50KM away from initial device location) ?
I don't think any user will find a visual filled with 5900+ markers useful.
There's no way to make this problem go faster unless you can figure out a meaningful way to display less data. You need to filter those locations better. Maybe only displaying those stores within a 10 mile radius of the current GPS location would work better. It'll render faster, and your users will thank you for not confusing them.
I pretty much doubt you need to display all 6k markers on your map at once as your view will get rather crowdy. However if you really think that makes sense, there's library that you may find useful -> Android Maps Extensions
demo: https://play.google.com/store/apps/details?id=pl.mg6.android.maps.extensions.demo
code: https://www.google.com/url?q=https://github.com/mg6maciej/android-maps-extensions/&sa=D&usg=AFQjCNEnOeOZB4NbvpjQldmChbVbzCZV7Q
First, you should group your markers into one if they are too close to each other when user zooms out. Then you should update your map only if user stops scrolling, zooming. It will take you a possibility to make UI faster.
You should add so many markers on map so user can see on the screen

Slick2D Movement Issue

So, I converted a game to Slick2D. The movement is broke, and I am at a loss. Before, we used KeyPressed and keyReleased methods, but now with Slick2D movement isn't working right.
Yea, nothing has gone right with converting to Slick2D. First the launcher, which I had a help topic on before, and now this. Though, the other topic was an issue with WebStart hating code.
You can only move right, using A. And you can't stop moving. Am I using the right methods? How can I fix it? Any help is greatly appreciated!
Here is a PasteBin link to the code, if it helps! http://pastebin.com/GRH86Yuw
I'm a fan of Slick, and I'd be happy to help.
The fundamental difference is that Slick is a polling model, not an event-driven model when it comes to input. Basically, in your logic update method you loop through the keys bound to your events, and check to see if any of the keys are currently pressed, and then trigger those events. For a number of reasons that I can go into if you like, polling tends to work better for games, especially with a large number of keys. It's just a different way of doing things, an not that complicated. The biggest upside is that you get centralized input processing a single method, instead of having it spread across multiple KeyListener instance objects.
If you want to look at Pedestrians - a simple pedestrian sim implemented in Slick - you can see an example of how to handle input in Slick.
Specifically, I handle input in this file (lines 192-295), inside the processInput method. Basically, you pass in a reference to the GameContainer object (the Slick object that contains your game), and from that you can get an instance to the Input instance that will allow you to check which keys are pressed, what mouse buttons are clicked, etc.

How to determine when a map waypoint is reached

I have a navigation program, and if there are 4 waypoints, I would like to highlight on the details list which part you are currently on, and also I could show the distance to the next waypoint and the total distance.
So, you may have:
Go right on Main Street, 1.3 miles
Go left on Broadway, .5 miles
Go left on Concord Blvd, 2 miles
But, how do I determine when a phone starts on a different waypoint.
Using the LocationManager you can set several ways for updates on a particular program. Use LocationManager.addProximityAlert() to be alerted if you're in a particular distance to a waypoint. Additionally you can use Location classes to get distance for example waypoint.distanceTo(currentLocation);.
The solution I am going with is to use a passive provider, so that if the navigator is being used then my application will still know where the user is.
Then, just keep track of where they were previously and where they are now, and look at the difference in how far they are from the waypoint, and once they get to a certain distance then let them know and change to the new waypoint.
The addProximityAlert made it difficult to know which waypoint to change to and it didn't work as well as I was hoping, and since I need to know where the user is to update their marker, there was no reason not to just add some calculations at the same time.

Java | I need to make an applet but I don't know how to begin

I need to make kind of a game in Java but I am a total beginner. It has to be applicable to the web and I need to use images on it and action listeners. So, do you recommend any site to know how to begin?
The description of the game (it is not really a game but it implements things that usually are in a game) is this:
Show a matrix of images of 3x3 elements, then, hide them and put instead empty squares. The images shown in the matrix, must remain in the lower part of the screen just below the empty squares and they must be randomly positioned. The user, must click one image and put it on the correct empty square. The result, must be, how many images were correctly positioned, the time it took to end the game, the time between mouse clicked and released for each image.
For additional information, I want you to know that this application is for a friend of mine who studies medicine. He wants this program to test patients who accident and receive hits on their heads. You may think that the description I gave you may not be a good software for that purpose, and in fact, it may be not, but, once I know the management of all that is required (Images, MouseListeners, how to introduce it to a web etc), I will be able to make a better product. So, please tell me, how can I begin?. What do I need to know?
I would start here. Except for some startup boilerplate and the restrictions of the sandbax (which, based on your description, you will b unlikely to encounter), there is no fundamental difference in an applet from normal code.

Categories

Resources