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

  • Home
  • SEARCH
  • 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 6806545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:43:26+00:00 2026-05-26T19:43:26+00:00

here ia an application where i displaying some text with image background but it

  • 0

here ia an application where i displaying some text with image background but it got changes position
automatically when notifieddatasetchanged() is called, please help me how to fixed it constant position ,below is my code. thanks you

 public View getView(final int position, View convertView, ViewGroup parent) {
        //ImageView imageView;
        View v;
        TextView tv = null;
        if (convertView == null) { 


            LayoutInflater li = getLayoutInflater();
            v = li.inflate(R.layout.show_table_gridview, null);
            tv = (TextView)      
                            v.findViewById(R.id.tab_num);
            tv.setText(""+position+1));                 

            tv.setTextColor(Color.BLACK);
            HashMap<Integer, List<OrderlistData>> orederMap1 = ConText
            .getTotlaMap();
            List<OrderlistData> orderlist1 = new ArrayList<OrderlistData>();
            Set<Integer> keySet1 = orederMap1.keySet();
              if (keySet1.contains(position))
                  orderlist1 = orederMap1.get(position);

              if (orderlist1.isEmpty()){

              }
            else{
              tv.setBackgroundColor(Color.CYAN);
             }
          } 
           else {
            v =  convertView;
        }
        /**
         * Code for changing background if data is content
         */
        return v;
    }

here is the code for updating gridview in every 20sec
//=============Refreshing gridview ==============

  private class UpdateGridview extends AsyncTask<Context, Integer, String>
     {

    @Override
    protected String doInBackground(Context... params) {

        int i = 0;
        while (i < 10) {
            try {
                Thread.sleep(30000);
                Message msg = handler.obtainMessage();
                handler.sendMessage(msg);

                i++;
            } catch (Exception e) {
                Log.i("makemachine", e.getMessage());
            }
        }
        return "COMPLETE!";
    }

        private final Handler handler = new Handler() {
            public void handleMessage(Message msg) {

                getCurrent_orderlist_StatusFromServer();
                gridadapter.notifyDataSetChanged();

                System.out
                        .println("i  called notifyDataSetChanged()=======================");
            }
        };


        // -- gets called just before thread begins
        @Override
        protected void onPreExecute() 
        {
                Log.i( "makemachine", "onPreExecute()" );
                super.onPreExecute();

        }


        @Override
        protected void onProgressUpdate(Integer... values) 
        {
                super.onProgressUpdate(values);

        }

        // -- called if the cancel button is pressed
        @Override
        protected void onCancelled()
        {
                super.onCancelled();
               Log.i( "makemachine", "onCancelled()" );

        }

        // -- called as soon as doInBackground method completes
        // -- notice that the third param gets passed to this method
        @Override
        protected void onPostExecute( String result ) 
        {
                super.onPostExecute(result);
                Log.i( "makemachine", "onPostExecute(): " + result );

        }

}

  • 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-26T19:43:27+00:00Added an answer on May 26, 2026 at 7:43 pm

    It’s happening like this because you are giving the if condition. It’s because at the first time only convertview gets assigned. For the second time it’s not entering into the if condition.
    And you have to execute the codes within the if. So just remove the if condition, it will work properly.

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

Sidebar

Related Questions

I've a (C#).NET GUI application. Where I need console for displaying some output. The
I have an application you can access here When you open the app, please
I am developing an application for Moto Xoom. I am displaying some static content
I've got a question regarding displaying local notification reminders inside the application. I think
We need to optimize the text rendering for a C# Windows Forms application displaying
Im new to iphone development. here in my application i added pickerview for some
I'm using EntityFramework, WPF and MVVM in my application and got some problems with
Problem is that, when screen changes orientation, textview background color is gone. here is
I'm having some trouble with displaying numbers in apex, but only when i fill
I have windows forms application wich runs another console application here is the part

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.