i followed numerous tuitorials like http://www.javacodegeeks.com/2013/09/android-listview-with-adapter-example.html Also followed the questions asked here How to make custom
Your code is running fine. I made it without Customadapter. All you need is below.
MainActivity.java
public class MainActivity extends Activity {
String[] web = {
"Notifications",
"School",
"What's Hot",
"Tell a friend",
"Hit us up",
"Settings",
"About & Help"
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_mainlist);
ArrayAdapter adapter = new ArrayAdapter(this,
R.layout.activity_listview, web);
ListView list = (ListView) findViewById(R.id.list);
list.setAdapter(adapter);
list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView> parent, View view,
int position, long id) {
switch(position){
case 0: Intent newActivity = new Intent(MainActivity.this, School.class);
startActivity(newActivity);
break;
}
}
@SuppressWarnings("unused")
public void onClick(View v){
};
});
}//end oncreate
}//endactivity
School.java
public class School extends Activity{
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.school);
Intent newActivity1=new Intent();
setResult(RESULT_OK, newActivity1);
//finish();
}
}
activity_mainlist.xml
activity_listview.xml
AndroidManifest.xml