Android : How I declare Textview variable

on Thursday, April 16, 2015


My question is how I declare Textview variable in javacode?


My code is here:



TextView tv1 = new TextView(MainActivity.this);


i want using tv1 in this function:



build.setPositiveButton("Tamam", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {

}


I try this code : tv1 = new TextView(MainActivity.this) but i had this issue:



Multiple markers at this line - Syntax error on token "new", delete this token - TextView cannot be resolved to a variable - The final local variable tv1 cannot be assigned, since it is defined in an enclosing type



0 comments:

Post a Comment