Vorlesungen
  Download     DBS     Sprachen     Oberflächen     File Formats     Impressum     Datenschutz  
1. Sem
2. Sem
3. Sem
4. Sem
5. Sem
Android
iOS
Webprogrammierung
Web-Technologien
Wahlpflicht-SoSe
Wahlpflicht-WiSe
IEA-2019
Projektwochen
Allgemein:
Startseite
Vorlesungen
Labore
Sinnvolle Programme
Lineare Regression
GUI-Entwurfsarbeit
Single-Format
Design Pattern-Termine
Observer1
Bsp2
Json-Array
Json-Dialogelemente
Webtechnologien

Android

Snippets

ConstraintLayout

ConstraintLayout (Row_Layout)

Background setzen

Basis.java

Button

CheckBox

current date

Database

decimalformat

EditText

EditText TextColor

EditText readonly

EditText changeevent

Hide Tastatur

enum

GridLayout

LinearLayout, horizontal

LinearLayout, vertikal

ListView onClickListener

parseDouble

parseInt

RadioButton

random Zufallzahl erzeugen

Spinner

Switch

TabbedBar-Anleitung der Farbe

TableLayout

TextView

toast

log.i

uses-permission (Web)

ListView-Recycle.pdf

Android-Symbole.zip

Summary

Android-UI-Elemente.pdf




Handbuch

Skript / Handbuch:
Handbuch-Android-Programmierung.pdf (Stand 06.10.2021)
jetzt mit ListView+CheckBox, Swipe und SQLite
Neu:
- Dialolg-Alert

Alle Beispiele:
android.7z
Android-Einstiegsvideo
einfachesbeispiel.mp4 (Stand 27.04.2020)

Android-Drawable-Programme
Drawable-Progs.zip (Stand 01.06.2020)

drawable-Bilder

Vorlagen

Basis.java
Basis.txt

Semester Bilder

swipe-drawable.zip

AddFragment.java
SubFragment.java
MultFragment.java
fragment_add.xml fragment_sub.xml
fragment_mult.xml

ListView-Studenten.txt

Schriftgrößen:
android:textAppearance="?android:attr/textAppearanceSmall"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textAppearance="?android:attr/textAppearanceLarge"

Row-Layout mit Constraint-Layout für eine ListView:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:padding="1dp"
>
</androidx.constraintlayout.widget.ConstraintLayout>

Scripte

Chapter Script (Eine Folie pro Seite)
(Powerpoint)
Script (Zwei Folien pro Seite)
(Powerpoint)
Optional files
Introduction Einleitung.pdf Einleitung-2.pdf  
Language Java Java.pdf Java-2.pdf
Layout Layout.pdf Layout-2.pdf Android-RelativeLayout.pdf
UI-Elements     Android-UI-Elemente.pdf
Multi-Pages Beispiel7-MultiPages.pdf Beispiel7-MultiPages-2.pdf AndroidDrawable.zip

BottomAdd
I/O IO.pdf IO-2.pdf  
Databases database.pdf database-2.pdf haushaltsbuch.pdf


Button (code behind)

Studenten Bilder








Problems and solutions

Keywords Description Beschreibung Solution
RelativeLayout
Forward declaration
One need a reference before the ui-element are declared
sample:
<TextView
android:id="@+id/textview1"
/>
<EditText
android:id="@+id/edittextName"
android:layout_alignLeft="@id/edittextMatrnr"
/>
<TextView
android:id="@+id/textview2" />
<EditText
android:id="@+id/edittextMatrnr"
/>
Man braucht eine Referenz, die aber später deklariert wird.
Beispiel:
<TextView
android:id="@+id/textview1"
/>
<EditText
android:id="@+id/edittextName"
android:layout_alignLeft="@id/edittextMatrnr"
/>
<TextView
android:id="@+id/textview2" />
<EditText
android:id="@+id/edittextMatrnr"
/>
One must declare the reference as a "source":
You must insert a plus sign
False: @id/edittextEmployeeNo
Correct: @+id/edittextEmployeeNo

When you define the "source" you can delete the plus sign at the ui-element.
But you don't need it.

This is a tipp from Thomas Kuenneth
toast show a short message automatisch verschwindet a toast show a message only a fewe seconds.

Version a)
import android.widget.Toast;
Toast.makeText(MainActivity.this, "My Message", Toast.LENGTH_LONG).show();

