Issue
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!
Solution
public class classA{
public classA(Context context){
this.myContext = context;
}
void callMethod(){
if(isFileValid){
}else{
((Activity)myContext).finish();
}
}
}
Answered By - Changwei Yao
Answer Checked By - Marilyn (JavaFixing Volunteer)