I am getting Error while doing this
this is my code
String[] options = {getActivity().getResources().getString(R.string.capture_video),getActivity().getResources().getString(R.string.Cancel)};
This is in Fragment class
I am getting Error while doing this
this is my code
String[] options = {getActivity().getResources().getString(R.string.capture_video),getActivity().getResources().getString(R.string.Cancel)};
This is in Fragment class
I hope this will work for you.
Initialize your option variable in onViewCreated()
method of fragment
String[] options;
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
options = new String[]{getActivity().getResources().getString(R.string.capture_video), getActivity().getResources().getString(R.string.Cancel)};
Log.e("option",options[0]);
}
above code will solve your problem.