udacity/ud839_Miwok

i am Getting this error can anyone please resolve Cannot resolve constructor 'Intent(com.example.instapay.ui.expensemanager.ExpenseManagerFragment, java.lang.Class<com.example.instapay.AddTransactionActivity>)'

AdeshRathod opened this issue · 0 comments

package com.example.instapay.ui.expensemanager;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;

import com.example.instapay.AddTransactionActivity;
import com.example.instapay.MainActivity;
import com.example.instapay.databinding.FragmentExpenseManagerBinding;

public class ExpenseManagerFragment extends Fragment {

private FragmentExpenseManagerBinding binding;

public View onCreateView(@NonNull LayoutInflater inflater,
                         ViewGroup container, Bundle savedInstanceState) {
    ExpenseManagerViewModel expenseManagerViewModel =
            new ViewModelProvider(this).get(ExpenseManagerViewModel.class);

    binding = FragmentExpenseManagerBinding.inflate(inflater, container, false);
    View root = binding.getRoot();


    return root;
}

@Override
public void onDestroyView() {
    super.onDestroyView();
    binding = null;
    binding.addtransactionbtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            try {
                startActivity(new Intent(ExpenseManagerFragment.this,AddTransactionActivity.class));
            }
            catch (Exception e){

            }
        }
    });
}

}