【发布时间】:2020-11-17 14:33:49
【问题描述】:
我正在尝试创建一个注销按钮,该按钮将我发送回我的登录页面活动,但有一个错误,我不确定如何修复。错误发生在“Profile_Fragment.this, LoginPage.class”。
这里是源代码
public class Profile_Fragment extends Fragment {
Button btnLogout;
FirebaseAuth mFirebaseAuth;
private FirebaseAuth.AuthStateListener mAuthStateListener
StorageReference storageReference;
private static final int IMAGE_REQUEST = 1;
private Uri imageUri;
private StorageTask uploadTask;
@Nullable
@Override
//inflate the fragment
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
btnLogout = getView().findViewById(R.id.SignOutButton);
btnLogout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
FirebaseAuth.getInstance().signOut();
Intent intToMain = new Intent(Profile_Fragment.this, LoginPage.class);
startActivity(intToMain);
}
});
return inflater.inflate(R.layout.fragment_profile, container, false);
}
}
【问题讨论】:
-
你能把错误贴出来
标签: android firebase android-studio android-fragments