Your photoManagementLayout is null, it haven't been initialized.
Furthermore both of your classes are extending Activity, and you are using an Activity inside another one.
Activities are meant to be launched one after the other via intents, they are not normal classes that you can instantiate using the new key word.
So your problem here is more than a simple NullPointerException, you are misunderstanding the Android workflow.
Why don't you put your method code directly in the core of the PhotoManager activity ?
-----------------------------------------------
Just take your buildLayout method and put it in the PhotManagment Acticity directly, then call it in the onCreate, it should work
EDIT Here is a way to (more or less) decouple the method buildLayout from the activity :
public class PhotoManagementLayout {
public static View buildLayout(Context context){
ScrollView scrollView = new ScrollView(context); //create a new scrollView
scrollView.setBackground(context.getResources().getDrawable(R.drawable.background)); //give the background gradient
scrollView.setLayoutParams(new ScrollView.LayoutParams(ScrollView.LayoutParams.MATCH_PARENT, //set the main params about the dynamic size of the scrollView
ScrollView.LayoutParams.MATCH_PARENT));
scrollView.setPadding(0, 20, 0, 0);
return scrollView ;
}
}
And in the onCreate :
public class PhotoManagement extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(PhotoManagementLayout.buildLayout(this));
}
}