引数処理実装

This commit is contained in:
r-ca 2024-01-28 12:51:38 +09:00
parent adcf9f16b9
commit 6ec0710bac
No known key found for this signature in database
GPG Key ID: 6A72911AC73464A9

View File

@ -15,20 +15,30 @@ import android.view.ViewGroup;
*/
public class ViewerContainerFragment extends Fragment {
// Variables
private String documentId;
private String documentName;
public ViewerContainerFragment() {
// Required empty public constructor
}
public static ViewerContainerFragment newInstance() {
public static ViewerContainerFragment newInstance(String documentId, String documentName) {
ViewerContainerFragment fragment = new ViewerContainerFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
args.putString("documentId", documentId);
args.putString("documentName", documentName);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null){
documentId = getArguments().getString("documentId");
documentName = getArguments().getString("documentName");
}
}
@Override