@SuppressLint("NewApi") protected void onActivityResult(int requestCode, int resultCode, Intent data) { Log.d("wang", "MyRoad onActivityResult"); if (data != null) { String result = data.getExtras().getString("result"); if (!result.isEmpty()) { if (result.equals("ok1")) { Log.d("wang", "result is ok1"); int flag; flag = app.getAllCount(); if (flag == 0) { news.setVisibility(View.GONE); } else { news.setBadgeCount(flag); } } } } }
@SuppressLint("NewApi") private void loginView() { setContentView(R.layout.account_info); TextView v_return = (TextView) findViewById(R.id.tv_return); v_return.setOnClickListener( new OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(); intent.putExtra("result", "ok1"); setResult(RESULT_OK, intent); finish(); } }); TextView priva = (TextView) findViewById(R.id.tv_private); if (!app.getSign().isEmpty()) { priva.setText(app.getSign()); } TextView account = (TextView) findViewById(R.id.tv_account); account.setText(app.getUser()); TextView qq = (TextView) findViewById(R.id.tv_qq); qq.setText(app.getQQ()); TextView email = (TextView) findViewById(R.id.tv_email); email.setText(app.getEmail()); TextView roadTopic = (TextView) findViewById(R.id.road_topic); news = (BadgeView) findViewById(R.id.news); roadTopic.setOnClickListener( new OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(); intent.setClass(ProfileActivity.this, MySafeRoadActivity.class); startActivityForResult(intent, 1); } }); // news.setTargetView(roadTopic); // badgeView.setBadgeGravity(Gravity.CENTER | Gravity.RIGHT); // badgeView.setBadgeCount(Integer.valueOf(newsCount)); if (!newsCount.equals("")) { news.setBadgeCount(Integer.valueOf(newsCount)); } }
private void setView() { recyclerView.setLayoutManager(manager); recyclerView.setAdapter(adapter); badgeView.setTargetView(shopping_car_tv); badgeView.setBadgeCount(3); }
@Override public void unReadMessageUpdate(int count) { if (count == 0 && badgeView.getBadgeCount() == 0) badgeView.setVisibility(View.GONE); badgeView.setVisibility(View.VISIBLE); badgeView.setBadgeCount(count); }