How to resolve findViewById inside fragments

Hello Everyone Below is code from Fragment 1.

public class notices extends Fragment implements View.OnClickListener {

private Button fragment_btn_1;

private Button fragment_btn_2;

//the URL having the json data

private static final String JSON_URL = "";

//listview object

ListView listView;

//the hero list where we will store all the hero objects after parsing json

List heroList;

public static notices newInstance() {

notices fragment = new notices();

return fragment;




public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

View view = inflater.inflate(R.layout.fragment_notices, container, false);



listView = (ListView) view.findViewById(;

heroList = new ArrayList<>();

//this method will fetch and parse the data


return view;


private void loadHeroList() {

final ProgressBar progressBar...

Read More »

By: StackOverFlow - Tuesday, 13 March

Related Posts