Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6216401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:14:39+00:00 2026-05-24T07:14:39+00:00

I need to write an Android application that can receive UDP packets and, for

  • 0

I need to write an Android application that can receive UDP packets and, for each one of them, display a new object on the screen with OpenGL.

I have tried the following:
My OpenGL renderer class has an ArrayList of objects that are rendered every frame and I created a function that adds new objects to this list when called.

In my main activity, I have created a new thread to deal with the incoming UDP packets. Every time a new packet is received, a message is sent to the handler who calls the function that adds a new object to the list.

This works at first, when the packet is received, the object is displayed, but if I press BACK and start the application again right away, the new objects are not displayed anymore even though the packets are being received (I can tell through the log).

Is this the right way to go but I am missing something or is there a better way to achieve the expected result?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T07:14:40+00:00Added an answer on May 24, 2026 at 7:14 am

    I found what was causing the problem. The network thread was the problem. It would continue running after the application was closed and therefore would update the wrong list. I had to make the thread stop when the onDestroy() was called.

    To fix it, I added some “stop” flags to break the while(true) loop but that still wouldn’t work well, so the trick was to close the socket that was waiting for data (s.receive()).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to write an Android application that can display some data received(polled) from
I'm new in the android developing. I need to write some simple application -
i need to write simple android application that run on the background and read
I am in need to write an application for Android devices that needs to
I need to write a java application that detects a USB device, and can
I need to write a Java Comparator class that compares Strings, however with one
I need to write a Delphi application that pulls entries up from various tables
I am starting a sample Android application and one of the things I need
I need to write an application that sends data to the Google App Engine
I want to write an application that will be running on several phones (android,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.