Я программист на C и только недавно изучил немного java, потому что разрабатываю одно приложение для android. В настоящее время я нахожусь в ситуации. Ниже приведена ситуация.
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(), чтобы я мог отобразить их в диалоговом окне в вызывающем методе.
Извините, если я не очень понятно и странно задаю этот вопрос.