こんにちは、Android 2.3.3の使用中にこの例外が発生します:
android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
このメソッドで例外が発生します:(フラグメントを作成する場合)
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
if (container == null) {
// We have different layouts, and in one of them this
// fragment's containing frame doesn't exist. The fragment
// may still be created from its saved state, but there is
// no reason to try to create its view hierarchy because it
// won't be displayed. Note this is not needed -- we could
// just run the code below, where we would create and return
// the view hierarchy; it would just never be used.
return null;
}
try {
//exception here
theLayout = (LinearLayout) inflater.inflate(R.layout.fragment1, container, false);
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
return theLayout;
}
これは、Activityに移動し、FragmentActivityに戻ってタブを切り替えると発生します。
私はこれのために何をすべきですか?
ありがとう。