1. Download our Official Android App: Forums for Android!

Apps Playing sound when clicking on picture inside GridView

Discussion in 'Android Development' started by asgar.ali, Mar 26, 2011.

  1. asgar.ali

    asgar.ali Lurker
    Thread Starter
    Rank:
    None
    Points:
    25
    Posts:
    3
    Joined:
    Mar 26, 2011

    Mar 26, 2011
    3
    0
    25
    Hi,

    I am using a grid layout to display some gifs which have different sounds. I use this code to display the images. I can see all different images in a grid on the screen. Now what I want to do is to play sound on click of every picture. How can I do that? Can someone help me on that pls

    Thanks

    public​
    void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.
    main);
    GridView gridview = (GridView) findViewById(R.id.
    gridview);
    gridview.setAdapter(
    new ImageAdapter(this));

    }
     

    Advertisement

Share This Page

Loading...