Category Archives: Android Examples Code

83 views

EditText.setOnKeyListener not working on maxLines EditText

Check this in XML file if use singleLine singleLine change to maxLines (1 if singleLine) declare inputType android:maxLines="1" android:inputType="text"

Posted in Android Examples Code, Bugs, warnings, errors | Tagged , , | Comments Off on EditText.setOnKeyListener not working on maxLines EditText
82 views

ArrayList Sublist Join Compare Loop Synchronize HashMap Sort Tree

Link to tutorial ArrayList Sublist of ArrayList Join two ArrayList Compare ArrayList Initialize ArrayList Loop ArrayList Sort ArrayList Array to ArrayList ArrayList to Array Synchronize ArrayList Serialize ArrayList LinkedList Loop LinkedList Vector ArrayList vs Vector ArrayList vs LinkedList HashMap Loop … Continue reading

Posted in Android Examples Code | Tagged , , , , | Comments Off on ArrayList Sublist Join Compare Loop Synchronize HashMap Sort Tree
96 views

EditText hint not show

Try this solution – into xml file add row to EditText tag: android:textColorHint="@color/grey"

Posted in Android Examples Code, Bugs, warnings, errors | Tagged , , | Comments Off on EditText hint not show
155 views

Convert Activity to Fragment Step by Step

public class Main extends Activity {   private TextView mTextView; private Activity mAct; private Intent mIntent;   protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_layout); mTextView = findViewById(R.id.mTextView); mAct = getActivity(); mIntent = getIntent(); }   } to: public class Main … Continue reading

Posted in Android Examples Code, Fragments Tutorial | Tagged | Comments Off on Convert Activity to Fragment Step by Step
110 views

Android Fragment Examples

Code look up at the Api Demos android_fragments arguments attributes – three fragments on screen android_fragments_alert_dialog android_fragments_context_menu android_fragments_custom_animation android_fragments_dialog android_fragments_dialog_or_activity fragment_hide_show fragment_layout fragments_list_array fragment_menu android_fragments_get_result_from_fragment and tabs in two rows android_fragments_recive_result android_fragments_stack fragment_tabs

Posted in Android Examples Code, Android Studio, Fragments Tutorial | Tagged , | Comments Off on Android Fragment Examples
686 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
707 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
748 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
614 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
960 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