Wie zu propagieren einer exception in java

Ich bin ein C-Programmierer sind und nur zu lernen, einige java vor kurzem, weil ich bin die Entwicklung einer android-Anwendung. Zurzeit bin ich in einer situation. Folgende ist die.

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.
   }
   }
}

Nun ich wan zu verwenden, rufen Sie die Methode MyMethod() irgendwo in einer anderen Klasse. Wenn jemand kann mir einige code-snippet zum weitergeben der exceptions an den Aufrufer des MyMethod (), so dass ich anzeigen können Sie in einem Dialogfeld in der Aufrufer-Methode.

Sorry, Wenn ich nicht so viel klar und seltsam in den Weg, diese Frage zu stellen.

Schreibe einen Kommentar