dimanche 25 septembre 2016

Generate random XML document

i try to create an app with some questions. I want button to generate random questions but I couldn't find anything so far (some shorter solution if possible). Thank you :)

something.java file code:

public class something extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.somethingXML);

}
public void generate (View view){
    Intent intent = new Intent(this, ???? .class);
    startActivity(intent);
}}

somethingXML.xml layout file code:

<Button
        android:layout_width="fill_parent"
        android:layout_height="30pt"
        android:text="@string/buttonM"
        android:id="@+id/buttonM"
        android:layout_marginTop="46dp"
        android:onClick="generate"
        android:clickable="true"
        android:textStyle="bold" />

Simply if I use button with id "generate", I want to generate it random xml page, but Intent(this, ???? .class) has only one option [example: Intent(this, question1.class)], but I do not want user to solve question1 page always he turns this app on.




Aucun commentaire:

Enregistrer un commentaire