Version b)
android.widget.Toast.makeText(MainActivity.this, "My Message", android.widget.Toast.LENGTH_SHORT).show();
android.widget.Toast.makeText(MainActivity.this, "My Message", android.widget.Toast.LENGTH_LONG).show();
setError error message How can I set a error-message? Wie kann ich eine Fehlermeldung ausgeben? edInput.setError(getString(R.string.wrongnumber));
edInput.setError("wrong number in the input");
Random number How can I create a random number? Wie erzeuge ich eine Zufallszahl? Random rand = new Random();
int zahl1 = rand.nextInt(50) + 1;
double zahl2 = rand.nextDouble(50) + 1;
string const String.xml How can I get a String from the file "String.xml"? Wie erhalte ich einen String von der Datei "String.xml"? XML-Layout
@string/caption

Java-File
getString(R.string.caption)
create a new activity how can I create a new activity? Wie kann eine neue Activity erzeugen? You should do it with the Android Studio:
Sequence:
1) start the dialog
- Menu "file"
- Item "new"
- Item "activity"
- choose the type of the activity:
-- Item "empty activity"
-- Item "bottombar activity"

newactitity1.png
show new activity how can I show a new activity? Wie kann ich eine zweite Activity (view) aufrufen? details
params new activity how can I set params for a new activity? Wie kann ich Parameter an eine neue Activity senden? send recive params
listview update notify how can I update the content of a listview? Wie kann ich den Inhalt einer Listview ändern? adapter.notifyDataSetChanged();
EditText
onChange
Event
How can I get an onChange event? Wie kann ich ein onChange-Event für eine EditText erzeugen? EditText-onChange-Event



Samples

Keywords Description Beschreibung Solution
URL run a url in a webbrowser with codebehind Starten einer Webadresser, url mittels Codebehind urllayout.txt
urljava.txt

In the layout, the url are saved in the "tag"-Attribut !

Pictures:
url1.jpg
url2.jpg
BottomNavigation
own drawable images
create a BottomNavigation
create a own BottomNavigation
Beispiel eines BottomNavigation
Nachbau eines BottomNavigation
BottomNavigationAddSubMultDivSqr
BottomNavigationAddSubMultDivSqr.7z
Properties:
- own drawable images
- inputtype number, numbersigned
Images:
BottomNavigationAddSubMultDivSqr01.png
BottomNavigationAddSubMultDivSqr02.png
BottomNavigationAddSubMultDivSqr03.png
BottomNavigationAddSubMultDivSqr04.png
BottomNavigationAddSubMultDivSqr05.png



Own Build BottomNavigationAddSubMultDivSqr
- create four buttons
- create the click-events
- insert the selected fragment
Own_BottomNavigationAddSubMultDivSqr.7z
Properties:
- own drawable images
- inputtype number, numbersigned
Images:
Own_BottomNavigationAddSubMultDivSqr01.png
Own_BottomNavigationAddSubMultDivSqr02.png
Own_BottomNavigationAddSubMultDivSqr03.png
Own_BottomNavigationAddSubMultDivSqr04.png
Own_BottomNavigationAddSubMultDivSqr05.png



drawable samples

Symbol Source
Add drawable addition symbol
    <path
        android:fillColor="#FF000000"
        android:pathData="M4,16 v-6h18v6h-18 M10,4v6h6v-6h-6 M10,16v6h6v-6h-6  z">
   
Sub drawable subtraction symbol
    <path
        android:fillColor="#FF000000"
        android:pathData="M4,15 v-6h18v6h-18 z" />
   
Mult drawable multiplcation symbol
    <path
        android:fillColor="#FF000000"
        android:pathData="M3,7 L9,12 L4,18 L8,22 L13,17  L18,21  L22,16 L17,12 L21,5 L17,2  L13,8  L7,3  z" />
   
Div drawable division symbol
    <path
        android:fillColor="#FF000000"
        android:pathData="M4,15 v-6h18v6h-18 M10,2v5h5v-5h-5 M10,17v5h5v-5h-5  z" />
   
Square drawable square symbol
    <path
        android:fillColor="#FF000000"
        android:pathData="M4,4 v18h18 v-18h-18 M18,8 v10h-10 v-10h10 z" />
   


Literatur

Android 7
Thomas Künneth
Rheinwerk-Verlag
ISBN: 978-3-8362-4200-4
Sehr umfassend und leichter Einstieg
Meine Referenz
Bild des Buches von Thomas Künneth

Android-Apps entwickeln für Einsteiger
Uwe Post Rheinwerk-Verlag
ISBN: 978-3-8362-4213-4
Guter Einstieg
Bild des Buches von Uwe Post

Android App Entwicklung Für Dummies
Michael Burton
Wiley-Verlag
ISBN 978-3-52771149-9
Bild des Buches von Michael Burton


Eigene Apps programmieren
Hauke Fehr
Rheinwerk-Verlag
ISBN: 978-3-8362-4380-3
Programmieren mit LiveCode
Bild des Buches von Hauke Fehr

Background setzen