ViewHolder holder = null;
if (convertView == null) {
LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = vi.inflate(R.layout.row_ten_words,null);
holder = new ViewHolder();
holder.txtSrc = (EditText) convertView.findViewById(R.id.txt_src_word);
holder.btnTranslate = (Button) convertView.findViewById(R.id.btn_translate);
holder.txtDes = (EditText) convertView.findViewById(R.id.txt_des_word);}`
Here , I want to use my RelativeLayout that I have created programmatically in place of R.layout.row_ten_words
Code that I want to use is:
` EditText txtSrc=new EditText(this);
EditText txtDes=new EditText(this);
Button btn_translate=new Button(this);
translate.setText("translate");
rl=new RelativeLayout(this);
rl.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.WRAP_CONTENT));
rl.addView(txtSrc);
rl.addView(btn_translate);
rl.addView(txtDes);`
I am totally new to android but know JAVA well. Please suggest me something if I am wrong in my approach.
Thanks in advance.