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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:58:11+00:00 2026-05-28T05:58:11+00:00

I have a listview that contains values from webservice.Each page contains only 10 listitems

  • 0

I have a listview that contains values from webservice.Each page contains only 10 listitems and the next 10 in page 2 etc.Each listitem is clickable and it contains a button which is mainly for voting.So when i click the button in list item 1 ,a value is added to webservice.

The button click codes are placed in a custom base adapter class.So that i can easily add the vote.But the problem is,When i submit the vote,i want to refresh my listview also.Suppose if iam in page no 5,refresh that listview page.

How can i refresh this listview instantly after submitting the value to webservice?

sample code for main.java

private class ProgressThreadNextPageLoading extends
AsyncTask<String, Void, String> {

    // private String Content;




    @Override
    protected void onPreExecute() {

        progressDialog = new ProgressDialog(KidsCrackMeUp.this);

        progressDialog.setMessage("Loading..Please Wait..");
        progressDialog.setIcon(R.drawable.icon);


        progressDialog.show();



    }

    @Override
    protected String doInBackground(String... urls) {

        String response = "";

        // call ur webservice here

        try {

            //  pagenum = 1;
            posts= web
            .getAllposts(pagenum);
            response = "Yes";

        } catch (Exception e) {

            e.printStackTrace();

            response = "Failure";

        }

        return response;

    }

    @Override
    protected void onPostExecute(String result) {

        // below line code is to dismiss the progress bar


        progressDialog.dismiss();
        if (posts != null) {
                adapter = new DynamicListAdapter(
                    main.this, posts
            lstPosts.setAdapter(adapter);
            adapter.notifyDataSetChanged();

            //btnState.setPressed(true);
        }

———————————-custom adapter class

    viewHolder.btnVoting.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
 final Dialog d = new Dialog(activity);
                d.requestWindowFeature(Window.FEATURE_NO_TITLE);
                d.setContentView(R.layout.voteselectornew);
                Button btnCategoryCancel = (Button) d
                .findViewById(R.id.btnCategoryCancel);

        Button twcVote = (Button) d
                .findViewById(R.id.btnTwcVote);

        twcVote.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View arg0) {
                String confirm = web
                .addTwcVote(UserSessionKey, Userlist.get(position).contentid);


                if (confirm.contains("Successfully")) {

d.dismiss();

}
  • 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-05-28T05:58:11+00:00Added an answer on May 28, 2026 at 5:58 am

    call your listview adapter’s method to update the change as:

    adapter.notifyDataSetChanged();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ListView that contains some data from sqllite table. the table is
I have a ListView that contains items with four columns. The values in three
I have a ListView in which each item has a complex layout that contains,
I have a listview that contains a checkedtextview . My app moves from the
I have a ListView that contains 1 image+2 texts + 1 image on a
I have a Custom ListView that contains a vertical LinearLayout of horizontal LinearLayouts for
I have a ListView that contains 3 checkboxes per row. I want to set
I have a ListView that contains playlists. If the user wants to edit an
My android app works on landscape mode. I have a listview that contains some
I have a LinearLayout which contains only a ListView. LinearLayout fills the entire screen

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.