-
Notifications
You must be signed in to change notification settings - Fork 444
Closed
Description
public abstract class ParentActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(getContentView());
findViewById(R.id.button_parent).setOnClickListener(view -> Toast.makeText(this, "Parent onClick", Toast.LENGTH_LONG).show());
}
public abstract int getContentView();
}
public class MainActivity extends ParentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
findViewById(R.id.button_child).setOnClickListener(view -> Toast.makeText(this, "Child onClick", Toast.LENGTH_LONG).show());
}
@Override
public int getContentView() {
return R.layout.activity_main;
}
}
Clicking on button_parent shows a Toast with "Child onClick"
test app: https://github.com/cpalasanu/RetrolambdaTest
Metadata
Metadata
Assignees
Labels
No labels