public class MainActivity extends BaseActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
public class MainActivity extends BaseActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button button = findViewById(R.id.myButton); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // Do something when the button is clicked } }); } }In this example, BaseActivity's onCreate method is called, followed by setting the activity's layout using setContentView. A button is also added to the layout and given a click listener to perform an action when clicked. The package library associated with BaseActivity is typically android.app.Activity.