开发者

same menu different activities

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