Android progress bar setvisible not working
up vote
0
down vote
favorite
I have problem in seting visibility of Progressbar in a AsyncTask
this is my code:
public class DownloadImageTask extends AsyncTask<String, Void, Bitmap> {
ImageView IV;
FullImageActivity MA;
ProgressBar lp1;
public DownloadImageTask(ImageView IV,
FullImageActivity fullImageActivity) {
this.IV = IV;
this.MA = fullImageActivity;
lp1 = (ProgressBar) MA.findViewById(R.id.progressBar1);
}
protected Bitmap doInBackground(String... p) {
String url = "...";
Bitmap BI = null;
try {
InputStream in = new java.net.URL(url).openStream();
BI = BitmapFactory.decodeStream(in);
} catch (Exception e) {
Log.e("Error", e.getMessage());
e.printStackTrace();
}
return BI;
}
@Override
protected void onPreExecute() {
lp1.setVisibility(1);
super.onPreExecute();
}
protected void onPostExecute(Bitmap result) {
IV.setImageBitmap(result);
lp1.setVisibility(0);
}
}
and my XML
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/full_image_view"
android:layout_width="fill_parent"
android:layout_height="match_parent" />
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
</RelativeLayout>
when i use
lp1.setVisibility(0);
or
lp1.setVisibility(ProgressBar.GONE);
or
lp1.setVisibility(View.GONE);
or
lp1.setVisibility(View.INVISIBLE);
my progressBar still visible
android android-asynctask progress-bar visibility
add a comment |
up vote
0
down vote
favorite
I have problem in seting visibility of Progressbar in a AsyncTask
this is my code:
public class DownloadImageTask extends AsyncTask<String, Void, Bitmap> {
ImageView IV;
FullImageActivity MA;
ProgressBar lp1;
public DownloadImageTask(ImageView IV,
FullImageActivity fullImageActivity) {
this.IV = IV;
this.MA = fullImageActivity;
lp1 = (ProgressBar) MA.findViewById(R.id.progressBar1);
}
protected Bitmap doInBackground(String... p) {
String url = "...";
Bitmap BI = null;
try {
InputStream in = new java.net.URL(url).openStream();
BI = BitmapFactory.decodeStream(in);
} catch (Exception e) {
Log.e("Error", e.getMessage());
e.printStackTrace();
}
return BI;
}
@Override
protected void onPreExecute() {
lp1.setVisibility(1);
super.onPreExecute();
}
protected void onPostExecute(Bitmap result) {
IV.setImageBitmap(result);
lp1.setVisibility(0);
}
}
and my XML
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/full_image_view"
android:layout_width="fill_parent"
android:layout_height="match_parent" />
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
</RelativeLayout>
when i use
lp1.setVisibility(0);
or
lp1.setVisibility(ProgressBar.GONE);
or
lp1.setVisibility(View.GONE);
or
lp1.setVisibility(View.INVISIBLE);
my progressBar still visible
android android-asynctask progress-bar visibility
1
Why you used progress bar usedProgress Dialog
instead and dismiss it ononPostExecute(.....)
– M D
Mar 4 '14 at 13:05
tanx @SimplePlan i use that
– Hamidreza
Mar 4 '14 at 14:15
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have problem in seting visibility of Progressbar in a AsyncTask
this is my code:
public class DownloadImageTask extends AsyncTask<String, Void, Bitmap> {
ImageView IV;
FullImageActivity MA;
ProgressBar lp1;
public DownloadImageTask(ImageView IV,
FullImageActivity fullImageActivity) {
this.IV = IV;
this.MA = fullImageActivity;
lp1 = (ProgressBar) MA.findViewById(R.id.progressBar1);
}
protected Bitmap doInBackground(String... p) {
String url = "...";
Bitmap BI = null;
try {
InputStream in = new java.net.URL(url).openStream();
BI = BitmapFactory.decodeStream(in);
} catch (Exception e) {
Log.e("Error", e.getMessage());
e.printStackTrace();
}
return BI;
}
@Override
protected void onPreExecute() {
lp1.setVisibility(1);
super.onPreExecute();
}
protected void onPostExecute(Bitmap result) {
IV.setImageBitmap(result);
lp1.setVisibility(0);
}
}
and my XML
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/full_image_view"
android:layout_width="fill_parent"
android:layout_height="match_parent" />
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
</RelativeLayout>
when i use
lp1.setVisibility(0);
or
lp1.setVisibility(ProgressBar.GONE);
or
lp1.setVisibility(View.GONE);
or
lp1.setVisibility(View.INVISIBLE);
my progressBar still visible
android android-asynctask progress-bar visibility
I have problem in seting visibility of Progressbar in a AsyncTask
this is my code:
public class DownloadImageTask extends AsyncTask<String, Void, Bitmap> {
ImageView IV;
FullImageActivity MA;
ProgressBar lp1;
public DownloadImageTask(ImageView IV,
FullImageActivity fullImageActivity) {
this.IV = IV;
this.MA = fullImageActivity;
lp1 = (ProgressBar) MA.findViewById(R.id.progressBar1);
}
protected Bitmap doInBackground(String... p) {
String url = "...";
Bitmap BI = null;
try {
InputStream in = new java.net.URL(url).openStream();
BI = BitmapFactory.decodeStream(in);
} catch (Exception e) {
Log.e("Error", e.getMessage());
e.printStackTrace();
}
return BI;
}
@Override
protected void onPreExecute() {
lp1.setVisibility(1);
super.onPreExecute();
}
protected void onPostExecute(Bitmap result) {
IV.setImageBitmap(result);
lp1.setVisibility(0);
}
}
and my XML
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/full_image_view"
android:layout_width="fill_parent"
android:layout_height="match_parent" />
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
</RelativeLayout>
when i use
lp1.setVisibility(0);
or
lp1.setVisibility(ProgressBar.GONE);
or
lp1.setVisibility(View.GONE);
or
lp1.setVisibility(View.INVISIBLE);
my progressBar still visible
android android-asynctask progress-bar visibility
android android-asynctask progress-bar visibility
edited Nov 22 at 15:39
Cœur
17.2k9102142
17.2k9102142
asked Mar 4 '14 at 13:02
Hamidreza
1,2491824
1,2491824
1
Why you used progress bar usedProgress Dialog
instead and dismiss it ononPostExecute(.....)
– M D
Mar 4 '14 at 13:05
tanx @SimplePlan i use that
– Hamidreza
Mar 4 '14 at 14:15
add a comment |
1
Why you used progress bar usedProgress Dialog
instead and dismiss it ononPostExecute(.....)
– M D
Mar 4 '14 at 13:05
tanx @SimplePlan i use that
– Hamidreza
Mar 4 '14 at 14:15
1
1
Why you used progress bar used
Progress Dialog
instead and dismiss it on onPostExecute(.....)
– M D
Mar 4 '14 at 13:05
Why you used progress bar used
Progress Dialog
instead and dismiss it on onPostExecute(.....)
– M D
Mar 4 '14 at 13:05
tanx @SimplePlan i use that
– Hamidreza
Mar 4 '14 at 14:15
tanx @SimplePlan i use that
– Hamidreza
Mar 4 '14 at 14:15
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
lp1.setVisibility(0);
0
is the value for View.VISIBILE
Here the docs
tanx @blackbelt but Still not working
– Hamidreza
Mar 4 '14 at 13:22
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
lp1.setVisibility(0);
0
is the value for View.VISIBILE
Here the docs
tanx @blackbelt but Still not working
– Hamidreza
Mar 4 '14 at 13:22
add a comment |
up vote
0
down vote
lp1.setVisibility(0);
0
is the value for View.VISIBILE
Here the docs
tanx @blackbelt but Still not working
– Hamidreza
Mar 4 '14 at 13:22
add a comment |
up vote
0
down vote
up vote
0
down vote
lp1.setVisibility(0);
0
is the value for View.VISIBILE
Here the docs
lp1.setVisibility(0);
0
is the value for View.VISIBILE
Here the docs
answered Mar 4 '14 at 13:07
Blackbelt
127k22213240
127k22213240
tanx @blackbelt but Still not working
– Hamidreza
Mar 4 '14 at 13:22
add a comment |
tanx @blackbelt but Still not working
– Hamidreza
Mar 4 '14 at 13:22
tanx @blackbelt but Still not working
– Hamidreza
Mar 4 '14 at 13:22
tanx @blackbelt but Still not working
– Hamidreza
Mar 4 '14 at 13:22
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f22172716%2fandroid-progress-bar-setvisible-not-working%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Why you used progress bar used
Progress Dialog
instead and dismiss it ononPostExecute(.....)
– M D
Mar 4 '14 at 13:05
tanx @SimplePlan i use that
– Hamidreza
Mar 4 '14 at 14:15