I’ve been having some troubles to get an IF/ELSE statement working.
I have the following code:
File fileOnSD=Environment.getExternalStorageDirectory();
String storagePath = fileOnSD.getAbsolutePath();
Bitmap BckGrnd = BitmapFactory.decodeFile(storagePath + "/oranjelanbg.png");
ImageView BackGround = (ImageView)findViewById(R.id.imageView1);
BackGround.setImageBitmap(BckGrnd);
if (){
}else{
TextView text1 = (TextView) findViewById(R.id.textView1);
TextView text2 = (TextView) findViewById(R.id.textView2);
text1.setVisibility(View.VISIBLE);
text2.setVisibility(View.VISIBLE);
}
And I’m trying to achieve to following.
My app downloads an image to the phone and uses this as a background.
But the picture is not downloaded yet when u run the app for the first time, so there must be some text instead.
The text is invisible by default and I want to make it visible when the image is still downloading and not placed yet.
What expression should I use in the IF statement to check if the image is loaded?
Better Solution:
Use AyncTask for Downloading Image: