Ich habe ein Problem beim Festlegen der Dauer und Text auf meinem Toast. Ich habe Toasts in 3 meiner Aktivitäten und aus irgendeinem Grund passiert es nur in 1 von ihnen. Ich habe auch versucht, das Projekt umzubauen und zu säubern, und das hat nicht funktioniert. Hier ist der Code:Android: Symbol setDuration und Toast.LENGTH_LONG kann nicht aufgelöst werden
public class EconFragment extends AppCompatActivity {
private EditText userInputText = (EditText) findViewById(R.id.userInputText);
String userInput = userInputText.getText().toString();
final Toast firstToast = new Toast(this);
final Toast secondToast = new Toast(this);
firstToast.setDuration(Toast.LENGTH_LONG);
firstToast.setText("Correct");
secondToast.setDuration(Toast.LENGTH_LONG);
secondToast.setText("Incorrect");
private TextView definitionTextView = (TextView) findViewById(R.id.definitonTextView);
String definitionText = definitionTextView.getText().toString();
int value = (int)(Math.random() * 3);
}
'final Toast firstToast = Toast.makeText (das," Korrigieren ", Toast.LENGTH_LONG);' – NSimon
Cheers NSimon das funktioniert. –