This week's book giveaway is in the Spring forum.
We're giving away four copies of Pro Spring MVC with WebFlux: Web Development in Spring Framework 5 and Spring Boot 2 and have Marten Deinum & Iuliana Cosmina on-line!
See this thread for details.
Win a copy of Pro Spring MVC with WebFlux: Web Development in Spring Framework 5 and Spring Boot 2 this week in the Spring forum!

Glenda Karen

Ranch Hand
+ Follow
since Oct 02, 2020
Cows and Likes
Cows
Total received
2
In last 30 days
0
Total given
0
Likes
Total received
5
Received in last 30 days
0
Total given
67
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Glenda Karen

I have an android app which turns on a sensor on my device and collects and displays data in the app to the user.

On the home screen the user presses "START" which opens a new page that displays the data.
When the user presses the back button it take them back to the home page.

The problem I am facing is when the user presses "START" again, the display page still shows values from the previous test.

Here is the AndroidManifest:


Part of the MainActivity code:


Thanks so much!
1 month ago
Thank you! We seemed to have solved the problem adding mFlashThread = null; in to the onBackPressed() if statement.

Thanks again for your help!
1 month ago
Thanks so much!

I think I only have this one thread running:
1 month ago
Hi, thanks so much for your reply.

The code for when the back button is pressed looks like:


The thread, both for sensor thread and network is started (or stop) by startFlashSensor()

when it is false, the method stops

but the network continues, even the part inside the statFlashSensor method.

So I guess my question now is, how to stop both threads (network and sensor)?
1 month ago
I have an android app which turns on a sensor on my device and collects data, the data is then sent via http requests and a response is returned back to the app.
However when the back button is pressed it doesn't go back to the home page of the app, instead it crashed with:


unfortunately app has stopped


And I get these errors:


If I press the back button before data gets collected then the app goes back properly to the home screen.

It seems that the ServiceConnection class is still running which is causing the error.

Any suggestions would be great,
Thanks so much!
1 month ago
Hello,

I have a few round circles in my app. I would like to change their colour depending on the response I get from an http request.
The cirlces look like:

and are being added in as FrameLayout like:


Then in the java code the http request is being made:


So if the response is 1, the circle will turn green, if the response is 2 the circle will turn blue etc.

Thanks so much!
1 month ago
Hello,

I am wondering if there is a way to make a few circles that change colour depending on a trigger?
For ex. if the app is displaying temperature of the user, the circle will be green if the temperature is in a normal range, red if the temperature is a low grade fever and blue if a high grade fever. (And another circle for other measurements etc)

Can this be done in android studio itself or will I have to add something like JavaFx or the like?

Thanks so much!
1 month ago
Hi Ron McLeod,

Just wanted to thank you again for your help! We used the OkHttp library as you suggested and it worked!

(We used verison com.squareup.okhttp3:okhttp:3.12.0 for Api 19)
1 month ago
Good to know API 19 is still being used and actually has some benefits too:)

Thanks so much again for all the help!
1 month ago
Thanks so much!

Wow that is very interesting re apache.

At the moment the API needs to stay at 19 to be compatible with the devices the app is running on.

Perhaps though as you mentioned, I can use another library. I think java.net.HttpURLConnection; is compatible with API 19, so maybe that could be a solution.

Thanks again for all your help!
1 month ago
Thanks so much! Really appreciate your time helping me!

It seems one of the SDKs we are using in the app is calling maven.apache could that be the problem? and is there anything we can do about it?(since we need this sdk)
1 month ago
Thank you!

I tried adding the dependency but sill got the error:(

I checked the external library and I can see the class is there.
1 month ago
Hello,

I am running code in an app to send data to a web service.
The app is in API 19 and I am using org.apache.httpcomponents

However I keep getting an error:
java.lang.NoSuchFieldError: org.apache.http.conn.ssl.AllowAllHostnameVerifier.INSTANCE


The code looks like:

and running the request:

The build.gradle looks like:


Thanks so much!
1 month ago
Thanks so much for your help!

We were able to get it working by adding permissions in manifest and changing some of the way we were sending the data.
2 months ago
Thanks so much!

I unplugged my device, ran the app, replugged and went to logcat in android studio.

The Logs looked correct and normal, the only issue I had with logcat was once I plugged in the device it only started showing the logs from that point but since the device was no longer around my wrist the data stopped being collected so I couldn't see my println of the data.

But either way, while the device was on my wrist I could see data displayed on the watch but was not being sent to the database.
2 months ago