Question: I have an arraylist of "Swimmer" objects and I don't want it to delete every time the app closes. I have read about serialization and using shared preferences, but I have no idea where to write that code or what it does. 

The arraylist is currently stored as a public variable in the main activity class where it is accessed by the other activites. 

```
public ArrayList<Swimmer> allSwimmers = new ArrayList<Swimmer>();

```

This is the activity where I use a list view to display all of the swimmers in the list and when one of the swimmers is clicked it goes to a new activity to display the swimmers info.

Everything is fine I just would like to save "MyActivity.allSwimmers" (the arraylist) somewhere where when the app closes and restarts its not blank

```
public class AllSwimmers extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.all_swimmers);

        ListAdapter theAdapter = new ArrayAdapter<Swimmer>(this, android.R.layout.simple_list_item_1,
            MyActivity.allSwimmers);

        ListView theListView = (ListView) findViewById(R.id.allSwimmersList);

        theListView.setAdapter(theAdapter);

        theListView.setOnItemClickListener(new AdapterView.OnItemClickListener()
        {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id)
            {
                Intent goToIndiv = new Intent(AllSwimmers.this, IndivSwimmer.class);

                final int result = 1;

                goToIndiv.putExtra("position", position);

                startActivityForResult(goToIndiv, result);
            }
        });
    }
}

```

Answer: 
[Jenkins Gitlab Plugin](https://wiki.jenkins-ci.org/display/JENKINS/GitLab+Plugin) sends [these POST parameters](https://docs.gitlab.com/ce/user/project/integrations/webhooks.html) to Jenkins whenever any event occurs in the Gitlab repo.

You can add `env` in the Jenkins console to get what all Gitlab parameters are exported to the Jenkins environment. Then you can print or use the required variables.

e.g 

```
echo $gitlabSourceRepoURL
echo $gitlabAfter
echo $gitlabTargetBranch
echo $gitlabSourceRepoHttpUrl
echo $gitlabMergeRequestLastCommit
echo $gitlabSourceRepoSshUrl
echo $gitlabSourceRepoHomepage
echo $gitlabBranch
echo $gitlabSourceBranch
echo $gitlabUserEmail
echo $gitlabBefore
echo $gitlabSourceRepoName
echo $gitlabSourceNamespace
echo $gitlabUserName

```
Yes, I did it. And it works for some scenarios.

If you use /gitlab/buildnow, you can have access to payload objects. All of them.
But you have to name them under "this build is parametrized".
Then you can access them by name, like ${AUTHOR\_NAME}.

Doc: <https://github.com/elvanja/jenkins-gitlab-hook-plugin#parameterized-projects>

But please note that if you use /gitlab/notifycommit, it will not work, since there is a gap (the poll) between triggering jenkins, and actually starting the job. All payload data in this situation is empty.

But be carefull to use /gitlab/buildnow, because you cannot control if you want or not to build, like when Maven commit back some files, and build is not supposed to be triggered. 

What I did was to write a little tool in Python to receive all gitlab notification, and this tool talks back to GitLab and Jenkins, to fire (or not) jobs, and collect back statuses.

My start point:
[How do I receive Github Webhooks in Python](https://stackoverflow.com/questions/14536992/how-do-i-receive-github-webhooks-in-python) (last answer, not the choosen one).

I started developing it 2 days ago. It's done, but I am still validating it.