I am trying to post in an ArrayList of strings from one activity to another when the option menu is pressed. However, when I try to `getIntent()` in the next page, it returns null value.

Option menu when item is selected code:

```
public boolean onOptionsItemSelected(MenuItem item) {
  if(item.getItemId()==2){
       ArrayList<String>data1=new ArrayList<>();
       data1.add("Hello");
       data1.add("bye");
       Intent i = new Intent(MainActivity.this,SecondActivity.class);
        i.putExtra("dataList",data1);
       startActivity(i);
   }
    return true;
}

```

Retrieve Data Activity :

```
public class SecondActivity extends AppCompatActivity {
ListView lListView;
ArrayAdapter<String> adapter;
Intent intent = getIntent();
ArrayList<String> data = intent.getStringArrayListExtra("dataList");

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_second);
   lListView = (ListView)findViewById(R.id.lListView);
    adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,data);
    lListView.setAdapter(adapter);
    }
}

```