HarshBarash

Untitled

May 5th, 2021
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.97 KB | None | 0 0
  1. public class HomeFragment extends Fragment {
  2.     ImageButton define;
  3.     Context context;
  4.     LayoutInflater layoutInflater;
  5.  
  6.  
  7.  
  8.  
  9.     @Nullable
  10.     @Override
  11.     public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
  12. //        return inflater.inflate(R.layout.fragment_home, container, false);
  13.  
  14.         layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  15.         View view = layoutInflater.inflate(R.layout.fragment_home, container, false);
  16.  
  17.         Button define = view.findViewById(R.id.define);
  18.  
  19.         define.setOnClickListener(new View.OnClickListener() {
  20.             @Override
  21.             public void onClick(View v) {
  22.                 Intent inent = new Intent(context, Define.class);
  23.                 context.startActivity(inent);
  24.             }
  25.         });
  26.         return inflater.inflate(R.layout.fragment_home, container, false);
  27.     }
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment