Cómo detectar excepciones causadas por un archivo de diseño en XML con formato incorrecto?
-
26-09-2019 - |
Pregunta
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?
}
Solución
¿En serio? Ese tipo de cosas no puede ser sólo " Catched " ... ellos tienen que ser fijos. Sólo arreglar el archivo XML y eso es todo ... que no tiene sentido para ponerse como excepción; ¿Qué haría después de la captura?
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow