java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.kailash.imagedownloader/com.kailash.imagedownloader.MainActivity}: java.lang.InstantiationException: can't instantiate class com.kailash.imagedownloader.MainActivity; no empty constructor
You should not create a constructor when extending Activity
. As the system invokes the empty constructor, and creating another one causes the class to not have an empty constructor.
There is also no need to create one, as you shouldn't instantiate an activity by yourself at all. For some reason you instantiate your activity inside onCreate
and cast it to ListAdapter
, which is an error:
gridview.setAdapter((ListAdapter) new MainActivity(this));
You should use a different class which extends ListAdapter
for this.