android-developers
[Arriba] [Todas las Listas]

[android-developers] Re: Countdown Temporizador en listview android

To: Android Developers <android-developers@xxxxxxxxxxxxxxxx>
Subject: [android-developers] Re: Countdown Temporizador en listview android
From: Deepshikha Puri <deepshikhapuri.here@xxxxxxxxx>
Date: Tue, 22 Nov 2016 01:33:44 -0800 (PST)
Delivery-date: Tue, 22 Nov 2016 04:34:08 -0500
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=sender:date:from:to:message-id:in-reply-to:references:subject :mime-version:x-original-sender:reply-to:precedence:mailing-list :list-id:x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=Jm3U4FBfTWQ+H9n0PYpIa7PldALjq3OUKUbmE+hs7u8=; b=PrR3M5fHBehSG8kM8DVIs7FrtwyhmI6sECxe7dko1mCHtpvAwo8prFNd2d9RIdGmZB RH8Cs6Bk4vi+0ppAkrI/3wjaT+pFWVe74VcNzv5M4SLvwq8mFVTQwT5eQHAgzJwTcltP CmB7G9HL/ONkWq4KUYdKpYSNZwbXbSs8bwaHy31goWXEb/YCvfBfBDrEwPsVi2auA3DZ uwL45i5DSg+Rf4Cl7/YYKPFcXKNtQxdBv0e1h+kgPrq4nUr9Iwx1/8EnRlpLljr1pjCY YU3rkhPfcp3ULSpxbHMJh3WAUlSRsMOdgZfupsV5vSIll5u7UBWrKQQq/Pm00nd7WNND GNPw==
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=Jm3U4FBfTWQ+H9n0PYpIa7PldALjq3OUKUbmE+hs7u8=; b=aartUhpk1bdKi8To+rbgB1bK2f1MeiypiaFqS9AaTLj3JmKIfVd+Be062HdSdoHXxg lRp2GOwMfULUmeLaS3/gHbDok+UsCAhsCYI9xlOLlE6iM64WkI6kwBn2vwCZBDJ0bVcA MEOyZBcP94hUQiqr5H/BoPX++LwywXuJ3jf+r/LgxXelz3OulgZkyVpF+3O5Sp8UdcEV hUTxpHQQIqbnRI3j/2vZTh6rn/74xymJmroR/P7gYF6rkBUHzft0Xk1shWJ7tFn99kn9 Bpu5iWBuTzE14GqUzh70P+flyREe1jXE1uxW7bP/O7ei0ZSZIt8nkZPNdBohqG5Lui7q BRmQ==
Envelope-to: traductor@xxxxxxxxxxx
In-reply-to: <120fc91b-9d24-4113-8a6e-97db612996b4@googlegroups.com>
List-archive: <https://groups.google.com/group/android-developer>
List-help: <https://groups.google.com/support/>, <mailto:android-developers+help@googlegroups.com>
List-id: <android-developers.googlegroups.com>
List-post: <https://groups.google.com/group/android-developers/post>, <mailto:android-developers@googlegroups.com>
List-subscribe: <https://groups.google.com/group/android-developers/subscribe>, <mailto:android-developers+subscribe@googlegroups.com>
List-unsubscribe: <mailto:googlegroups-manage+364598216046+unsubscribe@googlegroups.com>, <https://groups.google.com/group/android-developers/subscribe>
Mailing-list: list android-developers@xxxxxxxxxxxxxxxx; contact android-developers+owners@xxxxxxxxxxxxxxxx
References: <120fc91b-9d24-4113-8a6e-97db612996b4@googlegroups.com>
Reply-to: android-developers@xxxxxxxxxxxxxxxx
Sender: android-developers@xxxxxxxxxxxxxxxx
Finalmente conseguía la solución de esto. Había utilizado el *countdown temporizador en 
el *recycler vista. Puedes puede el código de fuente de aquí de *Countdown 
Temporizador en *listview *android .  
<*https://*deepshikhapuri.*wordpress.*com/2016/10/26/*countdown-temporizador-dentro-*listview-*android/>


*Adaptador.*java*


Importación *android.*os.*CountDownTimer;
Importación *android.Apoyo.*v7.*widget.*RecyclerView;
Importación *android.*util.*Log;
Importación *android.Vista.*LayoutInflater;
Importación *android.Vista.Vista;
importación *android.Vista.*ViewGroup;
Importación *android.*widget.*TextView;

Importación *java.*util.*ArrayList;

