خرید بک لینک

Vote count: 0

I created a class that extends View, and I have a class, where MainActivity called the View. How I can change my listview, depending on what throws me my view class ?. code:

this is part of my view class:

public class ViewClass extends View {
//...
        if (recognitionPlane(touchX, touchY) == 1)
            {
                listview = "Text to set in listview of activity class";

            }
}

When the method retus 1, I want to change my listview depending on what throws me the viewclass

and this is my activityclass:

public class MainActivity extends AppCompatActivity{
    @Override
    protected void onCreate(Bundle savedInstanceState) {

        viewclass = (ViewClass) findViewById(R.id.viewclass);
        TextView txtview = (TextView)findViewById(R.id.txtview);
        txtview.setText("text to receiver of view class")

    }
    //...

}

layout file:

   <... views.View
    android:id="@+id/viewclass"
    android:layout_width="fill_parent"
    android:layout_height="405dp"
    android:layout_marginBottom="3dp"
    android:layout_marginLeft="5dp"
    android:layout_marginRight="5dp"
    android:layout_marginTop="3dp"
    android:background="@drawable/...">
</... views.View>

        <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="4dp"
        android:text="Text viewclass"
        android:id="@+id/txtview" />

Thanks in advance for the help!!

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 4 مرداد 1395 ساعت: 7:16

صفحه بندی