Note that there are some explanatory texts on larger screens.

plurals
  1. POWhere to place the AsyncTask() so that i can call it to load image?
    primarykey
    data
    text
    <p>Below is my coding where it would load the image when this Activity is called. But i wished to display the progressDialog when it was retrieving the images from the server instead of just a black screen presented to the user. I heard that AsyncTask is able to do but i stuck with where to place the AsyncTask function and calling it.</p> <pre><code>public class LargeImageScroller extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(new SampleView(this)); } private static class SampleView extends View { private static Bitmap bmLargeImage; //bitmap large enough to be scrolled private static Rect displayRect = null; //rect we display to private Rect scrollRect = null; //rect we scroll over our bitmap with private int scrollRectX = 0; //current left location of scroll rect private int scrollRectY = 0; //current top location of scroll rect private float scrollByX = 0; //x amount to scroll by private float scrollByY = 0; //y amount to scroll by private float startX = 0; //track x from one ACTION_MOVE to the next private float startY = 0; //track y from one ACTION_MOVE to the next public SampleView(Context context) { super(context); displayRect = new Rect(0, 0, displayWidth, displayHeight); scrollRect = new Rect(0, 0, displayWidth, displayHeight); bmLargeImage = Bitmap.createBitmap(1035 , 665, Config.ARGB_8888); bmLargeImage = createMap(this.getContext()); } public boolean onTouchEvent(MotionEvent event) {....} protected void onDraw(Canvas canvas) {....} private static Bitmap createMap(Context context) {...} private static Drawable LoadImageFromWebOperations(String url) {....} private static Bitmap decodeFile(File f, int requiredSize) {...} } } </code></pre> <p>I wish to know where should i place the AsyncTask function so as to display the progressDialog while the program is loading the image from server/cache. Most of the source i found on the internet doesn't say much.</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.
    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