Problem with GridView and CountDownTimer

by Saurav » Thu, 19 May 2011 19:12:46 GMT

Sponsored Links

I have a GridView. Each element of that grid has its own CountDownTimer.
On going through some of your posts i came to know that getView of the
Adapter for GridView may be called many number of times.
This initializes many CountDownTimers on the same view and hence the
onFinish of the CountDownTimer is called many times. I have logic in my
onFinish to replace the time ended view with another view. But since
onFinish is called a lot of times I am not able to replace the view.

Can you please tell me how to overcome this problem.

Thanks in advance

Saurav Mukherjee.


Re: Problem with GridView and CountDownTimer

by umair yaya » Thu, 19 May 2011 19:37:00 GMT

 *Home Inspection <> ; *

The housing market goes up and down, but people still need
homes<> ; ,
and home inspection
professionals<> ;
play a vital role in establishing the value of property. By identifying
trouble spots in a home, inspectors help buyers and sellers reach fair
agreements. Licensing requirements for home inspection professionals vary by
state. However, most states require home
inspectors<> ;
to be bonded, to complete an industry certification, and to register with
local authorities.

Read more. <> ;


Sponsored Links

Re: Problem with GridView and CountDownTimer

by umair yaya » Thu, 19 May 2011 19:37:07 GMT



Re: Problem with GridView and CountDownTimer

by Saurav » Fri, 20 May 2011 02:04:47 GMT

 Guys please no spams!

Have any ideas to the problem that I put up, for help! Kind of an SOS

Thanks in advance!

Saurav Mukherjee.


Other Threads

1. Dynamically change ListView doesn't work

Hello Guys,

I should write in the title instead of 'doesn't work' something like 'I
don't know how to do it' but the first version feels better :).
What I am trying to do is the following:

1. Download the xml from the web, parse it and create ArrayList of some
objects (done and working)
2. Display the objects using custom Adapter (doesn't work)

The second one works if I add the items to my ArrayList before I add it to
the view using

m_orderAdapter = new OrderAdapter(this,m_orders); //code for orderadapter

I have found on the web something like this: (in my onCreate method)

handler = new Handler();
        viewOrders = new Runnable(){

            public void run() {


        new Thread(){
            public void run(){

then, the following code for the methods:

private void getOrders(){
          OrderManager om = new OrderManager();
           m_orders = om.getOrdersFromWeb();
           Log.i("ARRAY", ""+ m_orders.size());
      } catch (Exception e) {
          Log.e("BACKGROUND_PROC", e.getMessage());

OrderManager downloads and parse the xml into Order objects and returns
array list of those. Then I set this list to my member array list m_orders.
Once downloading and parsing is done I run returnRes method on the ui thread
using runOnUiThread method

private Runnable returnRes = new Runnable() {

        public void run() {
            if(m_orders != null && m_orders.size() > 0){
and I call notifyDataSetChanged() on my adapter.

The view I do all this stuff extends ListView and the code for the adapter
itself is listed below:

public class OrderAdapter extends BaseAdapter{

    private Context ctx;
    private List<Order> orders;

    public OrderAdapter(Context ctx, List<Order> orderLst){
        this.ctx = ctx;
        this.orders = orderLst;
    public int getCount() {
        return orders.size();

    public Object getItem(int pos) {
        return orders.get(pos);

    public long getItemId(int position) {
        return position;

    public View getView(int position, View convertView, ViewGroup parent) {
        Order o = orders.get(position);
        return new OrderListAdapterView(this.ctx,o);


When I debug I have the data inside my m_orders list but when I call
notifyDataSetChanged nothing happens, I've read that I have to execute that
on the UI thread which I think I do. So whats the problem?
any help highly appreciated, or maybe just a link to the nice tutorial on
the web explaining this issue on how to update the list view at runtime?



2. Listview with multiple coulmns


I'm completely new to the android development or mobile programming
for that matter. I do not have any gui building experience.

I did try 'HelloAndroid' example and understand the directory layout
very well.
But I'm not able to get the following to work...

I'm trying to build one application as follows,

Is there a way to show multiple coulmns like following,
Default must be a list with following layout ...

button | textview | datepicker | button

First button is a remove button, which removes that particular row.

a following layout,

edittext | datepicker

When you click Okbutton, this gets added to the list as another row as
shown above.

Following is my main.xml as a first attempt to build just a view ....
$ cat main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="

                <Button android:id="@+id/button_remove_item"
                        android:text="@string/remove" />

                <EditText android:id="@+id/edittext_add_item"

                <Button android:id="@+id/pickDate"

                <Button android:id="@+id/button_add_item"
                        android:text="@string/add" />

$ cat
public void onCreate(Bundle savedInstanceState) {
And there are 2 other methods to show date picker and update display
after choosing the date .

$ cat string.xml
<?xml version="1.0" encoding="utf-8"?>
    <string name="hello">Hello Android! I am a string resource!</
    <string name="app_name">Hello, Android</string>
    <string name="add">Add</string>
    <string name="remove">Remove</string>

I've a pickDate function which allows me to change a date but other
actions are not implemented and main thing is this still not a list

Where do I start? What changes I need to achieve what I want to do?
Any help is really appreciated.




3. getting device offline when trying to debug on my phone

4. Missing setListAdapter() Method?

5. Cupcake (1.5) and Maps

6. Creating Spinner in ExpandableList

7. Android video and audio application (x86 and ARM)