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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:19:57+00:00 2026-06-14T13:19:57+00:00

I am making a card game and I have an activity for discarding cards

  • 0

I am making a card game and I have an activity for discarding cards and an activity for showing the scores. The problem is I want to pass some objects (player and dealer hands) to the other activity so that I can set imageViews in the scores to the cards that are in the players hands. How can I do this? I don’t care about security or anything I just want the easiest way.

  • 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-14T13:19:58+00:00Added an answer on June 14, 2026 at 1:19 pm

    Using bundles inside the intent isn’t about security, it’s because the Android guys made it that way plain and simple. In my opinion using bundles and intents to pass larger objects is not a good idea. it gets too complicated to implement, makes you get the object down to the primitives (when using parcelable) and also makes a copy on the other side in memory (you take one object, set everything inside the intent and then re-create it on the other side making a new copy out of it) which for objects that have a bigger memory footprint isn’t good.

    I would suggest:

    1. either using a singleton store
    2. Using the application class (which also acts like a singleton)

    I am often using a singleton which has a hashMap inside where an integer key is generated by me (from atomic Integer) and an object placed inside the map. You just send the ID inside the intent as an extra and retrieve it on the other side by getting the key from the intent and accessing your singleton to retrieve and remove the object (from that map) and use it in your new activity/service.

    Here is a sample of something like this:

    (Note: this is a part from my lib for rest requests (https://github.com/darko1002001/android-rest-client) in case you want to see more details on how everything is implemented). in your case you will need to strip some of the code and replace it with your own, but the general idea is the same.

    /**
     * @author Darko.Grozdanovski
     */
    public class HttpRequestStore {
    
        public static final String TAG = HttpRequestStore.class.getSimpleName();
    
        public static final String KEY_ID = "id";
        public static final String IS_SUCCESSFUL = "isSuccessful";
    
        private static final HashMap<Integer, RequestWrapper> map = new HashMap<Integer, RequestWrapper>();
    
        private final AtomicInteger counter = new AtomicInteger();
        private static Class<?> executorServiceClass = HTTPRequestExecutorService.class;
    
        private final Context context;
        private static HttpRequestStore instance;
    
        private HttpRequestStore(final Context context) {
            this.context = context;
        }
    
        public static HttpRequestStore getInstance(final Context context) {
            if (instance == null) {
                instance = new HttpRequestStore(context.getApplicationContext());
            }
            return instance;
        }
    
        public static void init(final Class<?> executorServiceClass) {
            HttpRequestStore.executorServiceClass = executorServiceClass;
        }
    
        public Integer addRequest(final RequestWrapper block) {
            return addRequest(counter.incrementAndGet(), block);
        }
    
        public Integer addRequest(final Integer id, final RequestWrapper block) {
            map.put(id, block);
            return id;
        }
    
        public void removeBlock(final Integer id) {
            map.remove(id);
        }
    
        public RequestWrapper getRequest(final Integer id) {
            return map.remove(id);
        }
    
        public RequestWrapper getRequest(final Intent intent) {
            final Bundle extras = intent.getExtras();
            if (extras == null || extras.containsKey(KEY_ID) == false) {
                throw new RuntimeException("Intent Must be Filled with ID of the block");
            }
            final int id = extras.getInt(KEY_ID);
            return getRequest(id);
        }
    
        public Integer launchServiceIntent(final HttpRequest block) {
            return launchServiceIntent(block, null);
        }
    
        public Integer launchServiceIntent(final HttpRequest block, RequestOptions options) {
            if (executorServiceClass == null) {
                throw new RuntimeException("Initialize the Executor service class in a class extending application");
            }
            if (isServiceAvailable() == false) {
                throw new RuntimeException("Declare the " + executorServiceClass.getSimpleName() + " in your manifest");
            }
            final Intent service = new Intent(context, executorServiceClass);
            final RequestWrapper wrapper = new RequestWrapper(block, options);
            final Integer requestId = addRequest(wrapper);
            service.putExtra(KEY_ID, requestId);
            context.startService(service);
            return requestId;
        }
    
        public boolean isServiceAvailable() {
            final PackageManager packageManager = context.getPackageManager();
            final Intent intent = new Intent(context, executorServiceClass);
            final List<ResolveInfo> resolveInfo = packageManager.queryIntentServices(intent,
                    PackageManager.MATCH_DEFAULT_ONLY);
            if (resolveInfo.size() > 0) {
                return true;
            }
            return false;
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making a card game in ruby. I have the Game class, which
I am making a card game where the player can touch and drag around
I am making card game in C# WPF. For now I have singleplayer mode,
I'm making a game in c++. It is a card game. I have made
I am making a JFrame for a card game. I want to restart the
I am brand new to Cocos2d and have begun making a simple card game.
Possible Duplicate: 3 player card game turn system I'm making a GUI 3 player
I am making a card game where the cards are represented as JLabels, having
I’m making a bot that can test some card tactics on a game, the
I'm making a card game and I need to previously create the cards and

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.