How to use the variable of one method in another method in Java(android) -
i retrieving value of textview protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.calculation); textview heading = (textview) findviewbyid(r.id.paper_name); ...... } i have method in same class @override public void onclick(view v) { int black_and_white_multiuplier = 4200; int color_multiuplier = 6400; switch (v.getid()) { case r.id.btcalculate: int multiplier = rbcolor.ischecked() ? color_multiuplier : black_and_white_multiuplier; int column = integer.parseint((string) spcolumn.getselecteditem()); int inch = integer.parseint((string) spinch.getselecteditem()); tvamount.settext((multiplier * column * inch) + ""); break; } } i want set value of color_multiuplier , black_and_white_multiuplier based on value of heading have got oncreate method. possible? declare textview @ class level... textview heading; pro...