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

  • Home
  • SEARCH
  • 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 8912543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:13:38+00:00 2026-06-15T04:13:38+00:00

In my application i am loading data in a galleryview.If user clicks any item

  • 0

In my application i am loading data in a galleryview.If user clicks any item in galleryview i will load data from adapterclass.I kept an activity indicator between this loading and displaying data.But the activity indicator is not dismissing,it is showing continuously.

My activity code:

gal.setOnItemClickListener(new OnItemClickListener() 
       {                                                                                                                                                                                                                                                                                                                    
        @Override
        public void onItemClick (AdapterView<?> parent, View v, int position,
                long id) {
            // TODO Auto-generated method stub  

//           mDialog = new ProgressDialog(NewsPaperNov28MainGalleryActivity.this);
//           mDialog.setMessage("Please wait...");
//           mDialog.setCancelable(false);


             mDialog=  ProgressDialog.show(NewsPaperNov28MainGalleryActivity.this,"Working..", "Please Wait", true,false);           
             context.getInstance().setAppVariable("sectionurl", adapter.sectionurl[position]);
             Thread thread = new Thread();
             thread.start();


//          ListView list=(ListView)findViewById(R.id.list);
//          listadapter = new ListViewwithimageAdapter(this);
//          list.setAdapter(listadapter);        

        }
    });


        list.setOnItemClickListener(new OnItemClickListener() 
        {

            @Override
            public void onItemClick(AdapterView<?> parent, View view,
                    int position, long id) 
            {

                // TODO Auto-generated method stub
                context.getInstance().setAppVariable("storyurl", listadapter.url[position]);        
                Intent in = new Intent(getApplicationContext(), NewsDescription.class);
                startActivity(in);

            }
        });
    }
    @Override
    public void run() {
        // TODO Auto-generated method stub
//      context.getInstance().setAppVariable("sectionurl", adapter.sectionurl[position]);
        System.out.println("inside run");
        list=(ListView)findViewById(R.id.list);
        listadapter = new ListViewwithimageAdapter(this);
        System.out.println("B4 handle");
        handler.sendEmptyMessage(0);
    }

     private Handler handler = new Handler() {
         @Override
         public void handleMessage(Message msg) {
             System.out.println("Inside handler");
                 mDialog.dismiss();
                 list.setAdapter(listadapter);

         }
 };

My ListViewwithimageAdapter class:

public class ListViewwithimageAdapter extends BaseAdapter
{
    private static Context contxt;
    final String URL = "http://xxxxxxx/xml/stories/"+rgd.xml;   
     String[] kickerimage = {};//new String[50];

    ListViewwithimageAdapter(Context conxt)
    {

        this.contxt=conxt;
        getelement();

    }

         public ListViewwithimageAdapter(
            OnItemSelectedListener onItemSelectedListener) 
         {
        // TODO Auto-generated constructor stub
//           this.contxt=conxt;
            getelement();
    }

        public ListViewwithimageAdapter(OnItemClickListener onItemClickListener) {
            // TODO Auto-generated constructor stub
            getelement();
        }


        String[] itemsarray = {};//new String[100];
        String[] url= {};//new String[30];
    public String[] getelement()
    {
//        System.out.println("Insid getelement");
          ArrayList<String> menuItems = new ArrayList<String>();
          TaplistingParser parser = new TaplistingParser();
//        System.out.println("url="+URL);
          String xml= parser.getXmlFromUrl(URL);
          Document doc=parser.getDomElement(xml);        
//        System.out.println("sssss="+doc);
          NodeList nl=doc.getElementsByTagName("article"); 
          kickerimage = new String[nl.getLength()];
          url = new String[nl.getLength()];

//        String headings = null;

          for(int i=0; i < nl.getLength(); i++)
          {

//            System.out.println("i="+i);
            HashMap<String, String> map = new HashMap<String, String>();
            Element e = (Element) nl.item(i);
//          map.put("Title", parser.getValue(e, "title"));
//          map.put("Date", parser.getValue(e, "create_date"));         
            url[i]=parser.getValue(e, "url");
//          System.out.println("b4 kick");
//          System.out.println("value="+parser.getValue(e, "title"));
            kickerimage[i]=parser.getValue(e, "kickerimage");
//          System.out.println("after kick");
//          System.out.println("kick="+kickerimage[i]);
            menuItems.add(parser.getValue(e, "title"));          
          }  
//         System.out.println("b4 items array");
           itemsarray = new String[menuItems.size()];
//         System.out.println("subbu");
           itemsarray=menuItems.toArray(itemsarray);
//         System.out.println("subbu1");
//         System.out.println("in last");
           return itemsarray;
    }
    @Override
    public int getCount() 
    {
        // TODO Auto-generated method stub
        return itemsarray.length;
    }

