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

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 - ListView with different layouts per list entry

ListView with different layouts per list entry

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

ListView with different layouts per list entry

Postby tsucheck » Sat Jun 27, 2009 11:35 pm

Hello,

I've looked over the tutorials and can't seem to find the relevant info. I'm trying to duplicate similar setup as the default alarm clock in Android, where you add an alarm. It looks a lot like a customized ListView. Looking at the code it seems that you can apply a specific layout to a ListView, but it applies to all the entries in the ListView. Any idea how would one go about assigning different layouts to different entries in a ListView. For example one line that is just text, another that is text and on/off button.

Any pointers you could share are appreciated.

Thanks.

Tom
tsucheck
Developer
Developer
 
Posts: 29
Joined: Sun Feb 17, 2008 2:07 am

Top

Postby nmc » Sun Jun 28, 2009 12:33 am

Create your own BaseAdapter and overwrite getView() like this:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.                 public View getView(int position, View convertView, ViewGroup parent) {
  3.  
  4.                         MyListItem it = Items.get(position);
  5.  
  6.  
  7.  
  8.                         if (convertView == null) {
  9.  
  10.                                 convertView = MyInflater.inflate(/*layout based on current MyListItem*/, null);
  11.  
  12. ...
  13.  
  14.  
Parsed in 0.024 seconds, using GeSHi 1.0.8.4
nmc
Senior Developer
Senior Developer
 
Posts: 154
Joined: Thu Nov 27, 2008 8:30 pm
Location: Germany

Postby tsucheck » Sun Jun 28, 2009 12:56 am

Will do. Thank You..
tsucheck
Developer
Developer
 
Posts: 29
Joined: Sun Feb 17, 2008 2:07 am

Postby tsucheck » Sun Jun 28, 2009 12:57 am

Will do. Thank You..
tsucheck
Developer
Developer
 
Posts: 29
Joined: Sun Feb 17, 2008 2:07 am

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Exabot [Bot], MSNbot Media and 2 guests