Good afternoon, any help on how to use listView in a fragment? I have seen many tutorials but sincerely they are from previous versions and with the latest version of Android Studio I do not run certain syntax, I appreciate any help.
Good afternoon, any help on how to use listView in a fragment? I have seen many tutorials but sincerely they are from previous versions and with the latest version of Android Studio I do not run certain syntax, I appreciate any help.
I guess you need to add the following import that is this: import android.support.v4.app.Fragment; Also in the onCreateView you must declare a variable of type View for example
@Override public View onCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_photos, container, false);
ListView lv = (ListView)rootView.findViewById(R.id.lv_contact);
return rootView;
}
I hope I serve you. Greetings