Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.n0614144.studioa;
- import android.content.Intent;
- import android.os.Bundle;
- import android.support.annotation.NonNull;
- import android.support.annotation.Nullable;
- import android.support.v4.app.Fragment;
- import android.view.LayoutInflater;
- import android.view.View;
- import android.view.ViewGroup;
- import android.widget.Button;
- import com.google.firebase.auth.FirebaseAuth;
- import com.google.firebase.database.DatabaseReference;
- import com.google.firebase.database.FirebaseDatabase;
- public class ProfileFragment extends Fragment implements View.OnClickListener {
- private FirebaseAuth auth;
- private DatabaseReference mDatabase;
- public Button b;
- @Nullable
- @Override
- public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
- View v = inflater.inflate(R.layout.fragment_profile, container, false);
- b = v.findViewById(R.id.signoutButton);
- b.setOnClickListener(this);
- return v;
- }
- public void onCreate() {
- auth = FirebaseAuth.getInstance();
- mDatabase = FirebaseDatabase.getInstance().getReference();
- }
- @Override
- public void onClick(View v) {
- switch (v.getId()) {
- case R.id.signoutButton:
- auth = FirebaseAuth.getInstance();
- auth.signOut();
- Intent intent = new Intent(getActivity(),LoginActivity.class);
- startActivity(intent);
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement