게시판 즐겨찾기
편집
드래그 앤 드롭으로
즐겨찾기 아이콘 위치 수정이 가능합니다.
베이스어댑터에서 인텐트 못받나요??
게시물ID : programmer_18951짧은주소 복사하기
작성자 : 쉬룐
추천 : 0
조회수 : 502회
댓글수 : 9개
등록시간 : 2016/11/11 17:53:55
옵션
  • 본인삭제금지
 public View getView(final int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
Holder holder=new Holder();
View rowView;
rowView =
inflater.inflate(R.layout.program_list, null);
holder.
tv=(TextView) rowView.findViewById(textView1);
holder.
tv1=(TextView) rowView.findViewById(textView2);
holder.
img=(ImageView) rowView.findViewById(R.id.imageView1);
holder.
tv.setText(result[position]);
holder.
tv1.setText(result1[position]);
holder.
img.setImageResource(imageId[position]);
rowView.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
// Toast.makeText(context, "You Clicked "+result[position], Toast.LENGTH_LONG).show();



이 부분에 인텐트해서 다른 액티비티에 하고 싶은데 어댑터라 그런지 값을 못받네요..
다른 값은 textview를 가져오려는건데 어댑터에서 어떻게 선언해줘야할지 모르겠습니다...



Intent intent1=
new Intent(context, man_domi.class);


// intent.putextra("your_extra","your_class_value")
context.startActivity(intent1);
}
else if(position ==1){

Intent intent=
new Intent(context,woman_domi.class);
//intent.putextra("your_extra","your_class_value");
context.startActivity(intent);
}
else if(position ==2){
Intent intent=
new Intent(context,roop.class);
//intent.putextra("your_extra","your_class_value");
context.startActivity(intent);

}
}
});
return rowView;
}

}






A라는 곳에 getExtra되어있는 상태에서 다시 Put을 줘서 리스트뷰를 누르면 값이 이동하게 하려는건데
어댑터에 있는 if을 거쳐야 3가지중에 1개를 선택했을때 과정이 진행되는데 값을 못보내겠네요.ㅠㅠ

A에 있는
인텐트
 final Intent intent1 = getIntent();
// final Intent intent = getIntent();
String str0,str1,str2,str3;
str0 = intent1.getExtras().getString("date_result");
str1 = intent1.getExtras().getString("phone");
str2 = intent1.getExtras().getString("name");
str3 = intent1.getExtras().getString("username");
textView0 = (TextView)findViewById(R.id.text_reser_date) ;
textView1 = (TextView)findViewById(R.id.text_reser_phone);
textView2 = (TextView)findViewById(R.id.text_reser_name);
textView3 = (TextView)findViewById(R.id.text_reser_username);

textView0.setText(str0);
textView1.setText(str1);
textView2.setText(str2);
textView3.setText(str3);

// Intent intent2 = new Intent(Reservation3.this, man_domi.class);
// // intent1.putExtra("date",TxtResult1.getText().toString());
// intent2.putExtra("date_result", textView0.getText().toString());
// intent2.putExtra("phone", textView1.getText().toString());
// intent2.putExtra("name", textView2.getText().toString());
// setResult(RESULT_OK, intent2);
// startActivity(intent2);


A에서 그냥 줘버리면 리스트뷰가 무시되어 선택불가능..
A에서 어댑터로 주려면 오류가 뜸


A액티비티 > 어댑터 > B액티비티


B에서 받은 인텐트
final Intent intent2 = getIntent();
String str0,str1,str2;
str0 = intent2.getExtras().getString("date_result");
str1 = intent2.getExtras().getString("phone");
str2 = intent2.getExtras().getString("name");
textView0 = (TextView)findViewById(R.id.text_last_phone);
textView1 = (TextView)findViewById(R.id.text_last_phone);
textView2 = (TextView)findViewById(R.id.text_last_name);
textView0.setText(str1);
textView1.setText(str1);
textView2.setText(str2);
이건 오류가 없습니다.

꼬릿말 보기
전체 추천리스트 보기
새로운 댓글이 없습니다.
새로운 댓글 확인하기
글쓰기
◀뒤로가기
PC버전
맨위로▲
공지 운영 자료창고 청소년보호