I want to show the same menu (made with imageviews) on all my activies, and I try:
public class BaseActivity extends Activity {
ImageView iv1;
...
@Override
protected void onCreate(Bundle savedInstanceState) {
{
super.onCreate(savedInstanceState);
iv1 = (ImageView)findViewById(R.id.image1);
}
开发者_StackOverflow
...
}
and the others activities looks like:
public class PlayersActivity extends BaseActivity {
protected void onCreate (Bundle savedInstanceState){
super.onCreate(savedInstanceState);
}
}
But, the activities don't see the ImageView that I defined on the BaseActivity.
I have a null object with the imageview.iv1 will always be null, in the base activity or the subclass, because you never called setContentView
精彩评论