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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:24:57+00:00 2026-06-16T02:24:57+00:00

When I write my activities on android, I have to override a lot of

  • 0

When I write my activities on android, I have to override a lot of “lifecycle” methods, such as onCreate, onActivityResult:

class MyAcitivity extends Activity {

    @Override
    public void onCreate(...) {}

    @Override
    public void onStart(...) {}

    @Override
    public void onActivityResult(...) {}

    @Overide
    public void onBackPressed(...) {}
}

I don’t like this, because I found my logical code are split to everywhere in my class. I do some operation in this method, but I have to handle the result in another method.

Is it the only way to design Activity like this? Is there any other solution can let me do the same without overriding methods from super classes?


Update

I do some operation in this method, but I have to handle the result in another method.

For example:

public void onCreate(...) {
    startActivityForResult(new Intent(this, AnotherAcitity.class), INTENT_ANOTHER);
}

public void onActivityResult(...) {
    if(requestCode == INTENT_ANOTHER)  {
        // do something
    }
}

Update again

I know how to use these lifecycle methods, what I’m thinking is the “design”. Is there any different way to design android (in theory) without “overriding lifecycle methods” to write activities. Does ios and win8 on mobiles use the same design as android? If I develop an ios or win8 application, do I have to override all kinds of lifecycle methods as I do on android?

  • 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-06-16T02:24:59+00:00Added an answer on June 16, 2026 at 2:24 am

    You only need to override the methods you’re using in your Activity. So if your activity simple displays a help page that has already been populated in the XML, you only have to override onCreate() and call setContentView().

    In general, if your overriden method is like:

    public void myOverridenMethod() {
        super.myOverridenMethod();
    }
    

    That is to say, it contains nothing but a super call, you need not override it.

    In the example you provided, you must override the appropriate lifecycle methods as the calling of these is beyond your control, unless you’re willing to develop a custom ROM for your device(s).

    EDIT

    The Android lifecycle methods are called by the system at specific predefined points in your app’s life.

    You cannot design an Activity in a different way, as if you do Android has no idea which method does what. However, it knows exactly when to call which method in the Android lifecycle. By using your own methods instead of these, you have an app which Android cannot interact with.

    Additionally, many lifecycle methods like onCreate() etc. help setup the initial bits of your app (like getting it a Context).

    iOS and Windows Phone and BlackBerry have similar lifecycle methods, but they don’t always have an exact Android equivalent, as all are different platforms and handle their apps differently.

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

Sidebar

Related Questions

I write simple project in android. I have ~10 activities, and the user flipping
I have four activities in my application A-->B-->C-->D. I write a My own class
I have an Android application composed by several Activities. Most of them need to
For an look and feel of IOS or Android app we have to write
I am a university student. I have been working a lot with Android lately
I'm trying to write an android application that has two main activities: login screen
According to the LibGDX web page: Android applications can have multiple activities. Libgdx games
I have one question about Android. I need to run one of my activities
I have a table activities of activity entries, e.g.: ID | Date | Activity
I want write code once and use in different activities. I have created 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.