I'm trying to make an Android app that logs into my University's student webpage in the background and gathers specific data like class timings for my next class and then displays it in a TextView
in the App. How do I achieve this?

- 37,901
- 21
- 84
- 115

- 53
- 6
-
You need to learn JSON and API calling for that. – Arjun Feb 27 '18 at 18:13
-
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. – ADM Feb 27 '18 at 18:13
-
Please provide the response, without watching we can't help you – Shalauddin Ahamad Shuza Feb 27 '18 at 18:17
1 Answers
There are so many ways to share data from one activity to another.Here I described two of them.
1. Declare static variable because
Static variables are initialized only once, at the start of the execution. These variables will be initialized first, before the initialization of any instance variables. A single copy to be shared by all instances of the class. A static variable can be accessed directly by the class name and doesn't need any object.
For Example: In First Activity
EditText edit;
static String sample;
//Code
edit = (EditText) findViewById(R.id.edt_txt);
sample=edit.getText().toString();
In Second Activity
TextView txt;
txt = (TextView) findViewById(R.id.txt);
txt.setText(First_Activity.sample);
2.Second Method is using putExtra() and getExtra()
In First Activity
EditText edit;
String sample;
//Code
edit = (EditText) findViewById(R.id.edt_txt);
sample=edit.getText().toString();
Intent i=new Intent(this,Second_Activity.class);
i.putExtra("text",sample);
In second Activity get these values:
TextView txt;
String test;
txt = (TextView) findViewById(R.id.txt);
Intent i=getIntent().getExtra();
test=i.getString("text");
txt.setText(test);
Read these for more information
https://www.androidhive.info/2011/08/how-to-switch-between-activities-in-android/
How to use putExtra() and getExtra() for string data
Hope this one will be helpful.

- 1,280
- 1
- 13
- 17