I have a listview that receives user input from edit text in a different activity via key "hubahuba". When I click on the tap that contains this .class I receive the NullPointerException Error based on the logcat I know it has to do with my "String trackinput" Line PLEASE any help guys???
public static ArrayList<String> list = new ArrayList<String>();
public static ArrayAdapter<String> adapter;
LisstView lv;
String trackinput;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_argue_list);
//listViewCode
ListView lv = (ListView)findViewById(android.R.id.list);
//Intent to receive from other activity
Intent i = getIntent();
String trackinput = i.getExtras().getString("hubahuba");
//basic adapter
adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, list);
lv.setAdapter(adapter);
list.add(0, trackinput);
adapter.notifyDataSetChanged();
setListAdapter(adapter);
}
This is from activity 1 going to the listView in Activity 2:
public void onClick(View v) {
Intent i = new Intent(this, ArgueListActivity.class);
i.putExtra("hubahuba",whatedit.getText().toString());
whatedit.setText("");
}