Adaptador de clase pública extiende *RecyclerView.Adaptador

    #adj *ArrayList *al_dato;

    clase pública *MyViewHolder extiende *RecyclerView.*ViewHolder
        #Nom *TextView *tv_temporizador;
        *CountDownTimer temporizador;

        público *MyViewHolder (vista de Vista)
            #unknown{^*super(vista);
            *tv_temporizador = (*TextView)vista.*findViewById(*R.*id.*tv_Temporizador);

        }


    }

    Adaptador público(*ArrayList *al_dato)
        #prn.*al_Dato = *al_dato;
    }

    @*Override
    público *MyViewHolder *onCreateViewHolder(*ViewGroup padre, *int *viewType)
        #nom_de_nom de Vista = *LayoutInflater.De(padre.*getContext()).*inflate(*R.*layout.Adaptador_*layout,padre,falso);


        el regreso nuevo *MyViewHolder(vista);
    }

    @*Override
    público *void *onBindViewHolder(final *MyViewHolder titular, *int posición)

        #nom.*tv_Temporizador.*setText(*al_Dato.Consigue(posición));

        si (titular.Temporizador != *null)
            #Nom.Temporizador.Cancela();
        }
         temporizador largo = Mucho tiempo.*parseLong(*al_Dato.Consigue(posición));

        temporizador = de temporizador*1000;

        titular.El Temporizador = nuevo *CountDownTimer(temporizador, 1000)
            #nom *void *onTick(largo *millisUntilFinished)
              #nom.*tv_Temporizador.*setText("" + *millisUntilFinished/1000 + " *Sec");
            }

            público *void *onFinish()
                #nom.*tv_Temporizador.*setText("00:00:00");
            }
        }.Inicio();


    }

    @*Override
    público *int *getItemCount()
        #verbcj *al_dato.Medida();
    }



}

-- 
recibiste este mensaje porque eres *subscribed al *Google Grupos "*Android *Developers" grupo.
A *unsubscribe de este grupo y la parón que recibe *emails de él, enviar un *email a *android-*developers+unsubscribe@xxxxxxxxxxxxxxxx.
A correo a este grupo, envía *email a *android-developers@xxxxxxxxxxxxxxxx.
Visita este grupo en *https://grupos.*google.*com/Grupo/*android-*developers.
Para ver esta discusión en la visita de web *https://grupos.*google.*com/*d/*msgid/*android-*developers/#Uno47*eafff-*c91*e-4*ef5-anuncio36-2#uno03*ab42*c720%40*googlegroups.*com.
Para más opciones, visita *https://grupos.*google.*com/*d/*optout.
Finally I got the solution of this. I had used the countdown timer in the 
recycler view. You can can the source code from here of 
Countdown Timer in listview android .  
<https://deepshikhapuri.wordpress.com/2016/10/26/countdown-timer-in-listview-android/>


*Adapter.java*


import android.os.CountDownTimer;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import java.util.ArrayList;

public class Adapter extends RecyclerView.Adapter{

    private ArrayList al_data;

    public class MyViewHolder extends RecyclerView.ViewHolder{
        public TextView tv_timer;
        CountDownTimer timer;

        public MyViewHolder (View view){
            super(view);
            tv_timer = (TextView)view.findViewById(R.id.tv_timer);

        }


    }

    public Adapter(ArrayList al_data) {
        this.al_data = al_data;
    }

    @Override
    public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.adapter_layout,parent,false);


        return new MyViewHolder(view);
    }

    @Override
    public void onBindViewHolder(final MyViewHolder holder, int position) {

        holder.tv_timer.setText(al_data.get(position));

        if (holder.timer != null) {
            holder.timer.cancel();
        }
         long timer = Long.parseLong(al_data.get(position));

        timer = timer*1000;

        holder.timer = new CountDownTimer(timer, 1000) {
            public void onTick(long millisUntilFinished) {
              holder.tv_timer.setText("" + millisUntilFinished/1000 + " Sec");
            }

            public void onFinish() {
                holder.tv_timer.setText("00:00:00");
            }
        }.start();


    }

    @Override
    public int getItemCount() {
        return al_data.size();
    }



}

-- 
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@xxxxxxxxxxxxxxxx.
To post to this group, send email to android-developers@xxxxxxxxxxxxxxxx.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/a47eafff-c91e-4ef5-ad36-2a03ab42c720%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
<Anterior por Tema] Tema Actual [Siguiente por Tema>