1

what i want to do is when reading a paragraph in my textview and for any reason

i quit the applicaton or i hit backbutton how can i let my paragraph save the place where am i reading.

i hope you understand me, i tried this one but it doesn't works (freezes)

<TextView
        android:id="@+id/id_dailyprayers_txt"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#00000000"
        android:ems="10"
        android:focusable="false"
        android:focusableInTouchMode="false"
        android:gravity="center"
        android:shadowColor="@color/black"
        android:shadowDx="2"
        android:shadowDy="2"
        android:shadowRadius="1.5"
        android:text=""
        android:freezesText="true"
        android:textColor="@color/Vanilla"
        android:textSize="35sp" />

any help??

BasILyoS
  • 995
  • 1
  • 10
  • 15
  • See [Eric Simonton's answer](http://stackoverflow.com/questions/5381964/how-to-restore-textview-scrolling-position-after-screen-rotation) to get the idea about saving scroll position of a text view. – imranhasanhira Sep 25 '13 at 22:04

1 Answers1

0

Have you tried handle back button press and save the text scroll and save it in sharedPreference and load it when the app reopen.

@Override
public void onBackPressed() {  
getApplicationContext().getSharedPreferences("myData", 0).edit().putInt("lastPos", tv.getScrollY());
super.onBackPressed();
}

and put this in onCreat

//first remember to defined tv
tv.scrollTo(0,getApplicationContext().getSharedPreferences("myData", 0).getInt("lastPos", 0)); 

Regards

Saif Hamed
  • 1,084
  • 1
  • 12
  • 17