게시판 즐겨찾기
편집
드래그 앤 드롭으로
즐겨찾기 아이콘 위치 수정이 가능합니다.
ㅁㄴㅇㅁㄴㅇ
게시물ID : databox_67724짧은주소 복사하기
작성자 : 쉬룐
추천 : 0
조회수 : 152회
댓글수 : 7개
등록시간 : 2016/11/11 18:49:21
A라고 했던 액티비티

public class Reservation3 extends AppCompatActivity {
TextView textView0,textView1, textView2, textView3;
ListView lv;
Context context;
Context mContext;

ArrayList prgmName;
public static int [] prgmImages={R.drawable.man_4,R.drawable.woman_4,R.drawable.roop};
public static String [] prgmNameList={"4인 남성도미","4인 여성도미","옥탑 트윈룸"};
public static String [] prgmsmallList={"1박 1인기준 25,000원","1박 1인기준 25,000원","1박 2인기준 50,000원"};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setContentView(R.layout.activity_reservation3);
context=this;

lv=(ListView) findViewById(R.id.listView);
lv.setAdapter(new CustomAdapter(Reservation3.this, prgmNameList,prgmsmallList,prgmImages));
// CustomAdapter adapter = new CustomAdapter(this);

// text_reser3 = (TextView)findViewById(R.id.text_reser3);


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);





}





}



--------------
커스텀어댑터

public class CustomAdapter extends BaseAdapter {
String [] result,result1;
Context context;
int [] imageId;
private static LayoutInflater inflater=null;
public CustomAdapter(Reservation3 mainActivity, String[] prgmNameList, String[] prgmsmallList, int[] prgmImages) {
// TODO Auto-generated constructor stub
result=prgmNameList;
result1= prgmsmallList;
context=mainActivity;
imageId=prgmImages;
inflater = ( LayoutInflater )context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}


@Override
public int getCount() {
// TODO Auto-generated method stub
return result.length;
}

// @Override
// public int getCount1() {
// // TODO Auto-generated method stub
// return result1.length;
// }


@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return position;
}

@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}

public class Holder
{
TextView tv,tv1;
ImageView img;
}
@Override
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();

if(position==0){
// ((Reservation3)Reservation3.mContext).startB();
// String str0,str1,str2,str3;
// Intent intent2 = context.getIntent();
// str0 = intent2.getExtras().getString("date_result");
// str1 = intent2.getExtras().getString("phone");
// str2 = intent2.getExtras().getString("name");
}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;
}

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