Button not responding in tab fragment - java

In my app, I have three tabs. In each tab, I have a few controls. When I tried to implement the onClick method for my buttons, I found the buttons not responding to hand gestures, more specifically, the clicks.
Here is the class for the tab:
package com.telkitty.myPetProject
import android.app.Activity;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.Toast;
import android.provider.Contacts;
import android.provider.ContactsContract;
public class ContactPage extends Fragment {
private static final int CONTACT_PICKER_RESULT = 1001;
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
Activity activity = getActivity();
if (activity != null)
{
addListenerOnButton();
}
}
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
View view = inflater.inflate(R.layout.contact_page, container, false);
return view;
}
public void onListItemClick(ListView l, View v, int position, long id) {
Activity activity = getActivity();
}
public void addListenerOnButton()
{
Button add = (Button) getView().findViewById(R.id.add_button);
add.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
Intent contactPickerIntent = new Intent(Intent.ACTION_PICK,
Contacts.CONTENT_URI);
startActivityForResult(contactPickerIntent, CONTACT_PICKER_RESULT);
}});
}
}
Here is the xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
android:id="#+id/edit_button"
android:layout_width="80dp"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_marginRight="10dp"
android:text="#string/edit_contact"/>
<Button
android:id="#+id/add_button"
android:layout_width="150dp"
android:layout_height="50dp"
android:layout_alignParentRight="true"
android:layout_marginLeft="10dp"
android:text="#string/add_contact"/>
<ListView
android:id="#+id/contact_list"
android:layout_width="320dp"
android:layout_height="380dp"
android:paddingTop="50dp" >
</ListView>
</RelativeLayout>
What have I done wrong?

Define your views in the onCreateView(..) of your Fragment and register the listeners as followed:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
View view = inflater.inflate(R.layout.contact_page, container, false);
Button lEditButton = (Button) view.findViewById(R.id.edit_button);
Button lAddButton = (Button) view.findViewById(R.id.add_button);
ListView lContactList = (ListView) view.findViewById(R.id.contact_list);
lEditButton.setOnClickListener(this);
lAddButton.setOnClickListener(this);
lContactList.setOnItemClickListener(this);
return view;
}
Implement the onClickListener and onItemClickListener interface:
public class ContactPage extends Fragment implements onClickListener, onItemClickListener {
By using these interfaces you will be forced to override the onClick(View v) and onItemClick(..) where you can handle your actions for the buttons and list.

Ok, it just happens my buttons were actually beneath the ListView, so although they looked as if they were there, everytime I clicked on them, the ListView was actually selected.
I added the marked line, now the button is working as it should.
public void addListenerOnButton()
{
Button add = (Button) getView().findViewById(R.id.add_button);
add.bringToFront(); // <--- this line
add.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
Intent contactPickerIntent = new Intent(Intent.ACTION_PICK,
Contacts.CONTENT_URI);
startActivityForResult(contactPickerIntent, CONTACT_PICKER_RESULT);
}});
}

Related

Method <...> is missing in <...> or has incorrect signature

I keep getting Method 'onClickGreeting' is missing in 'Home' or has incorrect signature warning in XML file and the app crashes when clicking on the button.
I tried doing Clean Project but nothing changed.
The method was created first manually, then I tried Android studio's fix:
This created an identical signature to the one I already wrote.
Home.java
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.navigation.fragment.NavHostFragment;
import com.example.apptest.databinding.HomeBinding;
public class Home extends Fragment {
private HomeBinding binding;
#Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState
) {
binding = HomeBinding.inflate(inflater, container, false);
return binding.getRoot();
}
public void onViewCreated(#NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
binding.btnShowRandomPhoto.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
NavHostFragment.findNavController(Home.this)
.navigate(R.id.action_FirstFragment_to_SecondFragment);
}
});
}
#Override
public void onDestroyView() {
super.onDestroyView();
binding = null;
}
public void onClickGreeting(View view) {
Context context = getContext();
CharSequence text = String.format(getResources().getString(R.string.greeting), binding.userName.getText());
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, text, duration);
toast.show();
}
}
home.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Home">
<Button
android:id="#+id/btn_generate_greeting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:onClick="onClickGreeting"
android:text="#string/button_show_greeting"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/user_name" />
</androidx.constraintlayout.widget.ConstraintLayout>
..........................................................................

How do I change the textview of a Fragment from WITHIN the fragment itself?

I have a MainActivity that creates 3 Fragments. Once I got into the first Fragment, I wish to change the Textview I have in the layout of THIS Fragment, from within this Fragment. I cannot see the 'findViewbyId' method popping up in the IDE when I try to access the TextView this way. Can someone please help me out? Here is the code for the Fragment which I want to carry out the operation in called 'FragmentOne'. The code is for 'FragmentOne.jav'
package com.iotaconcepts.aurum;
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;
import com.iotaconcepts.aurum.R;
import java.io.*;
import java.util.*;
public class OneFrangment extends Fragment
{
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
Fragment fc=getTargetFragment();
TextView tv=(TextView)fc.findViewById(R.id.textview);//NOT WORKING
try
{
BufferedReader br=new BufferedReader(new InputStreamReader(getActivity().getAssets().open("symp.txt")));
String parse1;
while((parse1=br.readLine())!=null)
{
Toast.makeText(getActivity(), parse1, Toast.LENGTH_LONG).show();
tv.setText(parse1 + "\n");
}
}
catch(Exception e)
{
tv.append("wtf\n");
Toast.makeText(getActivity(),"SORRY!", Toast.LENGTH_LONG).show();
}
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_one, container, false);
}
}
XML CODE:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="info.androidhive.materialtabs.fragments.OneFragment">
android:w
<TextView
android:id="#+id/textview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="Hello"
/>
You need to assign the inflater.inflate method to a View before you can find views from it.
View v = inflater.inflate(R.layout.fragment_one, container, false);
TextView tv=(TextView)v.findViewById(R.id.textview);
...
return v;

