I parse a html document and save the data in class. how can I access that class from different classes without initiating it again because I want to use one version of that class
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
Why dont you set it to a static variable?
public static HtmlData data;
private void parse() {
···
data = result;
}
// now you can use the data object anywhere in your code by calling HtmlData.data