    @Override
    public Object getItem(int position) 
    {
        // TODO Auto-generated method stub
        return itemsarray[position];
    }
    @Override
    public long getItemId(int position) 
    {
        // TODO Auto-generated method stub
//      System.out.println("pos in id="+position);
        return position;
    }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) 
    {



        // TODO Auto-generated method stub      
         Bitmap bitmap = DownloadImage(
                 kickerimage[position] );        
//       View listView = convertView;
         if (convertView   == null) 
            {
                //this should only ever run if you do not get a view back            
             LayoutInflater  inflater = (LayoutInflater) contxt
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
             convertView  = inflater.inflate(R.layout.homelistrow, null); 
            }
//       else
//       {
//           holder.removeAllViews();
//       }
//      View listView;
//      if (convertView == null) 
//      {
//          listView = new View(contxt);             
//          LinearLayout holder = (LinearLayout)convertView.findViewById(android.R.id);
////            holder = inflater.inflate(R.layout.homelistrow, null); 
//          System.out.println("pos="+position);
//          System.out.println("item="+getItem(position));
//       else
//       {
            TextView textView = (TextView) convertView
                    .findViewById(R.id.name_label);
            textView.setText(itemsarray[position]);

            ImageView imageView = (ImageView) convertView
                    .findViewById(R.id.icon);
            imageView.setImageBitmap(bitmap);
//      }
//      else        
//      {
//          listView = (View) convertView;
//      } 
//       }

        return convertView ;        
    }   
    private Bitmap DownloadImage(String URL)
    {        
//      System.out.println("image inside="+URL);
        Bitmap bitmap = null;
        InputStream in = null;        
        try {
            in = OpenHttpConnection(URL);
            bitmap = BitmapFactory.decodeStream(in);
            in.close();
        } catch (IOException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
//        System.out.println("image last");
        return bitmap;                
    }
    private InputStream OpenHttpConnection(String urlString)
            throws IOException
            {
                InputStream in = null;
                int response = -1;

                URL url = new URL(urlString);
                URLConnection conn = url.openConnection();

                if (!(conn instanceof HttpURLConnection))                    
                    throw new IOException("Not an HTTP connection");

                try{
                    HttpURLConnection httpConn = (HttpURLConnection) conn;
                    httpConn.setAllowUserInteraction(false);
                    httpConn.setInstanceFollowRedirects(true);
                    httpConn.setRequestMethod("GET");
                    httpConn.connect();

                    response = httpConn.getResponseCode();                
                    if (response == HttpURLConnection.HTTP_OK) 
                    {
                        in = httpConn.getInputStream();                                
                    }                    
                }
                catch (Exception ex)
                {
                    throw new IOException("Error connecting");            
                }
                return in;    
    }
}

Where i am going wrong??Please help me thanks in advance..

  • 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-15T04:13:39+00:00Added an answer on June 15, 2026 at 4:13 am

    I solved it ..the problem lies in the line

    Thread thread = new Thread();
    

    Instead of this i done:

    Thread thread = new Thread(Myactivity.this);
    

    Now the Indicator is disappearing after loading.Thanks to all..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm loading data from a MySQL database into a C# .NET application. The data
Currently I am loading data from a previous session into my application using the
In my application, I'm loading some data from a file. This can fail and
I have an application loading CAD data (Custom format), either from the local filesystem
I have an application that requires loading data from a network for a UITableView
I´m loading data from MySQL DB into Java application. How to define column type?
I am loading data from a plist into a tableview in my application. Data
I am building an iPhone application loading data from SQLite database. Until now I
I am loading data from a resource within my own application, and the escape
How can I begin loading data for my activity as soon as my application

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.