سؤال

    public class MyActivity extends Activity {

        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);

            //R.layout.main has an illegal element (e.g. no layout_height attribute) 
            //But no exception is thrown at this line.
            setContentView(R.layout.main); 

        } //Exception will be thrown after this line. Where to catch it?
    }
هل كانت مفيدة؟

المحلول

هل أنت جاد؟ هذا النوع من الأشياء لا يمكن أن يكون فقط "تم اللحاق به"... يجب إصلاحها. فقط إصلاح ملف XML الخاص بك وهذا كل شيء ... ليس من المنطقي التقاط مثل الاستثناء ؛ ماذا ستفعل بعد اصطياده؟

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top