I want the id of my button "configbutton" which is in the fragment in activity, so that i can call some method declared in activity. But i can't able to do so. Is there any way to do this. Activity class
public class UartLoopBackActivity extends FragmentActivity implements
ActionBar.TabListener {
Button configButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.data_analysis);
configButton = (Button) findViewById(R.id.configButton);
}
Fragment class
public class DataShown extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
Log.d("3", "started");
View rootView = inflater.inflate(R.layout.datashown, container, false);
Log.d("3", "closed");
Button tv = (Button) rootView.findViewById(R.id.configButton);
return rootView;
}
}
if there is any way u know plz share the code. i want to refer to the the button which is in fragment in the activity class so that is can call a listener for that button from activity class. is it is possible. thanku