My Activity class(LoginActivity) that have a username i wanna to pass it to Fragment (protifilefragment) BUT it dosen't work idk what the problem.Please Help me
THE ACTIVITY :
boolean isExist = Mydb.checkUserExist(editusername.getText().toString(), editpassword.getText().toString());
if(isExist==true){
Intent intent = new Intent (LoginActivity.this,DressyActivity.class);
//PASSING DATA TO protfilefragment
Bundle bundle=new Bundle();
bundle.putString("uesername",editusername.getText().toString());
protfileFragment f=new protfileFragment();
f.setArguments(bundle);
//
startActivity(intent); }
THE FRAGMENT:
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view=inflater.inflate(R.layout.fragment_profile ,container,false);
//RECIVE DATA
welcome=(TextView)view.findViewById(R.id.textView2);
if(this.getArguments()!=null){
String passed_data=this.getArguments().getString("username");
welcome.setText(passed_data); }
//
return view;
}