Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - How to setOnItemClickListener to GridView?

How to setOnItemClickListener to GridView?

Put your problem here if it does not fit any of the other categories.

How to setOnItemClickListener to GridView?

Postby sommeralex » Sun Mar 02, 2008 1:50 pm

Hello!

I have a GridView, which elements consist of a ViewGroup (in LinearLayout style)

My adapter is from type "baseAdapter" and holding my ViewGroup Elements.

if i make this


Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.  
  3.  
  4. GridView myGrid = new GridView(blabla);
  5.  
  6. MyCustomViewGroupView myView = new MyCustomViewGroupView (blabla Parameters);
  7.  
  8. myView.setOnClickListener(new OnClickListener() {
  9.  
  10.  
  11.  
  12. Log.i("TestMyView", "ok");
  13.  
  14.  
  15.  
  16. }
  17.  
  18.  
  19.  
  20. myGrid.add(myView);
  21.  
  22.  
  23.  
  24.  
Parsed in 0.010 seconds, using GeSHi 1.0.8.4


it works. but if i make this:


Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. myGrid.setOnItemClickListener(new OnItemClickListener(){
  3.  
  4.  
  5.  
  6.                         @Override
  7.  
  8.                         public void onItemClick(AdapterView arg0, View arg1, int arg2,
  9.  
  10.                                         long arg3) {
  11.  
  12.                                
  13.  
  14.                                 Log.i("Test", String.valueOf(arg2));
  15.  
  16.                                
  17.  
  18.                                
  19.  
  20.                         }});
  21.  
  22.  
Parsed in 0.010 seconds, using GeSHi 1.0.8.4


it doesnt work. ANY ideas? Do i have to implement on my Views (which i combine to the ViewGroup myView some kind of listeners also?)
sommeralex
Experienced Developer
Experienced Developer
 
Posts: 95
Joined: Sun Jan 20, 2008 3:12 am
Location: Vienna

Top

ItemClick in GridView

Postby smalltalk » Wed Mar 05, 2008 12:32 pm

Hello you,
Simple you only implement AdapterView and 'override' function
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public void onItemClickListener(AdapterView parent,View v,int pos,long id){
  2.  
  3.             //...
  4.  
  5. }
Parsed in 0.010 seconds, using GeSHi 1.0.8.4

with (View v) means each imageView in GridViews (I think GridView for ImageView is better) :D
smalltalk
Junior Developer
Junior Developer
 
Posts: 20
Joined: Tue Feb 12, 2008 3:34 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 15 guests