I would like to make an album and add some music files when my android app is first installed on a device. Is there a way is can do something like below?
public void onInstall(){
setup();
}
You can't do anything after the app is installed, only after it is run.
Just store a flag in your SharedPreferences to see whether or not it has done its first-time install process already and then perform it, or, if you're installing music files, check for their existence and install them if they're not there yet.
There's no way to know when your app is installed... however, you can detect when it's first launched. It has been discussed a lot of times here. You just need to persist it using a shared preference.
here comes the answer ;-)