-
Notifications
You must be signed in to change notification settings - Fork 137
/
MainActivity.java
42 lines (35 loc) · 1.19 KB
/
MainActivity.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package com.auth0.samples;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import androidx.annotation.Nullable;
/**
* Created by lbalmaceda on 5/10/17.
*/
public class MainActivity extends Activity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_activity);
Button loginButton = findViewById(R.id.logout);
loginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
logout();
}
});
//Obtain the token from the Intent's extras
String accessToken = getIntent().getStringExtra(LoginActivity.EXTRA_ACCESS_TOKEN);
TextView textView = findViewById(R.id.credentials);
textView.setText(accessToken);
}
private void logout() {
Intent intent = new Intent(this, LoginActivity.class);
intent.putExtra(LoginActivity.EXTRA_CLEAR_CREDENTIALS, true);
startActivity(intent);
finish();
}
}