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 7430671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:10:44+00:00 2026-05-29T09:10:44+00:00

Really I guess I am looking for a best practice answer. I like to

  • 0

Really I guess I am looking for a best practice answer. I like to leave applications with the lightest amount of code possible and the least amount of repeated code especially. I have a few Android applications that I have created. My question is, if I create a new Activity which in turn also needs a class to be created of a similar name, should I create the class separate or is there some way that I can keep the class that extends the Activity already?

Here is an example, lets say I want to create a small activity that is related to Pinging an Address. I could implement Parcelable on that Activity and use my Activity as a data holder Class.

public class PingAddress extends Activity implements Parcelable{
public String Scan;
public String ScanName;
public String IpAddress;
public String Timeout;
public String NumberOfPings;

public PingAddress() {

}
    public void onCreate(Bundle bundle) { 
        super.onCreate(bundle);
    }

What I have been doing is just creating the activity and then creating a separate class, using the example above, called PingAddressData, here is an example of that class.

public class PingAddressData implements Parcelable{
public String Scan;
public String ScanName;
public String IpAddress;
public String Timeout;
public String NumberOfPings;

public PingAddress() {

} 

Again, I am really looking for best practice here with Android. Does anyone know of repercussions that I would run into if I just implemented Parcelable on an Activity? My main objective is to cut down on code pages. I created a separate Package just to store all of the data classes in that I created, but were really a representation of that Activity.

Thanks

  • 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-29T09:10:44+00:00Added an answer on May 29, 2026 at 9:10 am

    I’m not sure about a “best practice”, but it is certainly a good idea to keep your Parceable separate than the Activity. If you do make your Activity Parceable and pass it through an Intent you risk keeping references to Activites past and thus open yourself up for memory leaks.

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

Sidebar

Related Questions

I guess I'm just really looking for some advice on how to approach my
Looking at other people's code it seems really common to include an extra space
I guess I'm really after an aid to help people who forget, Cruise Control
Really stuck on trying to write code to unzip a file or directory on
I'm looking to start a new application up - the concept's really simple I
I'm looking for an elegant way to compute the score of a guess in
Her's my probleme, i guess its really basic. I'm trying to lookup in the
I guess I would need some really good explanation on some Model related concepts.
I'm looking for an efficient way to do a conditional insert. Ideally, I'd like
Thanks for reading. Not really looking for a solution here, since there are a

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.