invoke methods from enum defined in subclass – Java

I have an abstract class Sensor, which is extended by multiple Device sub-classes. Each sub-class defines an enum. These enums can be different for each Device object. These enums are used to define a status instance variable. I would like to find a way to define the getter method getStatus() in the parent (abstract) class so that I won’t have to reapeat the same lines of code in every subclass..

read more

invoke methods from enum defined in subclass – Java

I have an abstract class Sensor, which is extended by multiple Device sub-classes. Each sub-class defines an enum. These enums can be different for each Device object. These enums are used to define a status instance variable. I would like to find a way to define the getter method getStatus() in the parent (abstract) class so that I won’t have to reapeat the same lines of code in every subclass..

read more

Android add TableLayout and LinearLayout together?

I have a basic LinearLayout with a TableLayout and ImageView inside, i want to have the table at top then the picture at botton center, how can i fix this?
Thur the java code i add all the rows into TableLayout so want be seen here in the code.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="match_parent"
app:showAsAction="ifRoom">

<TableLayout
    android:id="@+id/Table"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:stretchColumns="1"
    android:shrinkColumns="0">
</TableLayout>

<!--<LinearLayout-->
    <!--android:layout_gravity="bottom"-->
    <!--android:id="@+id/secLayout"-->
    <!--android:orientation="vertical"-->
    <!--android:layout_width="wrap_content"-->
    <!--android:layout_height="wrap_content">-->

    <ImageView
        android:id="@+id/pic1"
        android:src="@mipmap/pic1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">
    </ImageView>

<!--</LinearLayout>-->

read more