I've got a function:
public void vfShareQuote (String textToShare){
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, textToShare);
sendIntent.setType("text/plain");
startActivity(sendIntent);
}
Also there is a lot programmatically created buttons, that's 2 of them:
Button agafon_1 = new Button(this);agafon_1.setText(R.string.agafon_1);llPreViewList.addView(agafon_1, lParams);
Button agafon_2 = new Button(this);agafon_2.setText(R.string.agafon_2);llPreViewList.addView(agafon_2, lParams);
Here is the OnClickListener:
OnClickListener oclShareQuote = new OnClickListener() {
@Override
public void onClick(View v) {
//Set the text based on the selected button and send it to function vfShareQuote
switch (v.getId()) {
case R.string.agafon_1:
vfShareQuote(getResources().getText(R.string.name_agafon)+":\n"+getResources().getText(R.string.agafon_1));
break;
case R.string.agafon_2:
vfShareQuote(getResources().getText(R.string.name_agafon)+":\n"+getResources().getText(R.string.agafon_2));
break;
}
}
};
And of course:
agafon_1.setOnClickListener(oclShareQuote);
agafon_2.setOnClickListener(oclShareQuote);
But when you press the button - nothing happens. Why? Or is it programmatically create buttons? What to do? Translated by google.