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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:24:43+00:00 2026-06-16T17:24:43+00:00

how to display images from internet to gridview in android application.after display clicl om

  • 0

how to display images from internet to gridview in android application.after display clicl om any image in gridview it will display full screen image after swipe left to right and right tp left.already i implemented some code, one error is there. after display fill image how to swipe those images.

ImageAdapter

public class ImageAdapter extends BaseAdapter {
    private Context mContext;

// Keep all Images in array
public Integer[] mThumbIds = {
        R.drawable.img_2, R.drawable.img_3,
        R.drawable.img_4
};

// Constructor
public ImageAdapter(Context c){
    mContext = c;
}

@Override
public int getCount() {
    // TODO Auto-generated method stub
    return mThumbIds.length;
}

@Override
public Object getItem(int position) {
    // TODO Auto-generated method stub
     return mThumbIds[position];
}

@Override
public long getItemId(int position) {

    return 0;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ImageView imageView;
    if (convertView == null) {  
     imageView = new ImageView(mContext);
    //imageView.setImageResource(mThumbIds[position]);
    imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
    imageView.setLayoutParams(new GridView.LayoutParams(70, 70));
    } else {
        imageView = (ImageView) convertView;
    }
    imageView.setImageResource(mThumbIds[position]);
    return imageView;
}
}

FullImage:

public class FullImageActivity extends Activity {


 private static final String LOGID = "CHECKTHISOUT";

private static final int SWIPE_MIN_DISTANCE = 160;
private static final int SWIPE_MAX_OFF_PATH = 250;
private static final int SWIPE_THRESHOLD_VELOCITY = 200;
private GestureDetector gestureDetector;

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.full_image);

     // get intent data
    Intent i = getIntent();

    // Selected image id
    int position = i.getExtras().getInt("id");
    ImageAdapter imageAdapter = new ImageAdapter(this);

    ImageView imageView = (ImageView) findViewById(R.id.full_image_view);
    imageView.setImageResource(imageAdapter.mThumbIds[position]);

    gestureDetector = new GestureDetector(new MyGestureDetector());
}
private class MyGestureDetector extends SimpleOnGestureListener {
    @Override
    public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
                float velocityY) {
        try {
            if (Math.abs(e1.getY() - e2.getY()) > SWIPE_MAX_OFF_PATH)
                return false;
            // right to left swipe
            if (e1.getX() - e2.getX() > SWIPE_MIN_DISTANCE
                    && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {
                next();
            } else if (e2.getX() - e1.getX() > SWIPE_MIN_DISTANCE
                    && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {
                previous();
            }
        } catch (Exception e) {
            // nothing
        }
        return false;
    }
    public void next()
    {

    }
    public void previous()
    {

    }
}
}
  • 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-16T17:24:44+00:00Added an answer on June 16, 2026 at 5:24 pm

    You can show images in gridview and then you can use viewpager to display full-screen images with swipe.
    I would suggest you to reuse the images rather than downloading them each time from internet.you can utilize the available libraries like https://github.com/nostra13/Android-Universal-Image-Loader and it will handle the cache mechanism for you.

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

Sidebar

Related Questions

I am trying to display image from internet in a Gridview. When I am
I am developing an image gallery application .. Its loading images from the internet..
I had developed an application in which I have to display images from specific
I have a Rails 3 application that needs to display images from another application.
From any specific Post, I am trying to display all images, with their corresponding
I'm working on Android application which is taking content from internet using JSON, I
I wanna display a image from the internet how can I put it?
I want to display multiple images in a view. Images are downloaded from internet
I am using following example to display internet images in my activity. http://developer.android.com/resources/tutorials/views/hello-gridview.html In
I'm using GridView to display a list of ImageView s. Images are loaded from

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.