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 9216093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:20:40+00:00 2026-06-18T02:20:40+00:00

Hello I created a custom list view and for update used notifyDataSetChanged() method but

  • 0

Hello I created a custom list view and for update used notifyDataSetChanged() method but my list not updated. please help me.

this is my source code

public class fourthPage extends ListActivity {
ListingFeedParser ls;
List<Listings> data;
EditText SearchText;
Button Search;
private LayoutInflater mInflater;
private ProgressDialog progDialog;
private int pageCount = 0;
String URL;
ListViewListingsAdapter adapter;
Message msg;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    Bundle b = getIntent().getExtras();
    URL = b.getString("URL");
    Log.i("Ran->URL", "->" + URL);
    MYCITY_STATIC_DATA.fourthPage_main_URL = URL;
    final ListingFeedParser lf = new ListingFeedParser(URL);
    Search = (Button) findViewById(R.id.searchButton);
    SearchText = (EditText) findViewById(R.id.search);
    InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(SearchText.getWindowToken(), 0);
    this.getWindow().setSoftInputMode(
            WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);

    try {
        progDialog = ProgressDialog.show(this, "",
                "Loading please wait....", true);
        progDialog.setCancelable(true);
        new Thread(new Runnable() {

            @Override
            public void run() {

                try {
                    data = lf.parse();
                } catch (Exception e) {
                    e.printStackTrace();
                }

                msg = new Message();
                msg.what = 1;
                fourthPage.this._handle.sendMessage(msg);

            }
        }).start();

        Search.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                SearchText = (EditText) findViewById(R.id.search);
                if (SearchText.getText().toString().equals(""))
                    return;
                CurrentLocationTimer myLocation = new CurrentLocationTimer();
                LocationResult locationResult = new LocationResult() {
                    @Override
                    public void gotLocation(final Location location) {
                        Toast.makeText(
                                getApplicationContext(),
                                location.getLatitude() + " "
                                        + location.getLongitude(),
                                Toast.LENGTH_LONG).show();
                        String URL = "http://75.125.237.76/phone_feed_2_point_0_test.php?"
                                + "lat="
                                + location.getLatitude()
                                + "&lng="
                                + location.getLongitude()
                                + "&page=0&search="
                                + SearchText.getText().toString();
                        Log.e("fourthPage.java Search URL :->", "" + URL);
                        Bundle b = new Bundle();
                        b.putString("URL", URL);
                        Intent it = new Intent(getApplicationContext(),
                                fourthPage.class);
                        it.putExtras(b);
                        startActivity(it);
                    }
                };
                myLocation.getLocation(getApplicationContext(),
                        locationResult);
            }
        });

    } catch (Exception e) {
        Toast.makeText(getApplicationContext(),
                "No data available for this request", Toast.LENGTH_LONG)
                .show();
    }
}

private Handler _handle = new Handler() {
    @Override
    public void handleMessage(Message msg) {
        progDialog.dismiss();
        if (msg.what == 1) {
            if (data.size() == 0 || data == null) {
                Toast.makeText(getApplicationContext(),
                        "No data available for this request",
                        Toast.LENGTH_LONG).show();
            }
            mInflater = (LayoutInflater) getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
            adapter = new ListViewListingsAdapter(getApplicationContext(),
                    R.layout.list1, R.id.title, data, mInflater);               
            setListAdapter(adapter);                
            getListView().setTextFilterEnabled(true);
            adapter.notifyDataSetChanged();
        } else {
            Toast.makeText(getApplicationContext(),
                    "Error in retrieving the method", Toast.LENGTH_SHORT)
                    .show();
        }

    }
};

public void onListItemClick(ListView parent, View v, int position, long id) {
    // remember i m going from bookmark list
    MYCITY_STATIC_DATA.come_from_bookmark = false;
    Log.i("4thPage.java -  MYCITY_STATIC_DATA.come_from_bookmark",
            "set false - > check" + MYCITY_STATIC_DATA.come_from_bookmark);
    Listings sc = (Listings) this.getListAdapter().getItem(position);
    if (sc.getName().equalsIgnoreCase("SEE MORE...")) {
        pageCount = pageCount + 1;
        final ListingFeedParser lf = new ListingFeedParser((URL.substring(
                0, URL.length() - 1)) + pageCount);
        try {
            progDialog = ProgressDialog.show(this, "",
                    "Loading please wait....", true);
            progDialog.setCancelable(true);
            new Thread(new Runnable() {
                @Override
                public void run() {

                    data.remove(data.size() - 1);
                    data.addAll(lf.parse());

                    Message msg = new Message();
                    msg.what = 1;
                    fourthPage.this._handle.sendMessage(msg);

                }
            }).start();
        } catch (Exception e) {
            pageCount = pageCount - 1;
            // TODO: handle exception
            Toast newToast = Toast.makeText(this, "Error in getting Data",
                    Toast.LENGTH_SHORT);
        }
    } else {
        Bundle b = new Bundle();
        b.putParcelable("listing", sc);
        Intent it = new Intent(getApplicationContext(),
                FifthPageTabbed.class);
        it.putExtras(b);
        startActivity(it);
    }
}

@Override
public void onBackPressed() {
    setResult(0);
    finish();
}

@Override
protected void onResume() {
    // TODO Auto-generated method stub
    super.onResume();
    Log.e("RESUME:-)", "4th Page onResume");
    try {           
        //adapter.notifyDataSetChanged();
        //setListAdapter(adapter);
        //getListView().setTextFilterEnabled(true);
    } catch (Exception e) {
        Log.e("EXCEPTION in 4th page",
                "in onResume msg:->" + e.getMessage());
    }
}

}

  • 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-18T02:20:41+00:00Added an answer on June 18, 2026 at 2:20 am

    Do not re-create the object of ArrayList or Array you are passing to adapter, just modify same ArrayList or Array again. and also when array or arrylist size not changed after you modify adapter then in that case notifydatasetchange will not work.

    In shot it is work only when array or arraylist size increases or decreases.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello I am trying to create a custom expandable listview, but the documentation on
Hello I`ve created simple WFC DataService and connected entit model with my database. This
Hello StackOverflow :) I have created some code inside my onStart(); method to ensure
Hello all I created a custom listview through my custom adapter.. CustomAdapter adapter =
Hello Stack Overflow Android Users, Please help with the following question: Problem I'm writing
Hello friends I created some custom fields for contacts. How can I insert values
I created a custom command: class CrawlCommand extends ContainerAwareCommand{ protected function configure(){ $this->setName('crawler:crawl') ->setDescription('Command
Hi I've been having some trouble trying to get a list view I created
1) I have created a custom object Hello . Added two lookup fields to
So I've created myself a custom form element which has a custom view helper.

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.