Q:

Creating an android custom view instead of multiple views with different data

I have 5 different views created in java classes. They consists of constructers, an init method which all constructers calls and then an onDraw method which draws a graph.
In each view, the init method and onDraw are loaded with different data as the graphs are not the same. But the init and onDraw is basically the same.
Can I create one custom view that could be reused instead?
Also in the views, there is a textview for each view. The textview are also very similiar, else than the data loaded into it in its java class, so is it also possible to create a custom
textview, used by the custom view? All the examples I have seen use a custom textview, doesn't have any difference in which data is being loaded and I have to determine which view is calling,
so that the right data is loaded.
Here are the example of the layout (With one 2 views included to simplify, also its cleaned from the unnecessary layout specific stuff):
<TableRow
    android:layout_width="match_parent" >
    <com.company.views.FirstView
        android:id="@+id/firstView"
        android:layout_height="match_parent" />
    <com.company.views.FirstTextView
        android:id="@+id/firstTextView"
        android:layout_height="match_parent"/>
</TableRow>
<TableRow
    android:layout_width="match_parent" >
    <com.company.views.SecondView
        android:id="@+id/secondView"
        android:layout_height="match_parent" />
    <com.company.views.SecondTextView
        android:id="@+id/secondTextView"
        android:layout_height="match_parent"/>
</TableRow>

Here are the example of one of the views (also scraped):
public class FirstView extends View {
  Paint paint;
  int y = 0;

  public FirstView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context, attrs);
  }

  private void init(Context context, AttributeSet attrs) {
        paint = com.company.helpers.Drawing.LineStyle("#00FF00", screenResolution.lineThickness); // <- the color is one of the differences for each view
  }

  @Override
  protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    y=GraphType.SpecificGraphType; // <- this is one of the other differences for each view

    // drawing part is irrelevant

    invalidate();
  }
}

Here are the example of one of the textviews:
public class FirstTextView extends AppCompatTextView {
    private string defaultText;

    public FirstTextView(Context context) {
        super(context);
        init(null, 0);
    }

    public FirstTextView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(attrs, 0);
    }

    public FirstTextView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        init(attrs, defStyle);
    }

    private void init(AttributeSet attrs, int defStyle) {
        textView = (TextView)findViewById(R.id.firstTextView);
        defaultText=Model.getInstance().SpecificGraphType; // <- this is one of the differences for each textview
    }
}

A:

Found out its acually working as it should but I had an minnor code mistake in a override of setText(). So if anybody whats to share a view, you can look at my example above.

