public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.students); ListView listView = (ListView) findViewById(R.id.listView10); LoginVO loginVO = LoginXMLStuff.loginVO; ArrayList<ChildVO> childList = loginVO.getChildVO(); String[] childName = new String[childList.size()]; for (int i = 0; i < childList.size(); i++) { childName[i] = childList.get(i).getFirstName() + " " + childList.get(i).getLastName(); } ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1, childName); listView.setAdapter(adapter); listView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Toast.makeText(getApplicationContext(), "This is the " + position + " student", Toast.LENGTH_LONG).show(); [ "value of position" from here to below activity] Intent reminder = new Intent(DisplayListForChild.this, ReminderActivity.class); reminder.putExtra("pos", position); startActivity(reminder); } }); } }
public class ReminderActivity extends Activity implements OnClickListener { protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.listview_screen); String logged = LoginXMLStuff.loginVO.getApplicationUserID(); String userType = LoginXMLStuff.loginVO.getUserType(); String userId = null; if (userType.equalsIgnoreCase("Parent")) { userId = LoginXMLStuff.loginVO.getChildVO().get(position).getUserId(); [ Here in get(position ) how to reference and get value of position from above activity?] } else if (userType.equalsIgnoreCase("Student")) { userId = logged; }
int position = getIntent().getIntExtra("pos", 0);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)