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

  • SEARCH
  • Home
  • 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 6248509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:04:17+00:00 2026-05-24T13:04:17+00:00

I am creating a android app that uses a TCP socket to connect to

  • 0

I am creating a android app that uses a TCP socket to connect to a server. It continuously receives xml strings from this socket and I need to parse it as it comes. Currently I’ve implemented the socket in a service in the same process of the application.

I get outofmemory exception sometimes. The xml strings I receive will be around 1-3mb.
My question is, will it be more efficient if a run my service in a separate process as my socket constantly needs to work? What is the best way to implement a socket in android which works the app life span?

  • 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-24T13:04:19+00:00Added an answer on May 24, 2026 at 1:04 pm

    You should definitely put your socket in a thread. If it’s not the case you take the chance to freeze the entire application on network timeout for example.

    There is several different way to make a thread in android. My favorite is to create a class which extends Thread.

    have a look to the painless threading in android doc and the more general Processes and Threading article

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

Sidebar

Related Questions

I am fairly new to android and I am creating an app that uses
i'm new in java/android app and i'm creating an app that uses user-location. I
So I'm creating an Android app that uses Unity ... I am getting some
I am creating an Android app that uses Twitter4J to read some user info.
I am creating an android app that is basically a listing of information on
I'm creating android app that has table layout for the main activity, and that
I am creating an android app that basically records an applies an Effect on
I'm creating an android app that is exchanging data with a web app via
I am a php/mysql developer learning android. I am creating an android app that
I'm creating an android app that will share content through twitter and i'm facing

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.