public abstract class BaseActivity extends Activity {
public static final String TAG = "Test";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(myView());
activityCreated();
}
public void printMessage(String message){
System.out.print(message);
}
public abstract int myView();
public abstract void activityCreated();
}
public class TestActivity extends BaseActivity {
@Override
public int myView() {
return R.layout.activity_main;
}
@Override
public void printMessage(String message) {
super.printMessage(message);
}
@Override
public void activityCreated() {
Log.i("TestActivity", "Created");
printMessage("Hello Hiren !!!");
}
}
No comments:
Post a Comment