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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:38:52+00:00 2026-05-27T17:38:52+00:00

For instance when using database connection, threading or IO streams (all what is required

  • 0

For instance when using database connection, threading or IO streams (all what is required explicit closing/free up) is there some standard way of doing this? Perhaps by implementing some standard interface so Framework/class consumer would be able call this resources cleanup logic for my class?

For those who have some experiance with .NET Framework analogue would be IDisposable interface, so by implementing this interface I can put all resource-cleanup logic in Dispose() method so class consumers would be able check whether an instance of a class implements IDisposable interface and then call Dispose() explicitly.

Is there something built in Android as well?

  • 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-27T17:38:53+00:00Added an answer on May 27, 2026 at 5:38 pm

    Yes, Services and Activities have lifecycles. When they are ‘closed’, the onDestroy() method will be called. There are multiple lifecycle methods in Android and it is really important to learn when to use what. This is described on the following pages:
    http://developer.android.com/reference/android/app/Activity.html
    http://developer.android.com/reference/android/app/Service.html

    From these onDestroy() methods, you should close your resources.
    If you have a lot of resources to close, you might want to let them implement an interface and store these resources into a collection so that you can loop through your resources when onDestroy is called.

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

Sidebar

Related Questions

I need to import a database into a SQL Server instance using a batch
When you move beyond using one instance for your database, what is the best
I'm enumerating all databases of an SQL Server 2005 instance using SMO like as
I have upgraded a SQL Server Express 2005 instance to Standard using the best
Is it acceptable to cache an instance of the database connection on application start?
I have a tomcat instance setup but the database connection I have configured in
i load a class using Class.forName(klassname,false,loader) After this i create an instance using klass.newInstance();
When I try to change the default collation of a SQL Server instance using
Using instance methods as callbacks for event handlers changes the scope of this from
Does startService() create a new Service instance or using the existing one? For example,

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.