开发者

nullpointerexception with inserting a gallery in tabview

Hi i have currently created a tab view in my app.. The tabs worked fine until i begin to create a gallery within one开发者_Python百科 of them. Could someone please have a look for me.. In the logcat the nullpointer exception seems to be on line - photos.setAdapter(new GalleryAdapter());

Any help would be greatly appreciated..


If you want to reference gallery you either have to call setContentView(R.layout.listedsites) or inflate it...as of now nothing is in your Activity view hierarchy so ((Gallery)findViewById(R.id.gallery)); returns null.

Also, it seems to me you only want the gallery in your "gallery" tab so do your gallery logic in the corresponding activity.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