java - How to highlight an arraylist item when touched -
i'll appreciate if can me through this!
what did
1) draw shape canvas in view class.
2) create array lists of random numbers.
my problem
i want when each item of array list touched, gets highlighted.
i've searched lot can't find answer or question matched need!
i'm new in android.
here's part of code used creating array list of random numbers:
import android.content.context; import android.graphics.canvas; import android.graphics.color; import android.graphics.paint; import android.graphics.path; import android.util.attributeset; import android.view.motionevent; import android.view.view; import java.util.arraylist; public class yeknafareactivity_layout extends view { paint black_paintbrushstroke; path path = new path(); arraylist<integer> arraylist = new arraylist<>(); int rand; }
and in constructor:
public yeknafareactivity_layout(context context, attributeset atrs) { super(context, atrs); black_paintbrushstroke = new paint(); black_paintbrushstroke.setcolor(color.black); black_paintbrushstroke.setstyle(paint.style.stroke); black_paintbrushstroke.setstrokewidth(4); black_paintbrushstroke.settextsize(25); (int = 1; <= 10;) { rand =((int)(math.random() * 100)+1); if (!arraylist.contains(rand)){ arraylist.add(rand); i++; } } }
also, show arraylist drawtext well.
so should use ontouchevent solving problem or solution else? & how?
thanks.
Comments
Post a Comment