I have a class
which does not extend Activity
. And in that class, I use a try-catch
block to catch exceptions
. How can I pass any exceptions (the Exception e
) caught in that block to another Activity
? My application checks with a boolean flag
to display a toast message
. But how do I pass this message to another activity?
public class AgAppHelperMethods {
private static AgAppHelperMethods instance = null;
static boolean flag=true;
public static String[][] AgAppXMLParser( String parUrl) {
String _node,_element;
String[][] xmlRespone = null;
try {
String url = www.xyz.com
URL finalUrl = new URL(url);
catch (Exception e)
{
flag=false;
Log.e( "CONNECTION ERROR SERVER NOT RESPONDING", e);
}
public class LoginScreen extends Activity implements Serializable {
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.agapplogin);
btnClear.setOnClickListener(new OnClickListener() {
public void onClick(View v)
{
postLoginData();
}
});
public void postLoginData()
{
xmlRespone = AgAppHelperMethods.AgAppXMLParser( url);
if(!AgAppHelperMethods.flag)
{
Toast.makeText(getApplicationContext(), "Error server
not responding " , Toast.LENGTH_SHORT).show();
myProgressDialog.dismiss();
}