Unable to update TextView on a scheduled-basis

by Chris » Wed, 11 Nov 2009 23:37:33 GMT


Sponsored Links
 Hello everyone, I'm new to Android (but not Java), so bear with me.


I'm trying to create a stopwatch-type UI, where a digital timer is
displayed and incrementing every second.  I started off creating a
textview and attempted to update this textview (TextView.setText())
using either the TimerTask class to update the view in a timer as well
as updating the view in the same thread, using a Thread.sleep(1000).

In either case, the view does not get updated. Obviously this doesn't
seem to be the proper way to go about updating a text view.  Any
suggestions on the proper way to notify the textview?

Thanks
Chris

--



Other Threads

1. Any other way to point to R.java?

I would like to remove the dependency to point to "packagename".R
since I'm trying to merge free and paid apps into one.  The mayor
problem is the namespace.

I'm able to get Context.getPackageName()  but how can I convert that
string to be accessible... i.e. Context.getPackageName().R?

Thanks!
-Moto

-- 

2. Asynchronous Http Request

I am trying to figure out how to make HTTP get requests.  The
following is what I have so far:

        HttpGet get = new HttpGet("http://www.microsoft.com");
        HttpClient client = new DefaultHttpClient();
        HttpResponse response;

        try
        {
                response = client.execute(get);

                HttpEntity      entity  = response.getEntity();

                InputStream stream = entity.getContent();

                byte[] b = new byte[1000];

                stream.read(b);
        }
        catch (ClientProtocolException e)
        {
        }
        catch (IOException e)
        {
        }

This works fine, but what I really need is a way to read the data
asynchronously.  Is there some way to set up the transfer and specify
a call back function which is called as the bytes come in, or do I
need to create a thread to do this?

Thanks.

-- 

3. Clear defaults programmatically

4. Google Feedback fo Android

5. nullPointerException with custom ArrayAdapter

6. nullPointerException with custom ArrayAdapter

7. Eclipse not recoginizing my attached Hero, Ubuntu 9.10