In my MainActivity class, I want to stop overriding the attachBaseContext
method if a button is pressed in my view.
Here's the situation:
public class MainActivity extends AppCompatActivity {
boolean value = true;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setting content view and stuff
}
//the following should be overridden only if value == true.
//I can change the value to false by clicking a button in my view.
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(ZeTarget.attachBaseContext(base,this));
}
public void stopOverriding (View view) {
value = false;
}
In my view, I have a button in my main activity layout which calls the stopOverriding()
method on getting clicked:
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/button"
android:onclick="stopOverriding"
android:text="@string/change"/>
I have the same overriding attachBaseContext()
method in all my activities. My question is, is it possible that after clicking the button in the Main Activity, I could stop overriding this attachBaseContext()
method in all my activities?