when I extends from Activity, I modify the fragment_main and find controls like this:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_main);
MyButton = (Button) findViewById(R.id.button1);
}
but when I do this when extends from from ActionBarActivity gives me an error, so to do it work I have to comment:
/*if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment()).commit();
}*/
and set activity_main to fragment_main
setContentView(R.layout.fragment_main);
but I don't believe this be correct...
No comments:
Post a Comment