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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:08:03+00:00 2026-06-15T15:08:03+00:00

So this is the deal, I have tried looking at other threads like this

  • 0

So this is the deal, I have tried looking at other threads like this one here
https://stackoverflow.com/questions/12479909/how-to-make-list-header-and-footer-not-click-able

But it doesn’t work. I can’t manage to “do nothing on click”.

But the problem is not to handle what hapens when the list is clicked, that is that the list is giving feedback as if its been clicked (I.E lights up), and I don’t want that.

I don’t understand why the part below doesn’t work (I.E it is still selectable/clickable)

ViewGroup footer = (ViewGroup)inflater.inflate(R.layout.listview_footer_row, null, false);//This is not working as it should
        listView.addFooterView(footer);

Anyone have any idea why my footer is clickable/selectable despite i add te false statment to the method?

Here is my code

import java.util.ArrayList;

import android.content.Intent;
import android.annotation.SuppressLint;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
import android.widget.ListView;

public class PortfolioFragMent extends Fragment{

    private ListView listView;
    private Button goButton;
    private String[] listheader = {"Idag","Senaste","Antal","Avkastning %","Avkastning","Tot Värde"};
    private static ShareHoldingAdapter adapter;
    private int totalElemInlist = listheader.length;
    private int currentelemInList=0;
    private ArrayList<ShareHolding> allShareHoldings = new ArrayList<ShareHolding>(); 
    private Button buyButton;

    @SuppressLint("NewApi")
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);


    }

    @SuppressLint({ "NewApi", "NewApi" })
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
        allShareHoldings = Portfolio.getPortfolio().getAllShareHoldings();

        super.onCreate(savedInstanceState);
        View view = inflater.inflate(R.layout.portfolioframe, container, false);    
        listView = (ListView)view.findViewById(R.id.listView1);
        String[] array = new String[] {"one", "two", "three"};
        /**********************************/
        adapter = new ShareHoldingAdapter(getActivity(), R.layout.listview_item_row, allShareHoldings); 
        /***********************************/

        ViewGroup header = (ViewGroup)inflater.inflate(R.layout.listview_header_row, null, false);
        ViewGroup footer = (ViewGroup)inflater.inflate(R.layout.listview_footer_row, null, false);//This is not working as it should
        listView.addHeaderView(header);
        listView.addFooterView(footer);

        goButton = (Button)view.findViewById(R.id.testButton);
        goButton.setText(listheader[currentelemInList]);

        listView.setAdapter(adapter);
        goButton.setOnClickListener(new OnClickListener() {
            public void onClick(View view) {
                String buttonPressed = (String) ((Button) view).getText();
                currentelemInList++;
                if(currentelemInList>=totalElemInlist){
                    currentelemInList=0;
                }
                adapter.setButtonPressed(currentelemInList);
                goButton.setText(listheader[currentelemInList]);
            }
        });

        listView.setOnItemClickListener(new OnItemClickListener() {
           public void onItemClick(AdapterView<?> adapter, View view, int position, long arg) {
               /*
                * Have to catch Nullpointer exception here since I have two elements in list plus 1 header and 1 footer.
                * When I click the footer I sent the number 3 to my next intent (4-1). But I don't want the footer to fire on click at all
                */
               if(position<Portfolio.getPortfolio().count()){//Just to check that I havn't clicked listFooter.
               System.out.println("Klicka i listan");
                Intent intent = new Intent(getActivity().getApplicationContext(),
                DetailShareHoldingActivity.class);
                intent.putExtra("new_variable_name","value");
                intent.putExtra("bookPositionInList",(position-1));//Just so that the top of the list is not clicked
                System.out.println(position);

                startActivity(intent);  
               }
           } 
        });

        buyButton = (Button)view.findViewById(R.id.buyNewShares);
        buyButton.setOnClickListener(new OnClickListener() {public void onClick(View view) {

            buyShares();

        }});
        return view;    
    }

    @SuppressLint({ "NewApi", "NewApi" })
    private void buyShares(){
            System.out.println("Köpt tryckt");
        Intent intent = new Intent(getActivity().getApplicationContext(),
                BuyNewSharesActivity.class);
                startActivity(intent);  
        }

    @SuppressLint({ "NewApi", "NewApi" })
    public void onListItemClick(ListView l, View v, int position, long id) {
        System.out.println("Klicka i listan");
        Intent intent = new Intent(getActivity().getApplicationContext(),
        DetailShareHoldingActivity.class);
        intent.putExtra("new_variable_name","value");
        intent.putExtra("bookPositionInList",position);
        startActivity(intent);  
    }
      public static ShareHoldingAdapter getPortfolioFragmentShareHoldingAdapter(){
            return adapter;
        }
}

And here is my listview_footer_row.xml file

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout  xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >
        <TableLayout
            android:id="@+id/book_detailTable"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_gravity="top"
            android:layout_weight="1"
            android:paddingTop="0dip" >
            <TableRow
                android:id="@+id/tableRow1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="top"
                android:paddingTop="0dip" >
                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:ems="10"
                    android:gravity="left"
                    android:text="Namn"
                    android:textColor="#ababab"
                    android:textSize="25dip" />
            </TableRow>
    </TableLayout>
</LinearLayout>
  • 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-15T15:08:04+00:00Added an answer on June 15, 2026 at 3:08 pm

    instead of using

    addFooterView(v) 
    

    use

    List.addFooterView(v, data, isSelectable);
    

    and set isselectable = false

    List.addFooterView(v, null,false);
    

    so your footerView is no longer selectable

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

Sidebar

Related Questions

I want to have URLs like this: some-company-name-deal-id-6.htm So the rewrite rule should ignore
I have been struggling with this for months in my project. Here's the deal:
I'm not quite sure the best way to deal with this situation. Here's a
The xml I want to deal with is like this (from an dict api).
Ive been looking at this for hours and I figure I'll ask here before
For some reason...maybe looking at too many different examples...this is one of those things
Looking at similar questions, I actually want the exact opposite of this: SQL query
I have been looking for a maximum entropy classification implementation which can deal with
I'm not sure how to specifically deal with this(new to Java). Basically I have
Version Dependent Some of the answers to this question deal with older versions of

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.