I have a main class which has edittext box. And i have another class in the same source folder. Now i want to use the text typed in main class accessible to the another class.
any help is greatly appreciated
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.
There are different approaches:
1) You could store the value in a static variable somewhere globally in your app (when you leave the activity = onPause) – works ok if your app activities run all in the same process, which by default is the case – unless specified differently in your manifest
2) or use the SharedPreferences (ref. to android dev docs).
3) If your one activity starts the seconds one right after, you could pass the value as an intent extra (ref. to android dev docs):