示例#1
0
 @Override
 protected void onDestroy() {
   // TODO Auto-generated method stub
   super.onDestroy();
   unregisterReceiver(receiver);
   fghome.destroyThread();
 }
示例#2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    GezitechService.getInstance().appendActivity(this);
    setContentView(R.layout.activity_zhuye);

    // user = GezitechService.getInstance().getCurrentLoginUser(this);

    home = (RadioButton) findViewById(R.id.home);
    session = (RadioButton) findViewById(R.id.session);
    person = (RadioButton) findViewById(R.id.person);
    group = (RadioGroup) findViewById(R.id.zhuye_group);
    nearby = (RadioButton) findViewById(R.id.nearby);

    // 初始化个推推送
    PushManager.getInstance().initialize(this.getApplicationContext());

    // 提示消息
    ll_unreadcount = (LinearLayout) findViewById(R.id.ll_unreadcount);
    tv_unreadcount = (TextView) findViewById(R.id.tv_unreadcount);
    // 附近人有新消息提示 只显示红点
    ll_nearbycount = (LinearLayout) findViewById(R.id.ll_nearbycount);
    // 喜欢 和 评论的提示条数
    ll_like_comment_count = (LinearLayout) findViewById(R.id.ll_like_comment_count);
    tv_like_comment_count = (TextView) findViewById(R.id.tv_like_comment_count);
    // 计算未读的消息
    unreadcount();
    // 计算 喜欢和 评论的未读消息
    like_comment_count(tv_like_comment_count, ll_like_comment_count);

    home.setOnClickListener(this);
    session.setOnClickListener(this);
    person.setOnClickListener(this);
    nearby.setOnClickListener(this);
    fragmentManager = getSupportFragmentManager();

    mFragments = new Fragment[4];
    fghome = HomeFramgent.newInstance();
    fsession = SessionFramgent.newInstance();
    fperson = PersonFramgent.newInstance();
    fNearby = NearbyFramgent.newInstance();

    mFragments[0] = fghome;
    mFragments[1] = null;
    mFragments[2] = null;
    mFragments[3] = null;
    fragmentManager.beginTransaction().add(R.id.zhuye_content, fghome).show(fghome).commit();

    IntentFilter filter = new IntentFilter();
    filter.addAction(Constant.NEW_MESSAGE_ACTION);
    filter.addAction(Constant.LIKE_COMMENT_ACTION);
    registerReceiver(receiver, filter);

    _jumpActivity(this.getIntent());

    setSelectFragment();
  }