开发者

android activity and service

开发者 https://www.devze.com 2023-01-15 01:18 出处:网络
is it ok to create a class which extends a service within a class that extends an activity public class fill extends Activity {

is it ok to create a class which extends a service within a class that extends an activity

public class fill extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.seconds);
               ....................

}


public class MyCount extends Servcie{
       ....开发者_开发技巧.............................
        ..................................
       .................................
    }

}


2 ways to do:

  • You need only an inner class? Than create one inside another class. (what you didn't have done because MyCount is not inside the Activity class)
  • You need another class but it shouldnt be an inner class? Than create a new file for this class.
0

精彩评论

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