Reputation: 4128
In my Android project I am using my custom Android library.
In this library I have defined followed Activity (part of the snippet):
public class MyLibAcitivity extends Activity {
int counter = 0;
int[] results = new int[2];
In the main project I would like to extend this Activity:
public class MainActivity extends MyLibAcitivity {
However, I am getting following error:
Implicit super constructor is undefined for default constructor. Must define an explicit constructor
How I can make it works?
On the other side, maybe I have not correct approach. What I want to achieve, is to have all logic of the application in library and extend few classes (activities) to use different "data source" - my data source is for now another Java class. So basically, in main class I just want to change source to the local one, instead of taking data from library.
Any thoughts?
Upvotes: 0
Views: 690
Reputation: 2519
add this to MyLibAcitivity
public MyLibAcitivity() {
// TODO Auto-generated constructor stub
super();
}
Upvotes: 2
Reputation: 39836
Must define an explicit constructor
if you're on Eclipse you right click on the class code -> Source -> Generate Constructor from Superclass.
Upvotes: 2