Note that there are some explanatory texts on larger screens.

plurals
  1. POgridview changing position automatically when notifiedDatasetChangedCalled?
    primarykey
    data
    text
    <p>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</p> <pre><code> 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&lt;Integer, List&lt;OrderlistData&gt;&gt; orederMap1 = ConText .getTotlaMap(); List&lt;OrderlistData&gt; orderlist1 = new ArrayList&lt;OrderlistData&gt;(); Set&lt;Integer&gt; 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; } </code></pre> <p>here is the code for updating gridview in every 20sec<br> //=============Refreshing gridview ==============</p> <pre><code> private class UpdateGridview extends AsyncTask&lt;Context, Integer, String&gt; { @Override protected String doInBackground(Context... params) { int i = 0; while (i &lt; 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 ); } </code></pre> <p>}</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload