Start the second activity immediately on start check whether you have
images to display or not if not create a separate thread (important it
should be separate thread) to get the images. To this separate thread
you should pass a listener (which can be your second activity or an
inner class), when thread gets data it will call the listener's method
which can update the view.
During the time when you don't get response you can show loading/
spinner. Once image comes you can replace spinner with your image.
HTH

On Mar 3, 2:43 pm, Beena <swdeveloper2...@gmail.com> wrote:
> Let me explain.
>
> I want to display the Images(which is from server) and its data in
> right side of image.
> To load the images from server I am using this.
>
>                 Bitmap bmImg=null;
>                 URL myFileUrl =null;
>                 HttpURLConnection conn=null;
>                 try {
>                 myFileUrl= new URL(fileUrl);//fileUrl is the image path
>                 } catch (MalformedURLException e) {
>                 e.printStackTrace();
>                 }
>                 try {
>             conn= (HttpURLConnection)myFileUrl.openConnection();
>                 conn.setDoInput(true);
>                 conn.connect();
>                 int length = conn.getContentLength();
>                 int[] bitmapData =new int[length];
>                 byte[] bitmapData2 =new byte[length];
>                 InputStream is = conn.getInputStream();
>
>                 bmImg = BitmapFactory.decodeStream(is);
>                 conn.disconnect();
>                 } catch (IOException e) {
>                  conn.disconnect();
>                  return bmImg;
>                 }
>
> It will work fine but it will first fetch all the images and then it
> will display.
> So it takes lots of time to go for next activity in between there
> comes black screen as well which i don't want.
>
> So i want to use the Threading. So first the data of the images will
> be displayed at their position and then as the image load it will
> display at their respective place.
>
> Thanks for the response.
>
> On Mar 3, 1:34 pm, A R <amit.r...@gmail.com> wrote:
>
> > Beena, I am not able to understand your problem?
>
> > Assuming you are displaying image and content in a list view, you want
> > to keep refreshing the view as and when images come? or you want to
> > make request for images and corresponding data separately and show
> > them as and when they come or together?
>
> > On Mar 3, 12:51 pm, Beena <swdeveloper2...@gmail.com> wrote:
>
> > > Is there any one?
>
> > > Please help.
>
> > > On Mar 2, 6:26 pm, Beena <swdeveloper2...@gmail.com> wrote:
>
> > > > Hi,
> > > > I am facing some strange thing.
> > > > I have a to display 15 images (from the server) and their detail in
> > > > besides that.
> > > > In Activity-A on button Click listener i am fetching the data and
> > > > image urls from the sever.
> > > > And in Activity-B I am displaying that images and the appropriate
> > > > data.
>
> > > > So how can i use the multithreading so that the information will
> > > > display at their position and as the image is load it will display the
> > > > image at the appropriate location means multithreading. So no need to
> > > > wait the user to load whole images.
>
> > > > I am trying through Handler() but it is also not working fine.
>
> > > > Please reply.
>
> > > > If further explanation needed than its welcome.
>
> > > > Thanks
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to