AndroidPdfViewer
AndroidPdfViewer copied to clipboard
How can I save the last page I was reading before exiting the application?
A very great effort that deserves our appreciation and thanks
I wanted to know how to save the pages that I was reading before exiting the application, so that it does not start again after opening the application, but I want it to open the last page I was reading automatically
Duplicate of #533 Duplicate of #498
thats my view code
import android.os.Bundle;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import com.github.barteksc.pdfviewer.PDFView;
import com.github.barteksc.pdfviewer.scroll.DefaultScrollHandle;
import com.github.barteksc.pdfviewer.util.FitPolicy;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
public class my_view extends AppCompatActivity {
AdView mAdView ;
private InterstitialAd mInterstitialAd;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.my_view);
//PDF View
PDFView pdfView = findViewById(R.id.general_v);
pdfView.fromAsset(getIntent().getStringExtra("BOOK_PATH"))
.enableSwipe(true) // allows to block changing pages using swipe
.swipeHorizontal(false)
.enableDoubletap(true)
.defaultPage(0)
.getCurrentPage()
.enableAnnotationRendering(false) // render annotations (such as comments, colors or forms)
.password(null)
.enableAntialiasing(true) // improve rendering a little bit on low-res screens
// spacing between pages in dp. To define spacing color, set view background
.spacing(0)
.pageFitPolicy(FitPolicy.WIDTH)
.scrollHandle(new DefaultScrollHandle(this,false))
.load();
}
I Cant do it , please help me
Create an on load() method Save the current reading page in shared preference. This will store the current reading page when a pdf is loaded.
Then call the on destroy () method. Pass the saved current reading page.
Lastly insert the saved page in the default page.