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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:55:02+00:00 2026-05-30T16:55:02+00:00

I was recently doing an application in android and at some part I got

  • 0

I was recently doing an application in android and at some part I got a doubt that which is the efficient way of sharing Data. Like I can declare a static variable in one class and call that variable from the other class using Classname.Variablename or I could pass that data with my intent and get data from intent from the other class or I can use shared preferences and get data from it or I could even store that data in database and retrieve it from the other class from the database. What my doubt was which will be the most efficient way to do that (get data)? Since android applications are ultimately designed for phones memory usage and efficiency should be constraints. Could anyone guide me in the right path, it would be very helpful.

  • 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-30T16:55:04+00:00Added an answer on May 30, 2026 at 4:55 pm

    My opinions:

    Each one is best depends on the scenario. Let me explain.

    Static Variable:

    Static variable are common ways to give access to whole application context. If you want to maintain few datas which is not necessary to be maintained after the application exited, this is the best one.

    Passing data through Intent:

    This is not a kind of data storing. This is a kind of data sharing. I think this is the best way to pass data from activity to activity. But maintaining the keys for values in Constants is a good programming thing.

    Shared Preferences:

    Shared Preferences is nothing but a simple table which has two columns. (key, value).

    advantages:

    1. Fast retrieval
    2. Easy to understand and program

    cons:

    1. Maintaining Keys are difficult if we store a lot of values.
    2. User can clear this at any time.

    Database:

    When we have a lot of values to store with complex structure, we are left with only one great solution, ie. DB.

    advantages

    1. We can maintain structure of data.
    2. Android has nice and simple APIs to handle sqlite operations.

    cons

    1. Operation is little bit slow comparing to shared preferences.
    2. user can clear this at any time.

    So we found the major problem is we can’t maintain the persistence whatever storage we use. A simple and effective solution is to maintain data online and sync it with mobile db each time the application is started.

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

Sidebar

Related Questions

One thing I've started doing more often recently is retrieving some data at the
I've been doing quite large application recently with Java - Swing. Now I'd like
I have recently designed a web application that I would like to write in
I recently began doing facebook application development. But it seems that the information out
I recently developed an application for Windows XP and newer which make some changes
I've recently been doing a lot of Objective-C programming, and just got back into
I have Java experience and recently am doing some C++ coding. My question is
I recently ran up against a wall doing some bash shell programming where an
I have an old MonoRail/ActiveRecord I've been doing some work too. Recently I decided
I have recently written an application(vb.net) that stores and allows searching for old council

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.