Sapient
Company
Programming
Basics
Identify the correct inference from this piece of code:
public void onClick(View v){
new Runnable(){
public void run(){
Bitmap b = loadImageFromNetwork();
mImageView.setImageBitmap(b);
}
}).start():}
1) Here ImageView is manipulated on a worker thead which can cause really weird problems. Tracking down and fixing such bugs can be difficult and time consuming.
2) Here ImageView is manipulated on main thread. which is efficient & less time consuming.
3) Here ImageView is manipulated on main thread, which is asynchronous but time consuming.
4) Here ImageView is manipulated on a main thread, but this can cause weird problems. Tracking down and fixing such bugs can be difficult and time consuming.
Read Solution (Total 1)
-
- 1. Here ImageView is manipulated on a worker thead which can cause really weird problems. Tracking down and fixing such bugs can be difficult and time consuming.
Reason- Andoid UI toolkit is not thread-safe. In single-threaded model- do not access the Android UI toolkit from outside the UI thread - 7 years agoHelpfull: Yes(0) No(0)
Sapient Other Question