Extremely frustrating = TextView in ScrollView -> Scroll to bottom?

by skink » Thu, 28 May 2009 16:52:16 GMT


Sponsored Links
 On 28 Maj, 01:28, "Peter Carpenter"



try:
tv.setText(s);
sv.post(new Runnable() {
    void run() {
        sv.scrollTo(0, yPosition);
    }
});










--~--~---------~--~----~------------~-------~--~----~



Extremely frustrating = TextView in ScrollView -> Scroll to bottom?

by Peter Carpenter » Fri, 29 May 2009 07:50:43 GMT


 Oh dear...
I should have tried that first.  It works beautifully!
Thanks very much skink.  I wasn't able to get the Selection.SetSelection
to work even if I posted it later.  There's obviously something I don't
quite understand about how all of this works. - Like why I need to put a
TextView that supports scrolling inside a scrollview to do this
anyway... :S

After experimenting a bit more I was only able to get the following 2
commands to work:

sv.post(new Runnable() {
    public void run() {
        sv.scrollTo(0, tv.getHeight());
    }
});

And 

sv.post(new Runnable() {
    public void run() {
        sv.fullScroll(ScrollView.FOCUS_DOWN);
    }
});

Thanks skink & Raphael

-----Original Message-----
From: android-developers@googlegroups.com
[mailto:android-develop...@googlegroups.com] On Behalf Of skink
Sent: Thursday, 28 May 2009 6:52 PM
To: Android Developers
Subject: [android-developers] Re: Extremely frustrating = TextView in
ScrollView -> Scroll to bottom?




On 28 Maj, 01:28, "Peter Carpenter"



try:
tv.setText(s);
sv.post(new Runnable() {
    void run() {
        sv.scrollTo(0, yPosition);
    }
});













--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. Working on an Embedded/Mobile Device? Tell VDC about your experiences for a chance to WIN!

VDC is conducting its annual survey of mobile and embedded engineers
so if you are involved in the engineering of mobile or embedded
systems/software, this is your chance to influence key solution
suppliers.

The research covers embedded software, hardware, tools, and
development practices. Your thoughts will improve our insights into
the engineering community and help to influence next generation
solutions.

In addition, VDC will provide all respondents who complete the
survey:

* Instant access to a summary of VDC's 2009 survey findings;
* Entry into a prize drawing for one of five $100 Amazon.com gift
certificates (drawing to be held August 15th, 2010); and
* A summary of the 2010 survey findings once the survey is complete
later this year


To begin the survey, go to: http://bit.ly/a4cgtb


Thank you very much for your assistance.


Best Regards,

The VDC Embedded Software and Tools Research Team

-- 

2. listVIew returns a wrong number

Hi,
I'm a newbie. I encountered a wired problem. I want to do function tests
about Contacts application through Android built-in Instrumentation method.
When I test about inserting a contact , and I check the number of the
current contacts before insert and after insert , but I found the result is
0 after the insert. I use the ListView.getCount() method to get  the result.
The test code looks like this:


public class TestAdd extends
ActivityInstrumentationTestCase2<ContactsListActivity>{

    ContactsListActivity  activity = null;
    ListView  listView = null;
    Instrumentation instrumentation = null;
    static int addBefore;
    static int addAfter;
    public TestAdd(){
        super("com.android.contacts",ContactsListActivity.class);

    }
    public void setUp() throws Exception{
        super.setUp();
        activity = getActivity();

    }
    public static Test suite(){
        return new TestSuite(TestAdd.class);
    }
    public void testAdd(){

        instrumentation = getInstrumentation();
        listView = activity.getListView();
        addBefore = listView.getCount()-1;


        this section is a serials of keyEvent operations which  perform
inserting a contact.
        ......
        ......

        instrumentation.waitForIdleSync();
        addAfter = listView.getCount()-1;
        assertEquals("Add failed.",addBefore+1,addAfter);
    }

    public void tearDown() throws Exception{
        super.tearDown();
    //    activity = null;
    }
}
addBefore returns the right number while addAfter returns a wrong number .I
try to use the ListView.getListAdapter.getCount() to get the result, but I
have the same wrong result. I don't know why. Is there something wrong with
my code?
I need some help and guide.
Thanks in Advance.

-- 

3. Throwing an event in an Application, handling it in an Activity

4. Custom Toast from a Service

5. Bluetooth Serial Connection from Milestone (Droid) Android 2.1 to Holux M241 GPSLogger stalls

6. Output Signal

7. Soft Keyboard Help