Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8564329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:10:30+00:00 2026-06-11T17:10:30+00:00

I am new on android. I am using XML parsing for my app and

  • 0

I am new on android. I am using XML parsing for my app and how can show an Background image and on top it a ProgessBar when click on my app and it hold the screen till my data will not come. I am exactly make my app like BBC News android app

AsyncTask<Void, Void, Drawable> downloader = new AsyncTask<Void, Void, Drawable>() {

    @Override
    protected Drawable doInBackground(Void... params) {
        AndroidHttpClient client = AndroidHttpClient.newInstance(context.getPackageName());
        try {
            HttpGet get = new HttpGet(url);
            final HttpParams httpParams = new BasicHttpParams();
            HttpClientParams.setRedirecting(httpParams, true);
            get.setParams(httpParams);
            HttpResponse resp = client.execute(get);
            int status = resp.getStatusLine().getStatusCode();
            if(status != HttpURLConnection.HTTP_OK){
                //Log.i(LOGTAG, "Couldn't download image from Server: " + url + " Reason: " + resp.getStatusLine().getReasonPhrase() + " / " + status);
                return null;
            }
            HttpEntity entity = resp.getEntity();
            //Log.i(LOGTAG, url + " Image Content Length: " + entity.getContentLength());
            InputStream is = entity.getContent();
            FileOutputStream fos = context.openFileOutput(filename, Context.MODE_PRIVATE);
            copyStream(is, fos);
            fos.close();
            is.close();
            FileInputStream  fis = context.openFileInput(filename);
            return loadDrawableFromStream(context, fis);
        }
        catch (Exception ex) {
            //Log.e(LOGTAG, "Exception during Image download of " + url, ex);
            return null;
        }
        finally {
            client.close();
        }
    }

    @Override
    protected void onPostExecute(Drawable result) {
        if (result == null)
            result = defaultDrawable;
        mPendingDownloads.remove(url);
        cache.put(url, result);
        for (ImageView iv: downloads) {
            // validate the url it is waiting for
            String pendingUrl = mPendingViews.get(iv);
            if (!url.equals(pendingUrl)) {
                //Log.i(LOGTAG, "Ignoring out of date request to update view for " + url);
                continue;
            }
            mPendingViews.remove(iv);
            if (result != null) {
                final Drawable newImage = result;

                Drawable newSize=resize(newImage);


                final ImageView imageView = iv;

                imageView.setImageDrawable(newSize);
            }
        }
    }

    private BitmapDrawable resize(Drawable newImage) {
        // TODO Auto-generated method stub

        Bitmap d = ((BitmapDrawable)newImage).getBitmap();
        Bitmap bitmapOrig = Bitmap.createScaledBitmap(d, 75, 75, false);
        return new BitmapDrawable(bitmapOrig);                                              
    }
};
downloader.execute();
}

private static Hashtable<ImageView, String> mPendingViews = new Hashtable<ImageView, String>();
private static Hashtable<String, ArrayList<ImageView>> mPendingDownloads = new Hashtable<String, ArrayList<ImageView>>();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T17:10:31+00:00Added an answer on June 11, 2026 at 5:10 pm
    private ProgressDialog progressDialog;
    
    protected void onPreExecute() {
            progressDialog = ProgressDialog.show(context, "", context.getResources().getString(R.string.searching_wait_message), true);
    }
    protected void onPostExecute(Vector<SearchResult> result) {
        progressDialog.dismiss();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing Android Web App using JSP with xml parsing. I developed it
New at using admob within Android. Is it possible to show ads with certain
I've migrated to new build.xml using android update to my existing project, it builds
I have done one program in android using xml parsing but there is an
i'm new with android. I'm working on an application using xml layouts. I wish
I am using the following code by the Android-people-XMLParsing example for parsing XML file
My Android app reads a huge XML file using Simple XML . Obviously it
I'm using Android's XML parsing helper ( android.util.Xml.parse(InputStream, Encoding, ContentHandler ) to parse this
i am creating a new android application.i am using the table layout. I have
I'm new to Mono for Android (using MonoDevelop) and Android development in general. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.