How can ленивую content be loaded into the application?
In some games, additional content is loaded by agreement with the user, after the application is launched. How to implement a similar mechanism?
How can ленивую content be loaded into the application?
In some games, additional content is loaded by agreement with the user, after the application is launched. How to implement a similar mechanism?
Please correct the question so that it describes the specific problem with sufficient detail to determine the appropriate answer. Do not ask a few questions at once. See “How to ask a good question?” For clarification. If the question can be reformulated according to the rules set out in the certificate , edit it .
This is done something like this.
Suppose there is an ImageView , in which you need to download a large file from an external source. In principle, texture loading is not much different from loading an image, so this can be omitted.
1) We must take care to stub / stub'om pictures. It can either be generated in advance and put into resources or it can be generated programmatically in the form of a Thumbnail, for example:
Bitmap ThumbImage = ThumbnailUtils.extractThumbnail( BitmapFactory.decodeFile(imagePath), THUMBSIZE, THUMBSIZE); 2) At the time of the layout sweep, we will load a stub instead of our ImageView / thumbnail
3) Next, run AsyncTask in which we AsyncTask image from an external source in the doInBackground() method. When AsyncTask completes in the onPostExecute() method, onPostExecute() already replace the stub with the downloaded picture.
Lieb do many jobs like this, for example universalImageloader or newfangled Picasso
Source: https://ru.stackoverflow.com/questions/645117/
All Articles