I have a question in Android during creating my google-maps application.
I've one activity as below
public class MapCallActivity extends MapActivity {
classA class = new classA(this);
classA.callMethod();
}
The classA
is defined as below:
public class classA{
public classA(Context context){
this.myContext = context;
}
void callMethod(){
if (isFileValid) {
<do_something...>;
} else {
<call_the_activity's finish() method>;
}
}
}
Is there a way that I can do <call_the_activity's finish() method>
so that the MapCallActivity
closes?
Any help is appreciated!
public class classA{
public classA(Context context){
this.myContext = context;
}
void callMethod(){
if(isFileValid){
}else{
((Activity)myContext).finish();
}
}
}
What I usually do is to use a receiver within my activity and then trigger a broadcast from class B. Class A gets the broadcast and its onReceive handles the work. Say finish();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With