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 6191661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:48:20+00:00 2026-05-24T02:48:20+00:00

in my app when an activity is launched i am hitting an url and

  • 0

in my app when an activity is launched i am hitting an url and from that an xml file is got. The xml file contains the url of various images. I am parsing those values and storing them in an array list. From that list the images are been loaded in grid view. When this process gets started some times a black screen use to appear while loading images from my web service. So in that case i want to show a progress bar.

Following is my code to show progress bar

class Image extends AsyncTask<Void, Void, Void> 
 {       
       ProgressDialog dialog = new ProgressDialog(ProfileImages.this);

    protected void onPreExecute() 
    {       
        dialog.setMessage("Please wait...");
        dialog.setIndeterminate(true);
        dialog.show();
    }

        protected void onPostExecute(Void unused) 
    {
                    i.setImageBitmap(bm);
        dialog.dismiss();
    }

        @Override
    protected Void doInBackground(Void... params) 
    {
            parsing();
                grid.setAdapter(new ImageAdapter(this));
        return null;
    }
}

But my app i getting crashed. The parsing functions are doing good but when it reaches the

 grid.setAdapter(new ImageAdapter(this));

public View getView(final int position, View convertView,ViewGroup parent) 
    {
        ImageView i = new ImageView(this.myContext);
        if (convertView == null) 
        {
            i = new ImageView(myContext);
            i.setLayoutParams(new GridView.LayoutParams(105, 105));
            i.setScaleType(ImageView.ScaleType.CENTER_CROP);
            i.setPadding(8, 8, 8, 8);

             i.setOnClickListener(new View.OnClickListener()
             {
                 public void onClick(View view)
                 {

                     dialog = new ProgressDialog(ProfileGridView.this);
                     dialog.setMessage("Please wait...");
                     dialog.setIndeterminate(true);
                     dialog.show();
                     new Thread() 
                     {
                        public void run() 
                        {
                            try 
                            {
                                Thread.sleep(300);
                            }
                            catch (InterruptedException e) 
                            {
                                e.printStackTrace();
                            }
                            Bundle bundle = new Bundle();
                            bundle.putInt("key1",position); 
                            Appconstant.showLog("position clicked "+position);

                            Intent myIntent = new Intent(getBaseContext(),ProfileImages.class);
                            myIntent.putExtras(bundle);
                            startActivityForResult(myIntent, 0);
                            dialog.dismiss();
                        }
                     }.start();
                 }
             });
        } 
        else 
        {
            i = (ImageView) convertView;
        }

        try 
        {
            URL aURL = new URL(myRemoteImages[position]);
            Appconstant.showLog("Grid View URL " + aURL);
            URLConnection conn = aURL.openConnection();
            conn.connect();
            InputStream is = conn.getInputStream();

            BufferedInputStream bis = new BufferedInputStream(is);
            Bitmap bm = BitmapFactory.decodeStream(bis);
            bis.close();
            is.close();

            i.setImageBitmap(bm);
        } 
        catch (IOException e) 
        {
            Appconstant.showErrorLog("DEBUGTAG Remtoe Image Exception" + e);
        }
        return i;
    }

    public float getScale(boolean focused, int offset) 
    {
        return Math.max(0, 1.0f / (float) Math.pow(2, Math.abs(offset)));
    }
}   

it gets crashed. How to do this, please help me

  • 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-05-24T02:48:21+00:00Added an answer on May 24, 2026 at 2:48 am
    class GridImages extends AsyncTask<Void, Void, Void> 
         {       
               ProgressDialog dialog = new ProgressDialog(ProfileGridView.this);
    
            protected void onPreExecute() 
            {       
                dialog.setMessage("Please wait...");
                dialog.setIndeterminate(true);
                dialog.show();
            }
    
            protected void onPostExecute(Void unused) 
            {
                grid.setAdapter(new ImageAdapter(ProfileGridView.this));
                dialog.dismiss();
            }
    
                @Override
            protected Void doInBackground(Void... params) 
            {
                    parsing();      
                return null;
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I open my app from launcher - Activity A is launched Inside Activity A,
I have three activities in my app: .OpeningScene: An opening activity that contains my
in my app, when the activity gets launched i am calling an AsynTask to
I've defined my preferences in an xml file, preferences.xml. I've also got a SettingsWindow
how to check whether the activity was launched from notification or from the user
I want to create an activity that launched without UI on boot and restarted
I am coding an app that give me some problems. I have an activity
In our Android app, I have an activity that has a gridview that displays
I have an android app that register a custom url scheme (let's say app://)
I want to set some intent flags on the launcher activity of my app

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.