Android - setOnClickListener for TextView

后端 未结 6 1972
孤街浪徒
孤街浪徒 2021-02-05 10:47

It should be straightforward, but I am not sure where something is wrong. I try to catch the click on the TextView with:

public void runNextTask(){
         


        
6条回答
  •  爱一瞬间的悲伤
    2021-02-05 11:40

    Change :

     TextView modelTextview = (TextView)addView.findViewById(R.id.modelEdit);
    

    to

     TextView modelTextview = (TextView)addView.findViewById(R.id.model);
    

    and there is no need of android:onClick="onClick" in your xml code if you want do this with java code

提交回复
热议问题