how to work with this type button. if someone pressed the button it will put the string value for next activity and the value will be button name.
LinearLayout loj = (LinearLayout) findViewById(R.id.line);
LinearLayout.LayoutParams lparams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
for (int i = 0; i < eachname.length; i++) {
Button tv = new Button(this);
tv.setLayoutParams(lparams);
tv.setText(eachname[i]);
tv.setId(i);
loj.addView(tv);
} '