What does context in java and android mean? what should I do?

Source: Internet
Author: User
What does context in java and android mean? what does context in java and android mean. It is Context. What is this? if an error occurs, the Context appears so frequently in Java, but the Chinese translation "Context" is so strange, as a result, many people do not understand the specific meaning of Context, so there is a lot of java, what is the meaning of context in android?
What does context in java and android mean. Context. What is this?

------ Solution --------------------
The error message is returned.

The appearance of Context in Java is so frequent, but its Chinese translation "Context" is so strange that many people do not understand the specific meaning of Context, therefore, it is necessary to go deeper into the meaning of the word. Let's take a few examples of Context in JAVA (1) javax, a class of JNDI. naming. initialContext, which reads some configuration information about JNDI and contains the ing information between the object and its registered name in JNDI. See the following code.

InitialContext ic = new InitialContext ();
RMIAdaptor server = (RMIAdaptor) ic. lookup ("jmx/invoker/RMIAdaptor ");

This is the code for obtaining MBean remote call classes in JBoss. Here, the RMIAdaptor is obtained through the JNDI registered name "jmx/invoker/RMIAdaptor" in InitialContext.
Object. This is a bit like MAP in the JAVA Set. there is a String key that maps its objects. (2) Let's take a look at the most common Spring code below. ApplicationContext is the information that contains the configuration. xml configuration file, so that you can use the getBean name to get the corresponding registration object.

ApplicationContext ctx = new FileSystemXmlApplicationContext ("configuration. xml ");
Object obj = ctx. getBean ("Object_Name ");

From the above code, I can understand the meaning of Context: Public Information, environment, container ..... Therefore, it is not intuitive to translate Context into a Context. it may be better to translate Context into an "environment" or "container" based on the language environment. Translating Context into "Context" is not intuitive, but it is not a big mistake. Let's take a look at the meaning of "context" in Chinese. We often say that we can't "take it out of context", but we need to contact its "context. For example, Xiaoli said "I love you" to Wang Laowu, but she thought she was talking about love. But when I look at the context-"although I love you, but you are too poor, let's break up." The taste has completely changed. From this point of view, "context" also refers to "environment", that is, the language environment.

PS:

Context is an abstract concept. Common contexts include pageContext in Servlet, which is used to access JNDI. People who have written these codes may be easy to understand. In fact, their real role is to link them up and down. For example, the upper layer of pageContext is the WEB container, and the lower layer is the Servlet class you wrote. pageContext serves as the intermediate channel to allow the Servlet to interact with the Web container. Another example is to access the Context of JNDI. the upper layer is the JNDI server (which may be remote) and the lower layer is your application, its role is to establish a channel for you to access the JNDI server, and also let the JNDI server accept your request, also play an interactive role.
------ Solution --------------------
Discussion

The error message is returned.

The appearance of Context in Java is so frequent, but its Chinese translation "Context" is so strange that many people do not understand the specific meaning of Context, therefore, it is necessary to go deeper into the meaning of the word. Let's take a few examples of Context in JAVA (1) javax, a class of JNDI. naming. initialContext, which reads some configuration information about JNDI and contains the object and its registered name in JNDI ......

------ Solution --------------------
Then you are wrong. this is the naked copy.
Discussion

Reference:

The error message is returned.

The appearance of Context in Java is so frequent, but its Chinese translation "Context" is so strange that many people do not understand the specific meaning of Context, therefore, it is necessary to go deeper into the meaning of the word. First, let's take a few examples of the Context used in JAVA (1) a class javax. naming. InitialContext of JNDI, which reads ......

------ Solution --------------------
Discussion

Then you are wrong. this is the naked copy.
Reference:

Reference:

The error message is returned.

The appearance of Context in Java is so frequent, but its Chinese translation "Context" is so strange that many people do not understand the specific meaning of Context, therefore, it is necessary to go deeper into the meaning of the word. Let's take a few examples of Context in JAVA (1 )......

------ Solution --------------------
For android, the current level only knows the Context, which generally indicates the current Activity class instance. In the Override method of Activity, if Context needs to be passed, this will be directly passed. in some cases, the Activity name. this is required, for example, the Context to be passed in the implementation of the event-class method.
Why did you send it here? csdn has an android version, a mobile platform> Android.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.