@Override
  public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    ScrollView scrollView = (ScrollView) findViewById(R.id.license_activity_scrollview);
    TextView textView = (TextView) findViewById(R.id.license_activity_textview);
    int firstVisibleLine = textView.getLayout().getLineForVertical(scrollView.getScrollY());
    int firstVisibleChar = textView.getLayout().getLineStart(firstVisibleLine);
    outState.putInt(STATE_SCROLL_POS, firstVisibleChar);
  }
Simple Activity that renders locally stored open source legal info in a text view.
java/com/google/android/apps/authenticator/license/LicenseActivity.java