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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:44:52+00:00 2026-06-18T04:44:52+00:00

How can you access variables content in public class Global extends Application { String

  • 0

How can you access variables content in

    public class Global extends Application {
    String gotUsername;
    String gotPassword;
    String gotIPAddress;

    void onStartCommand(Intent intent){
        Bundle gotAuthen = intent.getExtras();
        gotUsername = gotAuthen.getString("key1");
        gotPassword = gotAuthen.getString("key2");
        gotIPAddress = gotAuthen.getString("key3"); 
    }

    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate();
    }

}

from a Public class like this one?

Public Class MyApp {

}

I tried with

Global Username = (Global) getApplicationContext();

but I found out getApplicationContext(); is used for Activities only.

How should I do it then?

Thanks for your 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-18T04:44:53+00:00Added an answer on June 18, 2026 at 4:44 am

    Make the variables in the Global class static.

    static String variable;
    

    then you can access them by doing String stuff = Global.variable;

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

Sidebar

Related Questions

I can't access env variables in the Rails console, while in the application they
I am trying to access child class variables in parent class..can u suggest me
How can I access a variable in one public class from another public class
I'm perplexed why I cannot access my global variables from my service. I can
I created a class extending Application to have global variables in my app. I
How can we access variables of a structure? I have a struct: typedef struct
How can we access and reference classes and variables in different pages in ASP.NET?
Pretty often I need to access $config variables in views. I know I can
I'm trying to access a member structs variables, but I can't seem to get
How can I access a static variable in a separate class in PHP? Is

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.