Horizontal progressbar with custom color

activity_main.xml <progressbar android:id="@+id/progressBar" style="?android:progressBarStyleHorizontal" android:layout_width="match_parent" android:layout_height="1dp" android:layout_margin="0dp" android:max="100" android:padding="0dp" tools:progress="40" android:progressDrawable="@drawable/progress_drawable" app:layout_collapseMode="pin"/> MainActivity.java ProgressBar mProgressBar = (ProgressBar) findViewById(R.id.progressBar); //somewhere when scrollin mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(RecyclerView recyclerView, int…

Create text for empty listView

RelativeLayout lContainerLayout = new RelativeLayout(this); lContainerLayout.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.FILL_PARENT)); TextView textView = new TextView(this); textView.setText("List is empty!"); RelativeLayout.LayoutParams lButtonParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); lButtonParams.addRule(RelativeLayout.CENTER_IN_PARENT); textView.setLayoutParams(lButtonParams); lContainerLayout.addView(textView); addContentView(lContainerLayout, new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.FILL_PARENT)); listView.setEmptyView(lContainerLayout);

Pretty way for serialization files

Found here: http://stackoverflow.com/a/4118917/619673 Saving (w/o exception handling code): FileOutputStream fos = context.openFileOutput(fileName, Context.MODE_PRIVATE); ObjectOutputStream os = new ObjectOutputStream(fos); os.writeObject(this); os.close(); fos.close(); Loading (w/o exception handling code): FileInputStream fis = context.openFileInput(fileName);…