*********************************************************************************************** colors #6200EE #3700B3 #03DAC5 #FFE57F #FF9E80 #CCFF90 #7F7FFF *********************************************************************************************** strings Studierenden Verwaltung 1. Semester 2. Semester 3. Semester 4. Semester 5. Semester 6. Semester >6. Semester Bachelorarbeit Status-Grafik Neu Delete Light Style Dark Style Bearbeiten eines Studenten Löschen eines Studenten Neuer Studenten Fehlerhafte Aktion Bitte ein Semester auswählen Bitte eine Note auswählen Name Matrnr Semester Note Löschen Neu Speichern Abbrechen 1. Semester 2. Semester 3. Semester 4. Semester 5. Semester 6. Semester Bachelorarbeit Dauerstudent *********************************************************************************************** menu *********************************************************************************************** rowlayout *********************************************************************************************** StudentenListe private void initListe() { Log.i(TAG, "######################################################## in initListe "); liste.clear(); liste.add( new Student("Meier, Antonia", 12345, 8, 1.0) ); liste.add( new Student("Schulze, Susanne", 12365, 6, 2.3) ); liste.add( new Student("Brandt, Hugo", 22345, 6, 3.3) ); liste.add( new Student("Binder, Gabi", 22365, 6, 4.0) ); liste.add( new Student("Märtens, Friedrich", 22845, 5, 1.7) ); liste.add( new Student("Müller, Andreas", 22349, 5, 1.3) ); liste.add( new Student("Baumann, Herbert", 20445, 7, 2.7) ); liste.add( new Student("Künneth, Thomas", 324455, 4, 3.3) ); liste.add( new Student("Unbereit, Peter", 324355, 7, 2.7) ); liste.add( new Student("Meyer, Hubert ", 324355, 3, 2.0) ); liste.add( new Student("Altmeier, Jutta", 324355, 3, 3.3) ); liste.add( new Student("Gisin, Nicoletta", 33445, 2, 2.7) ); liste.add( new Student("Telemann, Dieter", 34645, 2, 5.0) ); liste.add( new Student("Wagner, Hans", 38345, 2, 4.0) ); liste.add( new Student("Wolff, Bernd", 39345, 1, 3.7) ); liste.add( new Student("Prandtl, Daria", 40345, 1, 1.3) ); liste.add( new Student("Burton, Michael", 41445, 1, 3.0) ); liste.add( new Student("Fehr, Hauke", 42445, 1, 2.0) ); liste.add( new Student("Klenke, Mario", 44445, 1, 3.7) ); Log.i(TAG,"******************************** Modul Studenteliste,anzahl Studierende: "+liste.size()); } *********************************************************************************************** Basis.java import android.content.Context; import android.widget.EditText; import android.widget.Toast; import java.io.*; public class Basis { public static boolean FileExists(Context context, String filename) { try { FileInputStream fin = context.openFileInput(filename); fin.close(); return true; } catch (IOException e) { return false; } } public static void showToast(Context context, int stringid) { Toast.makeText(context, context.getString(stringid), Toast.LENGTH_SHORT).show(); } public static void showToast(Context context, String text) { Toast.makeText(context, text, Toast.LENGTH_LONG).show(); } // wandelt einen String in eine double zahl um // bei Fehler wird double.NaN zurückgegeben public static double getDoubleNumber(String input) { try { return Double.parseDouble(input); } catch (NumberFormatException e) { return Double.NaN; } } /* Abfrage: if (Double.isNaN(tzahl.getText().toString())) { // hier ist ergebnis NaN !! tergebnis.setText("-"); } String dummy = tzahl1.getText().toString(); // nur ascii-text keine Zahl!! double zahl1 = Basis.getDoubleNumber(dummy); if (!Double.isFinite(zahl1)) { tverror.setText("Fehlerhafte 1. Zahl"); tergebnis.setText("-"); return; } */ public static Double getDoubleNumber(EditText tInput, String errortext) { try { String s= tInput.getText().toString(); double zahl = Double.parseDouble(s); return new Double(zahl); } catch (NumberFormatException e) { tInput.setError(errortext); return Double.NaN; } } public static Integer getIntegerNumber(String input) { try { int zahl = Integer.parseInt(input); return new Integer(zahl); } catch (NumberFormatException e) { return null; } } public static Integer getIntegerNumber(EditText tInput, String errortext) { try { String s= tInput.getText().toString(); int zahl = Integer.parseInt(s); return new Integer(zahl); } catch (NumberFormatException e) { tInput.setError(errortext); return null; } } }