I have a listview and when it clicks on a certain option I want it to create a new intent. Like a menu item. This is my first time working with list views, so I'm probably just missing the right way to do this, but is there an easy fix?
private void registerClickCallback() {
ListView list = (ListView) findViewById(R.id.mainlist);
list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View viewClicked, int position, long id) {
TextView textView = (TextView) viewClicked;
Toast.makeText(main.this, position, Toast.LENGTH_SHORT).show();
if(textView.getText().toString() == "my Profile"){
Intent intent = new Intent(this.getApplicationContext(), myProfile.class);
startActivity(intent);
}
}
});
cannot resolve method 'getapplicationcontext'