Note that there are some explanatory texts on larger screens.

plurals
  1. POSet ProgressBar inside GridView When activity re Enter set ProgressValue
    primarykey
    data
    text
    <p>Dear Stackoverflowians</p> <p>I have a Gridview, In that each item is having horizontal progress bar set visible on item button click </p> <p>i do it by using asyncTask it works,but, Now my Problem is 1) when ever i scroll up or down while progressing, Progressbar progress in visible other item regarding position change </p> <p>2) changing activity and came again to this activity the progress bar is not visible in that grid item but progress running in backgroud i check it in Logcat.</p> <p>Here the sample of my process <img src="https://i.stack.imgur.com/NjG9f.png" alt="enter image description here"></p> <p>Here is the code of that progress download</p> <pre><code>private void UpdateDB(String strFilename,int lintIssueId,boolean bPreview,ImageView btnDownload,ImageView btnView) { try{ btnDownload.setVisibility(View.GONE); btnView.setVisibility(View.VISIBLE); }catch(Exception ex){} } private static class SCSDownload extends AsyncTask&lt;String, Integer, String&gt; { Main_Page activity; MiddlewareInterface AMI=MiddlewareInterface.GetInstance(); ProgressBar mProgressbar; RelativeLayout mRtProgress; ImageView btnDownload,btnView; int issueid; boolean bPrev; Context context; SCSDownload(Main_Page act,ProgressBar mProgressbar,RelativeLayout mRtProgress,ImageView btnDownload,ImageView btnView,int issueid,boolean bPrev) { this.mProgressbar=mProgressbar; this.mRtProgress=mRtProgress; this.issueid=issueid; this.bPrev=bPrev; this.btnView=btnView; this.btnDownload=btnDownload; attatch(act); } void attatch(Main_Page act) { activity=act; context=act; } void detatch() { activity=null; } @Override protected void onPreExecute() { // TODO Auto-generated method stub mRtProgress.setVisibility(View.VISIBLE); super.onPreExecute(); } @Override protected void onPostExecute(String result) { // TODO Auto-generated method stub if(result!=null) { try{ if(mRtProgress!=null) mRtProgress.setVisibility(View.GONE); activity.UpdateDB(result,issueid,bPrev,btnDownload,btnView); }catch(Exception e){} } super.onPostExecute(result); } @Override protected void onProgressUpdate(Integer... values) { // TODO Auto-generated method stub mProgressbar.setProgress(values[0]); super.onProgressUpdate(values); } @Override protected String doInBackground(String... params) { // TODO Auto-generated method stub try{ String File_Name=params[0].substring( params[0].lastIndexOf('/')+1, params[0].length() ); File file = new File(context.getDir(AMI.strMainDir, Context.MODE_PRIVATE) + "/"+File_Name); if (!file.exists()) { file.createNewFile(); URL url=new URL(params[0]); URLConnection con=url.openConnection(); con.connect(); int LengthOfFile=con.getContentLength(); InputStream input=new BufferedInputStream(url.openStream()); OutputStream output=new FileOutputStream(file); byte data[]=new byte[1024]; int count = 0; long total=0; while((count=input.read(data))!=-1&amp;&amp;(!isCancelled())) { total+=count; Log.d("total",total+""); publishProgress((int)((total*100)/LengthOfFile)); output.write(data,0,count); } output.flush(); output.close(); input.close(); } return File_Name; }catch(Exception ex){} return null; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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.
    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