Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8259361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:50:40+00:00 2026-06-08T02:50:40+00:00

I have a very wierd problem. I have some data which I show in

  • 0

I have a very wierd problem. I have some data which I show in a Dialog. If I close the App and reopen it again my ArrayList always adds the original data again (First 5 entries -> close & reopen -> 10 entries -> close & reopen -> 15 entries etc.).

This is how I parse my data into the ArrayList (This only happens once in my TabHost):

JSONArray jPDFs = json.getJSONArray("pdfs");
            for (int i = 0; i < jPDFs.length(); i++) {
                JSONObject c3 = jPDFs.getJSONObject(i);

                String pdf_title = c3.getString("title");
                String pdf_url = c3.getString("url");

                pdfListTitle.add(pdf_title);
                pdfListTitle2.add(pdf_title);
                pdfListURL.add(pdf_url);
            }

And here is my Code where I show the dialog with the parsed data:

public void showDialog() {
    items = null; // have tried with and without...
    builder = null; // have tried with and without...

    builder = new AlertDialog.Builder(this);
    Log.e(TabHost.LOG_TAG, "pdfListTitle=" + TabHost.pdfListTitle.size()); // this always hops from 5 -> 10 -> 15 on every reopen (without killing the app with a taskkiller...)

    items = TabHost.pdfListTitle.toArray(new CharSequence[TabHost.pdfListTitle.size()]);

    builder.setTitle(R.string.choose_document);
    builder.setItems(items, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int item) {
            WebView wv = (WebView) findViewById(R.id.webviewpdf);
            wv.setWebViewClient(new WebViewClient());
            wv.getSettings().setJavaScriptEnabled(true);
            wv.getSettings().setBuiltInZoomControls(true);
            wv.loadUrl("http://docs.google.com/gview?embedded=true&url="
                    + TabHost.pdfListURL.get(item));
        }
    });
    AlertDialog alert = builder.create();
    alert.show();
}

Thanks alot in advance for your help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T02:50:42+00:00Added an answer on June 8, 2026 at 2:50 am

    I think you have taken pdfListTitle as static in TabHost, this may be problem

    pdfListTitle should initialize every time when your activity call

    for example you can write this code in onCreate() method like this

    ArrayList<T> pdfListTitle;
    
    protected void onCreate(Bundle savedInstanceState) {
    
      pdfListTitle = new ArrayList<T>; <----
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am experiencing a very weird problem: In WPF I have a tabControl which
I have a very wierd problem happening to me during unit testing (MSTest in
I have a very weird problem. I have a webpage that displays some graphs
So I have a very weird problem. I am writing some code in VB.Net
I have a very weird problem.. I really do hope someone has an answer
I have a very weird problem in Firefox ( version 3.5.2), and I am
I have a very weird problem with PROLOG. I have used it before, but
Hello I have a very weird problem in chrome I just cannot figure out!
Hi I have run into a very weird problem. I have a basic chrome
So, I have this very weird error - Some advanced PHP devs might also

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.