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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T18:52:47+00:00 2026-05-14T18:52:47+00:00

I read some documentations about classloaders, but im still not sure where and why

  • 0

I read some documentations about classloaders, but im still not sure where and why they are needed. The Android API says:

Loads classes and resources from a
repository. One or more class loaders
are installed at runtime. These are
consulted whenever the runtime system
needs a specific class that is not yet
available in-memory.

So if i understand this correct, there can be many classlaoders which are responsible for loading new classes. But how the system decides which to use? And in which situation should a developer instantiate a new classloader?

In the Android API for Intent there is a method

public void  setExtrasClassLoader  (ClassLoader  loader)

The description says:

Sets the ClassLoader that will be used
when unmarshalling any Parcelable
values from the extras of this Intent.

So can i define there a special classloader so that i can pass object with an Intent which are not defined in the receiving activity? An example:

If activity A which is located in Project A (in Eclipse) defines an object which i want to send to Activity B in Project B using putExtra of the Intent object. If this object which is send over the Intent is not defined (source code in project B), then there is a NoClassDefFoundException. So can i use the method setExtraClassloader to avoid this exception? If yes, how can i decide which classloader object i have to pass? And how do I instantiate it correctly?

  • 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-14T18:52:48+00:00Added an answer on May 14, 2026 at 6:52 pm

    I read some documentations about
    classloaders, but im still not sure
    where and why they are needed.

    Generally speaking, you do not need to touch the classloader system.

    And in which situation should a
    developer instantiate a new
    classloader?

    After about a decade’s experience in Java programming. 🙂

    If activity A which is located in
    Project A (in Eclipse) defines an
    object which i want to send to
    Activity B in Project B using putExtra
    of the Intent object. If this object
    which is send over the Intent is not
    defined (source code in project B),
    then there is a
    NoClassDefFoundException. So can i use
    the method setExtraClassloader to
    avoid this exception?

    No, because Project A and Project B cannot share code. Put the class you need in both projects. Or use a remote service interface with AIDL instead of Intents and extras. Or do not use a custom class, but rather treat the object as a data structure (e.g., use a simple HashMap of Strings or something).

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

Sidebar

Related Questions

I've read some documentation and tutorials about developing Firefox Addons. But never found how
I've read the documentation about __init__.py files and some nice questions here on SO,
I've read some documentation on how Adaboost works but have some questions regarding it.
I have read some of the basic Google Apps Script documentation/tutorials. I have not
I've read through a lot of the documentation and for some reason this still
I read some articles about Comet tech. All of them mentioned that the long-life
I need some advise about how to read PyQt's documentation. Because on my own
I've never used a MySQL API before. I read about the oursql API that
I have read some documentation and blogs about the difference between merge a range
I read some articles about HTTP headers compression. Today I installed YSlow and it

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.