listactivity

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

listactivity

Postby android2 » Thu Oct 08, 2009 3:08 pm

I have this class


import android.app.ListActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;

public class Punti extends ListActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setListAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, posti));
getListView().setTextFilterEnabled(true);
}
static final String[] posti = new String[] {
"Bar","Ristoranti","Chiese"};

}

as do I assign a function to each button??
android2
Developer
Developer
 
Posts: 48
Joined: Sun Oct 04, 2009 8:34 pm

Top

Postby wiederke » Fri Oct 09, 2009 12:47 pm

Hi,

use the method ListView.setOnItemClickListener() to set an OnItemClickListener, which response to clicks on items.


Bye,

Torsten
wiederke
Experienced Developer
Experienced Developer
 
Posts: 72
Joined: Mon Mar 02, 2009 6:46 pm
Location: Germany

Postby sudheer1437 » Fri Oct 09, 2009 1:35 pm

Hi...

try using this method..
it works...

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. protected void onListItemClick(ListView parent, View v, int position, long id)
  2.  
  3. {
  4.  
  5.      \\Ur code
  6.  
  7. }
Parsed in 0.030 seconds, using GeSHi 1.0.8.4
sudheer1437
Experienced Developer
Experienced Developer
 
Posts: 79
Joined: Sat Aug 08, 2009 7:42 am
Location: India

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Majestic-12 [Bot], Yahoo [Bot] and 8 guests