I have a Tab View with three layouts. Each layout is divided into 4 parts using Frame layout and each one has a button. So there are total of 12 buttons. Since the View is First Layout, buttons in other two layouts return a null pointer exception. I tried include in XML but the buttons get merged and the app runs. Any Solution. Working Day And Night.
View rootView = inflater.inflate(R.layout.fragment_main,container,false);
View rootView = inflater.inflate(R.layout.fragment_2,container,false);
View rootView = inflater.inflate(R.layout.fragment_3,container,false);
b1=(Button)rootView.findViewById(R.id.button1);
b1.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View a){...}
});
The Buttons in Fragment_main are Running but buttons in fragment_2 & fragment_3 return Null Pointer Exception.
Note : I used Eclipse's Tab Layout.
Thank You For Help in advance