This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
////////////////////////////////////////////////////////////////////////////////////////////// | |
// in der Activity | |
////////////////////////////////////////////////////////////////////////////////////////////// | |
public class WoerterListe4Activity extends AppCompatActivity { | |
ListView lstVokabel; | |
private Datenbankzugriff datenbankzugriff; | |
private MyListAdapter myLA; | |
@Override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
////////////////////////////////////////////////////////////////////////////////////////////// | |
// in MainActivity | |
////////////////////////////////////////////////////////////////////////////////////////////// | |
public class MainActivity extends AppCompatActivity { | |
private TextView tv; | |
private ListView lv; | |
private ExpandableListView elv; | |
private String[] gruppen = {"Gruppe 1", "Gruppe 2", "Gruppe 3"}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
////////////////////////////////////////////////////////////////////////////////////////////// | |
// in Datenbankzugriff | |
////////////////////////////////////////////////////////////////////////////////////////////// | |
public class Datenbankzugriff extends SQLiteOpenHelper { | |
/** | |
* @param context Die Bezugsaktivity | |
* @param dbname Datenbank Name | |
*/ | |
public Datenbankzugriff(Context context, String dbname) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
..... | |
} catch (Exception ex) { | |
Toast t = Toast.makeText(context, ex.getMessage() + "Datei öffnen nicht möglich", Toast.LENGTH_LONG ); | |
t.show(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
////////////////////////////////////////////////////////////////////////////////////////////// | |
// MyListAdapter implements ListAdapter | |
////////////////////////////////////////////////////////////////////////////////////////////// | |
class MyListAdapter implements ListAdapter { | |
private ArrayList<Datensatz> eintraege; | |
private Context context; | |
public MyListAdapter(Context context) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
////////////////////////////////////////////////////////////////////////////////////////////// | |
// in MainActivity | |
////////////////////////////////////////////////////////////////////////////////////////////// | |
public class MainActivity extends AppCompatActivity { | |
private ListView lv; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
////////////////////////////////////////////////////////////////////////////////////////////// | |
// AndroidManifest.xml | |
////////////////////////////////////////////////////////////////////////////////////////////// | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="...."> | |
// WRITE_EXTERNAL_STORAGE permission is enough for both reading and writing | |
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> | |
// WRITE_EXTERNAL_STORAGE permission is enough for both reading and writing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private class myOCL implements View.OnClickListener { | |
@Override | |
public void onClick(View view) { | |
Intent myIntent; | |
switch (view.getId()) { | |
case R.id.btnWortPaar1: | |
myIntent = new Intent(MainActivity.this, WortPaar2Activity.class); | |
startActivityForResult(myIntent, 1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
////////////////////////////////////////////////////////////////////////////////////////////// | |
// in MainActivity | |
////////////////////////////////////////////////////////////////////////////////////////////// | |
private void activityMitUebergabe() { | |
Intent myIntent = new Intent(this, Activity2withUebergabe.class); | |
myIntent.putExtra("Maria's Lieblingsnummer", 4); | |
myIntent.putExtra("Wochentag", "Donnerstag"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
////////////////////////////////////////////////////////////////////////////////////////////// | |
// in Datenaustausch.java | |
////////////////////////////////////////////////////////////////////////////////////////////// | |
public final class Datenaustausch { | |
public static String nameSpieler = ""; | |
public static int anzahlVersuche = 0; | |
public static boolean gewonnen = false; | |
} | |
////////////////////////////////////////////////////////////////////////////////////////////// |