StatisticFragment navigation to CouponFragment

This commit is contained in:
Bart
2021-01-04 10:59:43 +01:00
parent 6b197c4742
commit 294814dea8

View File

@@ -2,11 +2,14 @@ package com.a1.nextlocation.fragments;
import android.os.Bundle;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import com.a1.nextlocation.R;
@@ -21,7 +24,12 @@ public class StatisticFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_statistic, container, false);
View view = inflater.inflate(R.layout.fragment_statistic, container, false);
ConstraintLayout constraintLayout = view.findViewById(R.id.Box4);
constraintLayout.setOnClickListener(v -> {
CouponFragment couponFragment = new CouponFragment();
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, couponFragment).addToBackStack(null).commit();
});
return view;
}
}