Commit a8eda7e3 authored by Anjali W.M.S's avatar Anjali W.M.S

java class of ADHD home page.

parent 0171c109
Pipeline #6376 canceled with stages
package com.example.salonappnew;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import android.os.Bundle;
import com.example.salonappnew.databinding.ActivityAdhdhomeBinding;
public class ADHDHome extends AppCompatActivity {
ActivityAdhdhomeBinding binding;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivityAdhdhomeBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
replaceFragment(new NewHomeFragment());
binding.bottomNav.setOnNavigationItemSelectedListener(item -> {
switch (item.getItemId()){
case R.id.home:
replaceFragment(new NewHomeFragment());
break;
case R.id.profile:
replaceFragment(new ProfileFragment());
break;
case R.id.reports:
replaceFragment(new ReportsFragment());
break;
case R.id.medicines:
replaceFragment(new MedicineFragment());
break;
}
return true;
});
}
private void replaceFragment(Fragment fragment){
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.frameLayout,fragment);
fragmentTransaction.commit();
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment