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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:10:59+00:00 2026-05-27T21:10:59+00:00

I have the following LinearLayout with a GridView in it: <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=match_parent android:layout_height=match_parent

  • 0

I have the following LinearLayout with a GridView in it:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <GridView
        android:id="@+id/songs_grid"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:clickable="true"
        android:columnWidth="250dp"
        android:gravity="center"
        android:horizontalSpacing="10dp"
        android:numColumns="auto_fit"
        android:verticalSpacing="10dp" />

</LinearLayout>

The GridView data is supplied by a custom adapter (using a simple ViewHolder):

public class SongsAdapter extends BaseAdapter {

    private Context context;

    private LayoutInflater mInflater;

    private ArrayList<Song> songList;

    public SongsAdapter(Context context, ArrayList<Song> songList)
    {
        this.context = context;

        this.songList = songList;

        mInflater = LayoutInflater.from(this.context);
    }

    @Override
    public int getCount()
    {
        return songList.size();
    }

    public Object getItem(int position)
    {
        return songList.get(position);
    }

    public long getItemId(int position)
    {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent)
    {
        SongViewHolder viewHolder;

        if (convertView == null)
        {
            convertView = mInflater.inflate(R.layout.song_list_item, null);

            viewHolder = new SongViewHolder();

            //Get Views from Layout Template
            viewHolder.AlbumArt = (ImageView)convertView.findViewById(R.id.albumart);
            viewHolder.Title = (TextView)convertView.findViewById(R.id.title);
            viewHolder.Artist = (TextView)convertView.findViewById(R.id.artist);
        }
        else
        {
            viewHolder = (SongViewHolder) convertView.getTag();
        }

        Song song = songList.get(position);

        Bitmap bitmap = song.getAlbumArt();
        Bitmap missing = BitmapFactory.decodeResource(context.getResources(), R.drawable.albumart_missing);

        Bitmap albumArt = bitmap == null ? missing  : bitmap;

        viewHolder.AlbumArt.setImageBitmap(albumArt);
        viewHolder.Title.setText(song.getTitle());
        viewHolder.Artist.setText(song.getArtist());

        convertView.setTag(viewHolder);

        return convertView;
    }
}

When the app starts it gets a list of songs (from xml but currently using a manually entered list) and passes that to the my adapter and then sets the OnItemClickListener:

GridView gridView = (GridView) findViewById(R.id.songs_grid);
gridView.setAdapter(new SongsAdapter(this, fk.getSongList()));

gridView.setOnItemClickListener(new OnItemClickListener()
{
    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id)
    {
        LinearLayout layout = (LinearLayout)view;

        TextView songTitle = (TextView)layout.findViewById(R.id.song_title);

        Song song = fk.getSong((String) songTitle.getText());

        if(song != null)
        {
            Intent play = new Intent(getBaseContext(), Play.class);
            startActivity(play);
        }
    }
});

When I first implemented this code, it all worked fine, and I am sure I haven’t changed anything. I was trying to make the text for Song Title scroll in a marquee fashion if it was too long, but couldn’t get it working. During this phase I discovered that the click stopped working. I have now removed (I believe) all that code, but it still fails.

When I touch/click (whatever you call it) nothing happens. no errors nothing.

Is there anything wrong with my code that would cause this issue?

  • 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-27T21:10:59+00:00Added an answer on May 27, 2026 at 9:10 pm

    Check your item layout. If any of the song_list_item layout views are marked as clickable they will block the grid’s onclick listener from responding.

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

Sidebar

Related Questions

I have the following layout: <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:layout_height=wrap_content android:orientation=horizontal> <ImageView android:id=@+id/movie_icon android:src=@drawable/star_off android:layout_height=wrap_content
I have the following basic layout <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent> <LinearLayout android:orientation=horizontal android:layout_width=fill_parent
I have following layout in my android application. <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:id=@+id/mainlayout android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent
I have the following code: <ScrollView xmlns:android=http://schemas.android.com/apk/res/android android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent> <LinearLayout android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent>
Hello Android Experts, I have the following layout: <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:layout_height=wrap_content android:gravity=center_horizontal> <ImageButton
I have a very simple Activity with the following layout... <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:layout_height=fill_parent
Have the following view in my app: <TabHost xmlns:android=http://schemas.android.com/apk/res/android android:id=@android:id/tabhost android:layout_width=fill_parent android:layout_height=fill_parent> <LinearLayout android:orientation=vertical
I have the following View setup in one of my Activities: <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:id=@+id/photoLayout
I have the following layout <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=match_parent android:layout_height=match_parent android:orientation=horizontal android:background=#f00
I have the following XML layout for a ListActivity. <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android

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.