首页 新闻 会员 周边

android使用service的方法报nullPointerException

0
悬赏园豆:20 [已关闭问题] 关闭于 2011-10-10 15:19

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);
bindService(
new Intent(this, TestService.class), conn, BIND_AUTO_CREATE);//绑定服务
System.out.println("ServiceActivity onCreate()");
ts.setNum(
0);//使用服务的方法,但这里会报Nullpointerexception
}
我只知道service还没有创建,但如何在Activity的onCreate()里创建

NCCC的主页 NCCC | 初学一级 | 园豆:22
提问于:2011-07-07 16:36
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册