0
    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?
    }
4

1 回答 1

3

你是认真的吗?那种事情不能只是“抓住”......它们必须被修复。只需修复您的 XML 文件就可以了……捕获诸如 Exception 之类的没有意义;抓到之后怎么办?

于 2010-09-29T13:48:01.173 回答