У меня есть Recyclerview с countDownTimers, который показывает время, оставшееся до игры, в днях, часах, минутах и секундах. Теперь у меня проблема: когда я выхожу из активности, счетчики countDownTimers все еще работают.
Вот мой адаптер:
Public class RvAdapterShowVsTeamChallenges extends RecyclerView.Adapter {
private Boolean boFirstTime = true;
private int [] ayColors = {R.drawable.circle_red,R.drawable.circle_purple,R.drawable.circle_orange,R.drawable.circle_blue,R.drawable.circle_tile};
private Context context;
private CountDownTimer countDownTimerTest;
private DatabaseWrite databaseWrite;
private SharedPrefs sharedPrefs;
public RvAdapterShowVsTeamChallenges(final Context context)
{
this.context = context;
}
public class ViewHolderClass extends RecyclerView.ViewHolder{
private TextView txtChallenger;
private TextView txtOponnent;
private TextView txtChallengerScore;
private TextView txtOponnentScore;
private TextView txtTime;
private TextView txtChallengerLetters;
private TextView txtOponnentLetters;
private ProgressBar prgChallenger;
private ProgressBar prgOponnent;
public ViewHolderClass(View itemView) {
super(itemView);
sharedPrefs = new SharedPrefs(context);
txtChallenger = (TextView) itemView.findViewById(R.id.txtChallenger);
txtOponnent = (TextView) itemView.findViewById(R.id.txtOponnent);
txtChallengerScore = (TextView) itemView.findViewById(R.id.txtChallengerScore);
txtOponnentScore = (TextView) itemView.findViewById(R.id.txtOponnentScore);
txtChallengerLetters = (TextView)itemView.findViewById(R.id.txtChallengerLetter);
txtOponnentLetters = (TextView)itemView.findViewById(R.id.imgOponnent);
txtTime = (TextView) itemView.findViewById(R.id.txtTime);
prgChallenger = (ProgressBar) itemView.findViewById(R.id.prgTimeLeft);
prgOponnent = (ProgressBar) itemView.findViewById(R.id.prgOponnent);
}
}
@Override
public ViewHolderClass onCreateViewHolder(final ViewGroup parent, final int viewType) {
View itemview1 = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_show_vs_team_challenges,null);
if(boFirstTime)
{
for(int i=0; i
Подробнее здесь: https://stackoverflow.com/questions/409 ... cyclerview
Отменить CountDownTimer в Recyclerview ⇐ JAVA
Программисты JAVA общаются здесь
1727279086
Anonymous
У меня есть Recyclerview с countDownTimers, который показывает время, оставшееся до игры, в днях, часах, минутах и секундах. Теперь у меня проблема: когда я выхожу из активности, счетчики countDownTimers все еще работают.
Вот мой адаптер:
Public class RvAdapterShowVsTeamChallenges extends RecyclerView.Adapter {
private Boolean boFirstTime = true;
private int [] ayColors = {R.drawable.circle_red,R.drawable.circle_purple,R.drawable.circle_orange,R.drawable.circle_blue,R.drawable.circle_tile};
private Context context;
private CountDownTimer countDownTimerTest;
private DatabaseWrite databaseWrite;
private SharedPrefs sharedPrefs;
public RvAdapterShowVsTeamChallenges(final Context context)
{
this.context = context;
}
public class ViewHolderClass extends RecyclerView.ViewHolder{
private TextView txtChallenger;
private TextView txtOponnent;
private TextView txtChallengerScore;
private TextView txtOponnentScore;
private TextView txtTime;
private TextView txtChallengerLetters;
private TextView txtOponnentLetters;
private ProgressBar prgChallenger;
private ProgressBar prgOponnent;
public ViewHolderClass(View itemView) {
super(itemView);
sharedPrefs = new SharedPrefs(context);
txtChallenger = (TextView) itemView.findViewById(R.id.txtChallenger);
txtOponnent = (TextView) itemView.findViewById(R.id.txtOponnent);
txtChallengerScore = (TextView) itemView.findViewById(R.id.txtChallengerScore);
txtOponnentScore = (TextView) itemView.findViewById(R.id.txtOponnentScore);
txtChallengerLetters = (TextView)itemView.findViewById(R.id.txtChallengerLetter);
txtOponnentLetters = (TextView)itemView.findViewById(R.id.imgOponnent);
txtTime = (TextView) itemView.findViewById(R.id.txtTime);
prgChallenger = (ProgressBar) itemView.findViewById(R.id.prgTimeLeft);
prgOponnent = (ProgressBar) itemView.findViewById(R.id.prgOponnent);
}
}
@Override
public ViewHolderClass onCreateViewHolder(final ViewGroup parent, final int viewType) {
View itemview1 = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_show_vs_team_challenges,null);
if(boFirstTime)
{
for(int i=0; i
Подробнее здесь: [url]https://stackoverflow.com/questions/40958478/cancel-countdowntimer-in-recyclerview[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия