Я программист на C и просто изучаю некоторые java недавно, потому что я разрабатываю одно приложение для Android. В настоящее время я в ситуации. Ниже приводится одно.Как распространять исключение в java
public Class ClassA{
public ClassA();
public void MyMethod(){
try{
//Some code here which can throw exceptions
}
catch(ExceptionType1 Excp1){
//Here I want to show one alert Dialog box for the exception occured for the user.
//but I am not able to show dialog in this context. So I want to propagate it
//to the caller of this method.
}
catch(ExceptionType2 Excp2){
//Here I want to show one alert Dialog box for the exception occured for the user.
//but I am not able to show dialog in this context. So I want to propagate it
//to the caller of this method.
}
}
}
Теперь я хотел использовать вызов метода MyMethod() где-то в другом классе. Если кто-то может предоставить мне некоторый фрагмент кода, как распространять исключения для вызывающего объекта MyMethod(), чтобы я мог отображать их в диалоговом окне метода вызывающего.
Извините Если я не настолько ясен и странный, чтобы задать этот вопрос.
См. Также http://stackoverflow.com/questions/409563/best-prac tices-за-исключением-управления-в-Java-или-C-резким – mglauche