Android Eclipse setting on click listener error

I am new to android.. in a video tutorial I watch the guy writing a code and compiling it with no any error.. but when the same code I type gives me error.. don't know why..
Well.. Layout xml file is ok.. there is a error in java file.. whenever I add to a onclicklistener method to a button... it does not give any error in the code section but when I compile it it shows an error.. that application XXX has stopped unexpectedly. pleas try again.
code is here..
package com.abrosoft.trycommand;
import java.util.Random;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBar;
import android.support.v4.app.Fragment;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import android.os.Build;
import android.view.View.OnClickListener;
public class MainActivity extends ActionBarActivity {
EditText input;
TextView display;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment())
.commit();
}
Button cmd = (Button) findViewById(R.id.bCmd);
display = (TextView) findViewById(R.id.tvcmd);
input = (EditText) findViewById(R.id.etinput);
//if I delete this SetOnClickListener method.. it runs ok..
//I get xml layout on screen of emulator.. but with this method..it doesnot run
cmd.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
//even I write any lines of code which should perform any action on button
//click is giving same error
}
});
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
/**
* A placeholder fragment containing a simple view.
*/
public static class PlaceholderFragment extends Fragment {
public PlaceholderFragment() {
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_main, container, false);
return rootView;
}
}
}
here is my xml file code:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="25dp"
android:orientation="vertical"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context="com.abrosoft.trycommand.MainActivity$PlaceholderFragment" >
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="type a command"
android:id="#+id/etinput"
android:inputType="text"
/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="100"
>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/bCmd"
android:layout_weight="50"
android:text="Command"
/>
<ToggleButton
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/tgB"
android:layout_weight="50"
/>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/hello_world"
android:id="#+id/tvcmd"
/>
thanks in advance
Remove the condition
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment())
.commit();
}
Also remove the PlaceHolder Class
public static class PlaceholderFragment extends Fragment {
public PlaceholderFragment() {
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_main, container, false);
return rootView;
}
and change the setContentView() method of OnCreate(Bundle savedInstances) to
setContentView(R.layout.fragment_main);
Just Comment the below section in your code and then try to run.
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment())
.commit();
}
remove this
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment())
.commit();
}
from the onCreate(Bundle) method.
It will help
Put below code inside onCreateView
Button cmd = (Button) findViewById(R.id.bCmd);
display = (TextView) findViewById(R.id.tvcmd);
input = (EditText) findViewById(R.id.etinput);
//if I delete this SetOnClickListener method.. it runs ok..
//I get xml layout on screen of emulator.. but with this method..it doesnot run
cmd.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
//even I write any lines of code which should perform any action on button
//click is giving same error
}
});
Change onCreateView to:
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_main, container, false);
Button cmd = (Button) rootView.findViewById(R.id.bCmd);
display = (TextView) rootView.findViewById(R.id.tvcmd);
input = (EditText) rootView.findViewById(R.id.etinput);
//if I delete this SetOnClickListener method.. it runs ok..
//I get xml layout on screen of emulator.. but with this method..it doesnot run
cmd.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
//even I write any lines of code which should perform any action on button
//click is giving same error
}
});
return rootView;
}

How do I make this into one activity?

I'm doing this tutorial, but I'm having some trouble with understanding how to make this into one activity. (In the tutorial, you would have Main Activity and Display Message Activity, but for my purposes, I need it to be in one activity) I understand how everything works, but I just can't figure out how to make this into one activity. Any help is appreciated!
Here is the tutorial I'm working on: https://developer.android.com/training/basics/firstapp/building-ui.html
And I'll include my code below, but it's probably easier to see where I am in the tutorial (I'm at the step, "Starting Another Activity").
fragment_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<EditText android:id="#+id/edit_message"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:hint="#string/edit_message" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/button_send"
android:onClick="sendMessage" />
</LinearLayout>
MainActivity.java
package com.example.helloworld;
import android.app.Activity;
import android.app.ActionBar;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.content.Intent;
import android.os.Build;
public class MainActivity extends Activity {
public final static String EXTRA_MESSAGE = "com.example.myfirstapp.MESSAGE";
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (savedInstanceState == null) {
getFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment())
.commit();
}
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
/**
* A placeholder fragment containing a simple view.
*/
public static class PlaceholderFragment extends Fragment {
public PlaceholderFragment() {
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_main, container, false);
return rootView;
}
}
public void sendMessage(View view) {
Intent intent = new Intent(this, DisplayMessageActivity.class);
EditText editText = (EditText) findViewById(R.id.edit_message);
String message = editText.getText().toString();
intent.putExtra(EXTRA_MESSAGE, message);
startActivity(intent);
}
}
If you want to change the layout when a button is pressed and display hello world you can use your fragment PlaceholderFragment inside your MainActivity to display it
sample:
public void sendMessage(View view) {
getFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment())
.commit();
}
Fragment:
public static class PlaceholderFragment extends Fragment {
public PlaceholderFragment() {
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_main, container, false);
TextView tx = (TextView)rootView.findViewById(R.id.hello_world);
tx.setText(editText.getText().toString());
return rootView;
}
}
In your fragment_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/start_screen"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<TextView
android:id="#+id/hello_world"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="40sp"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>

How to make listFooter not clickable

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>
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

Categories