0
Ich brauche eine Zeichenfolge, um meinen Code zu teilen ist unterhalb der Generierung eines Satzes nach dem Zufallsprinzip und kann nicht freigeben oder kopieren und fügen Sie die ausgewählte Phrase. Leider mein EnglischIch muss eine Phrase teilen, die nach dem Zufallsprinzip
public class MainActivity extends ActionBarActivity {
private TextView textViewNewId;
private Button buttonNewId;
private String[] frases = {
"First phrase", "second phrase", "third phrase"
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
textViewNewId = (TextView) findViewById(R.id.textViewNewId);
buttonNewId = (Button) findViewById(R.id.buttonNewId);
buttonNewId.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Random randomico = new Random();
int numeroAleatorio = randomico.nextInt(frases.length);
textViewNewId.setText(frases[ numeroAleatorio ]);
}
});
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View vivew) {
fab();
// Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
// .setAction("Action", null).show();
}
});
}
private void fab() { //sharing implementation here
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "AndroidSolved");
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Now Learn Android with AndroidSolved clicke here to visit ");
startActivity(Intent.createChooser(sharingIntent, "Share via"));
}