lost_bits1110
lost_bits1110

Reputation: 2420

NoSuchMethod exception for setShowDividers

I would like to display a sort of ListView with divider lines between each item. Because each row of this list will show a different custom view I thought it would be easier to have a TableLayout instead and use setShowDividers and SHOW_DIVIDER_MIDDLE in order to show that white line between each item.

Why do I get NoSuchMethod exception at setShowDividers?

 TableLayout table = (TableLayout)findViewById(R.id.my_table_layout);
 if( table != null )
 {
      table.setShowDividers(TableLayout.SHOW_DIVIDER_MIDDLE);
 }

I also get the same error if I cast everything to LinearLayout instead.

Upvotes: 2

Views: 1496

Answers (1)

Kevin Coppock
Kevin Coppock

Reputation: 134704

What API target are you using? setShowDividers was added in API level 11 (Honeycomb).

Upvotes: 3

Related Questions