android studioでfragment(Blank)を新規で作成したのですが、以下のようなコードがデフォルトでありました。そこに書かれている@override以前の部分は何を意味しているのでしょか。
java
1コード 2 3package com.example.myqrapplication; 4 5import android.os.Bundle; 6 7import androidx.fragment.app.Fragment; 8 9import android.view.LayoutInflater; 10import android.view.View; 11import android.view.ViewGroup; 12 13/** 14 * A simple {@link Fragment} subclass. 15 * Use the {@link tabBarFragment#newInstance} factory method to 16 * create an instance of this fragment. 17 */ 18public class tabBarFragment extends Fragment { 19 20 // TODO: Rename parameter arguments, choose names that match 21 // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER 22 private static final String ARG_PARAM1 = "param1"; 23 private static final String ARG_PARAM2 = "param2"; 24 25 // TODO: Rename and change types of parameters 26 private String mParam1; 27 private String mParam2; 28 29 public tabBarFragment() { 30 // Required empty public constructor 31 } 32 33 /** 34 * Use this factory method to create a new instance of 35 * this fragment using the provided parameters. 36 * 37 * @param param1 Parameter 1. 38 * @param param2 Parameter 2. 39 * @return A new instance of fragment tabBarFragment. 40 */ 41 // TODO: Rename and change types and number of parameters 42 public static tabBarFragment newInstance(String param1, String param2) { 43 tabBarFragment fragment = new tabBarFragment(); 44 Bundle args = new Bundle(); 45 args.putString(ARG_PARAM1, param1); 46 args.putString(ARG_PARAM2, param2); 47 fragment.setArguments(args); 48 return fragment; 49 } 50 51 @Override 52 public void onCreate(Bundle savedInstanceState) { 53 super.onCreate(savedInstanceState); 54 if (getArguments() != null) { 55 mParam1 = getArguments().getString(ARG_PARAM1); 56 mParam2 = getArguments().getString(ARG_PARAM2); 57 } 58 } 59 60 @Override 61 public View onCreateView(LayoutInflater inflater, ViewGroup container, 62 Bundle savedInstanceState) { 63 // Inflate the layout for this fragment 64 return inflater.inflate(R.layout.fragment_tab_bar, container, false); 65 } 66}
あなたの回答
tips
プレビュー