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);
}
...
}
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始终为null,因为您从未调用过setContentView
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.