5. Fragments Tutorial Ipsum.java – Czech language
5. Fragments Tutorial Ipsum.java – Czech language
Dil 5. Ipsum.java
V 1. dílu jsme se něco dozvěděli od XML souborech a typu procesoru pro správný běh Android Studia a emulátoru různých typů zařizení s Androidem.
V 2. dílu jsme rozebrali MainActivity.java
V 3. dílu jsme se zabývali HeadlinesFragment.java
V 4. dílu jsme se podívali na ArticleFragment.java
V tomto dílu je na řadě Ipsum.java soubor.
Používáme příklad i zip porojekt z https://developer.android.com/training/basics/fragments/creating.html
Pozorně si jej nastudujte.
Dil 5. Ipsum.java
V 1. dílu jsme se něco dozvěděli od XML souborech a typu procesoru pro správný běh Android Studia a emulátoru různých typů zařizení s Androidem.
V 2. dílu jsme rozebrali MainActivity.java
V 3. dílu jsme se zabývali HeadlinesFragment.java
V 4. dílu jsme se podívali na ArticleFragment.java
V tomto dílu je na řadě Ipsum.java soubor.
Používáme příklad i zip porojekt z https://developer.android.com/training/basics/fragments/creating.html
Pozorně si jej nastudujte.
package com.example.android.fragments;
/** Ipsum je veřejná třída, která obsahuje
dvě pole řetězců - stringů.
Pole Headlines slouží jako uložiště pro názvy, které
budou načteny do ListView - seznamu v HeadlinesFragment.java
Pole Articles je v našem případě zásobárnou článků, které
budou načteny dle pozice položky ListView předané z HeadlinesFragment
zoětbě do MainActivity a
odtud do ArticleFragment.java, jako parametr metody
articleFrag.updateArticleView(position);
nebo jako argument Bundle
Bundle args = new Bundle();
args.putInt(ArticleFragment.ARG_POSITION, position);
Stringy - ukládat do souboru java je ošemetné (problémy s kódováním, vyhledávání výrazů atd.)
U většího množství článků pak nepřehledné.
Navíc, uživatel nemůže tento text editovat.
K ukládaní většího množství dat, k jejich vyhledávání
a editaci je lépe používat databáze.
*/
public class Ipsum {
static String[] Headlines = {
"Article One",
"Article Two"
};
static String[] Articles = {
"Article One
Excepteur pour-over occaecat squid biodiesel umami ... farm-to-table.",
"Article Two
Vinyl williamsburg non ... synth, vegan carles odd future."
};
}
396LW NO topic_id
AD
Další témata ....(Topics)
Basic difference remember it!!!
if(TRUE && TRUE && TRUE) return TRUE otherwise FALSE
if(FALSE || FALSE || FALSE) return FALSE otherwise TRUE
Logical operator and &&
If all conditions/operands is TRUE return TRUE, otherwise return FALSE
Logical operator or ||
The logical OR operator (||) returns the boolean value true if either or both operands is true and returns false otherwise.
If one operands is TRUE, condition is TRUE:
rev
if(TRUE && TRUE && TRUE) return TRUE otherwise FALSE
if(FALSE || FALSE || FALSE) return FALSE otherwise TRUE
Logical operator and &&
If all conditions/operands is TRUE return TRUE, otherwise return FALSE
if( true and true and true){
// return true - do something
}
int a = 6;
if(a == 6 && a == 6 ) {
// if TRUE
// true && true return true, do something
}
if(a == 6 && a == 5){
// nothing, not attended
}else{
// true && false return false, or false && false return false
// do something
}
Logical operator or ||
The logical OR operator (||) returns the boolean value true if either or both operands is true and returns false otherwise.
If one operands is TRUE, condition is TRUE:
if(FALSE OR FALSE OR TRUE) return TRUE
if(FALSE OR TRUE OR FALSE) return TRUE
if(FALSE OR FALSE OR FALSE) return FALSE
int a = 6;
if(a==6 || a==5){ // TRUE || FALSE return TRUE
//if return TRUE
//one from operadns is TRUE return true, do something
}
if(a==5 || a==4){ // FALSE || FALSE return FALSE
// not attended
}else{
//if return FALSE, do something
}
rev
If you change android:versionCode="224" and android:versionName="2.2.4" in AndroidManifest.xml you have to change this in build.gradle file too.
Click on build.gradle in package explorer tree change your new version name and code:
Click on build.gradle in package explorer tree change your new version name and code:
defaultConfig {
applicationId "cz.okhelp.pocasiwidget"
minSdkVersion 11
targetSdkVersion 23
versionCode 224
versionName "2.2.4"
}
Brand | Samsung |
Model (codename) | Galaxy Y (S5360) |
Cena, včetně DPH | 2400 / 06.2012 |
Display size (v palcích) | 3 |
Display-resolution | 240x320 |
Dotek-typ | kapacitní |
CPU typ | BCM21553 |
CPU MHz | 832 |
CPU core | |
L2 cache | ? |
RAM | 256 |
ROM | 512 |
GPU | VideoCore IV |
NenaMark2 Benchmark | 12 |
GPU-GLBenchmark | |
Baterie mAh | 1200 |
Foto MPx | 2 |
Autofocus | ne |
Video | |
Official Android ICS | Android OS v 2.3 |
CyanogenMod support | |
Dotek-prstů-max | |
Display-ppi | 133 |
Display-retina | 41% |
Network | čîtyřpásmový GSM 850/900/1800/1900 MHz , HSDPA 2100 MHz |
Connectivity | Bluetooth v2.0 plus EDR plus support A2DP, USB host |
Pozn. | CPU ARMv6, GPU 20MT/s OpenGL ES 2.0 |
String [] arOfStrings = {"one", "two", "three"};
List<String> mListOfStrings = new ArrayList<String>(Arrays.asList(arOfStrings));
Collections.shuffle(mListOfstrings);
String str = mListOfStrings.get(2);// 2 is index of pozition an element
int [] arOfInt = {1, 2, 3};
List<Integer> mListOfInt = new ArrayList<Integer>(Arrays.asList(arOfInt));
Collections.shuffle(mListOfInt);
Error for example:
webcoreglue(2075): The real object has been deleted
Solution:
If this error message shows if orientation the screen is changed
try insert into AndroidManifest.xml this code:
android:configChanges="keyboard|keyboardHidden|orientation"
webcoreglue(2075): The real object has been deleted
Solution:
If this error message shows if orientation the screen is changed
try insert into AndroidManifest.xml this code:
android:configChanges="keyboard|keyboardHidden|orientation"
<activity
android:label="@string/app_name"
android:name=".MyActivity"
android:screenOrientation="portrait"
android:configChanges="keyboard|keyboardHidden|orientation"
>
Editace: 2016-07-01 09:23:42
Počet článků v kategorii: 396
Url:5-fragments-tutorial-ipsum-java-czech-language