私のカスタムでは、指定された inViewGroup
に対して特定の数の文字列が必要です。array
arrays.xml
その条件が満たされない場合はアプリを停止してほしい。
これのベストプラクティスは何ですか?
IllegalStateException
からを投げるだけViewGroup constructor
ですか?
public MyViewGroup( Context context, AttributeSet attrs )
{
super( context, attrs );
if( getResources().getStringArray( R.array.carousellabels ).length != 7 )
throw new IllegalStateException( "There must exactly 7 items for
array resource R.array.carousellabels" );
}