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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:15:09+00:00 2026-06-15T11:15:09+00:00

I have an array of Classes, like this: private static final Class[] testerClasses={ Tester1.class

  • 0

I have an array of Classes, like this:

private static final Class[] testerClasses={
    Tester1.class
};

I need it to be like this, so I can start Android intents, like this:

intent =new Intent(this,testerClasses[0]);
startActivity(intent);

I’m trying to figure out how to do the following, and I’m really struggling to figure out how to do it…

  1. I need to call functions from an instance of the class. For the most part, these are static or static like functions, so merely getting an instance of the function is sufficient.
  2. I need to make sure I can pass the class as the Intent structure requires.

Why do I want to do this? Sometimes I want to call the function like an intent, other times I just want to get data about the intent, without having to call it. My abstractTester class (Of which all concrete tester classes inherit from) contains a few things like the name of the test, which is handy to have before the Intent has even started.

Thanks for the help!

  • 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-15T11:15:11+00:00Added an answer on June 15, 2026 at 11:15 am

    The correct solution is:

    private static final abstractTester[] testerClasses={
        new Tester1()
    };
    
    intent =new Intent(this,testerClasses[0].getClass());
    startActivity(intent);
    

    Then if I need to reference the class, I can just do it. Works like a charm!

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

Sidebar

Related Questions

I have array like this: $path = array ( [0] => site\projects\terrace_and_balcony\mexico.jpg [1] =>
I have array result like this: Array ( [0] => stdClass Object ( [id_global_info]
Let's see if I can describe this properly... I have an abstract class that
Right now I have classes like: abstract class Record { // Required fields val
I have a class that looks like this. class A { public: void doSomething();
This is simple version of my problem. I have 3 classes: public class TopographyFrame
I have two different classes that have the same class as a private field.
As you can't have an array in a define or a class constant I
I have two classes which look like this in barebones form: @interface GraphNode {
I have an array of classes (Voxel) in a class. I use the following

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.