1
이름이있는 목록보기를 만들고 싶습니다. 각 이름을 클릭하면 나에게 다른 등급이 부여됩니다. 모든 선택 이름을ArrayListAdapter의 onListItemClick 안에있는 항목을 처리하는 방법은 무엇입니까?
public class StudentList extends ListActivity {
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
/**get the intent*/
Intent studentIntent = getIntent();
/**retrieve the string extra passed*/
ArrayList<String> nameRecd = studentIntent.getStringArrayListExtra("name");
ArrayList<String> gradeRecd = studentIntent.getStringArrayListExtra("grade");
try {
JSONArray jsonData = new JSONArray(getIntent().getStringExtra("data"));
Log.i("json review:", "Check out my JSON, looks like his JMother");
ArrayAdapter<String> adapter = new ArrayAdapter<String>
(this, android.R.layout.simple_list_item_1, nameRecd);
setListAdapter(adapter);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
String item = (String) getListAdapter().getItem(position);
int pos = position;
Toast.makeText(this, item + " selected" + "Grade:" , Toast.LENGTH_LONG).show();
}
}
그래서 내가 원하는 : 모든 이름과 등급 아라는 데이터베이스 촬영하여 의도와 활동을 통해 전달되는 JSON 형식으로 저장 특정 위치에 대해 토스트하거나 다룰 수 있어야만 특정 학생을위한 프로필을 만들 수 있고 학생 이름을 클릭하여 액세스 할 수 있습니다!
내가 정확한 문제 것이 아니다합니까 시작 해결 :) – agamov