Category Archives: Android Examples Code

608 views

6. Fragments Tutorial Summary – Czech language

6. Fragments Tutorial Summary – Czech language Dil 6. shrnutí 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. – FrameLayout: můžeme měnit obsah … Continue reading

Posted in Android Examples Code, Fragments Tutorial | Tagged , , | Comments Off on 6. Fragments Tutorial Summary – Czech language
634 views

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 … Continue reading

Posted in Android Examples Code, Fragments Tutorial | Tagged , , | Comments Off on 5. Fragments Tutorial Ipsum.java – Czech language
675 views

4. Fragments Tutorial ArticleFragment.java – Czech language

Dil 4. ArticleFragment.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 … Continue reading

Posted in Android Examples Code, Fragments Tutorial | Tagged , , | Comments Off on 4. Fragments Tutorial ArticleFragment.java – Czech language
553 views

ListView set the item as checked to be highlighted

Important: Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB int layout = Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB ? android.R.layout.simple_list_item_activated_1 : android.R.layout.simple_list_item_1; getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE); getListView().setItemChecked(position, true); Example of usage:   public void updateList() { Context ctx = getActivity(); Notes notes = new Notes(ctx);   String[] from = { Notes.COLUMN_TITLE … Continue reading

Posted in Android Examples Code | Tagged , | Comments Off on ListView set the item as checked to be highlighted
910 views

ClassCastException fragments.MainActivity must implement OnHeadlineSelectedListener

Problem: You have two class with similar names HeadLinesFragment and HeadMyLinesFragment with OnHeadlineSelectedListener. Check if call correct class in MainActivity. For example if use HeadMyLinesFragment change implement to HeadMyLinesFragment too! public class MainActivity extends FragmentActivity implements HeadLinesFragment.OnHeadlineSelectedListener { // wrong … Continue reading

Posted in Android Examples Code, Bugs, warnings, errors | Tagged | Comments Off on ClassCastException fragments.MainActivity must implement OnHeadlineSelectedListener
829 views

View getId is null Android

If you create a button or view programmatically with OnClickListener you can set a tag key before button in parent layout is added. And get correct button by this tag getTag() instead getId() in OnClickListener etc. Button button = new … Continue reading

Posted in Android Examples Code | Tagged , | Comments Off on View getId is null Android
692 views

App have transparent menu Android

If the app have transparent menu and you do not want this, try delete @style/AppTheme in application tag in AndroidManifest.xml and try run module – project. If menu is not transparent , maybe it caused <application android:allowBackup="true" android:icon="@drawable/dicts_ico" android:label="@string/app_name" android:theme="@style/AppTheme" … Continue reading

Posted in Android Examples Code, Android Studio, Bugs, warnings, errors | Tagged | Comments Off on App have transparent menu Android
1,186 views

layout-sw600dp values-sw600dp Android example of use

Why the app selects data from basic layout folder if smallest width is higher then the number in folder name? Example 1 layout-sw600dp values-sw600dp (smallest width sw for data usage from this folder is 600dp density independent pixel!!!!!) Device screen … Continue reading

Posted in Android Examples Code | Tagged | Comments Off on layout-sw600dp values-sw600dp Android example of use
689 views

Center View in RelativeLayout Android

RelativeLayout like parent, child Srollview is centered horizontal. Second RelativeLayout in SrollView have gravity center, every child will centered horizontally and vertically. <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center_horizontal">   <ScrollView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/scrollView2" >   <RelativeLayout android:layout_width="320dp" android:layout_height="wrap_content" … Continue reading

Posted in Android Examples Code | Tagged | Comments Off on Center View in RelativeLayout Android
608 views

Android Studio gradle file comment same as java comment

// single line /* multi line */

Posted in Android Examples Code, Android Studio | Comments Off on Android Studio gradle file comment same as java comment