0

I am requesting help. Here is the code

    scrollView = (ScrollView)findViewById(R.id.scrollview4201);

    if (scrollview_f_check.contains("1"))
    {
        scrollView.scrollTo(0, +2000);

        scrollview_f_check = "0";
        SharedPreferences.Editor editor=mUserSettings.edit();
        editor.putString(USER_PREFERENCES_SCROLLVIEW4201, scrollview_f_check);
        editor.commit();
Toast.makeText(getApplicationContext(), "scrollview_f_check = " + String.valueOf(scrollview_f_check), Toast.LENGTH_SHORT).show();           
    }

I have verified using the toast that correct variable is passing through the if statement. So the issue lies completely with "scrollView.scrollTo(0, +2000);" line.

Why would this not work?

Part 2: I also tried to use the .getleft() and .getTop() of the exact TextView I wanted to use, but it always came back with 0 for both.

Adrian Heine
  • 4,051
  • 2
  • 30
  • 43
djmedic
  • 317
  • 3
  • 12
  • 1
    Have a look at this http://stackoverflow.com/questions/3263259/scrollview-scrollto-not-working-saving-scrollview-position-on-rotation – Lalit Mohan Aug 27 '13 at 17:06
  • That link worked. I new it couldn't have been that complicated. Thank you – djmedic Aug 27 '13 at 18:14

1 Answers1

0

Also you can try using scrollTo() method in onWindowFocusChanged() method instead of onCreate().