I m getting that error ,as you can see i m adding the data that i grabbed from the first activity and storing it into the my array in the second activity . Then i use the array to populate the list view .So the problem is whenever i click to the save button on the first view public class Main2Activity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
super.onCreate(savedInstanceState);
// setContentView(Your_Layout);
//Bundle extras = null;
//if(getIntent().getExtras() != null){
// extras = getIntent().getExtras();
//}
Intent intent = getIntent();
// ListView lv = (ListView) findViewById(R.id.View);
String data = intent.getStringExtra("data");
String first = intent.getStringExtra("stringOne");
String second = intent.getStringExtra("stringTwo");
String Third = intent.getStringExtra("stringThree");
String Fourth = intent.getStringExtra("stringFour");
String Fifth = intent.getStringExtra("stringFive");
String Sixth = intent.getStringExtra("stringSix");
// Find the ListView resource.
ListView lv = (ListView) findViewById( R.id.View );
// Create and populate a List of planet names.
String[] dataUser = new String[] { first,second,Third,Fourth,Fifth,Sixth};
ArrayList<String> dataList = new ArrayList<String>();
dataList.addAll(Arrays.asList(dataUser));
// Create ArrayAdapter using the planet list.
ArrayAdapter<String> listAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, dataList);
// Set the ArrayAdapter as the ListView's adapter.
lv.setAdapter(listAdapter);
}
}
You have 2 super.onCreate(savedInstanceState);
in your code, remove one of them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With