Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
card_view:cardCornerRadius="4dp"
android:layout_margin="5dp">
java.lang.NullPointerException
at android.support.v7.widget.RecyclerView.findMinMaxChildLayoutPositions(RecyclerView.java:3481)
at android.support.v7.widget.RecyclerView.dispatchLayoutStep1(RecyclerView.java:3226)
at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3122)
at android.support.v7.widget.RecyclerView.onLayout_Original(RecyclerView.java:3568)
at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java)
at android.view.View.layout(View.java:17520)
at android.view.ViewGroup.layout(ViewGroup.java:5612)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1079)
at android.view.View.layout(View.java:17520)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_timetables"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
public class Profile1Activity extends Activity {
//TextViews to show details of volume and brightness
private TextView tVBrightness, tVVolume;
//SeekBars to set volume and brightness
private SeekBar sbVolume, sbBrightness;
//AudioManager object, that will get and set volume
private AudioManager audioManager;
//Variable to store brightness value
private int brightness;
//Content resolver used as a handle to the system's settings
@Phantomazi
Phantomazi / gist:63293dcfe2fa48f6040dd2a718c4fe27
Created June 12, 2016 11:53
passing source id's in Android
//The call to the method requiring resource ids
setRoundCornersStyleFromTo(R.drawable.rounded_corners_orange, "#29B6F6");
//The actual method
private void setRoundCornersStyleFromTo(int resource, String color){
try {
//some code here
}catch (Exception e){
//some exception handling here
}