我正在尝试创建一个Android应用程序,但我对全局变量" tmp2"的回复存在问题。 (字符串):我要检查tmp2,如果为了打破while循环,则为null。方法getInvisibleText
和getVisibleText
用于分割页面中的文本。我该怎么办?
public void setText (){
int i = 0;
tmp = stringResponse;
//Log.i("TMP", " 1 " + tmp);
final TextView tv = new TextView (this);
final PageTurnLayout flipper = (PageTurnLayout) findViewById(R.id.flipper);
while (i != 15){
tv.setTextSize(20);
tv.setPadding(7, 5, 5, 0);
tv.requestLayout();
tv.post(new Runnable() {
@Override
public void run() {
tv.setText(tmp);
tmp = getInvisibleText(tv);
tmp2 = getVisibleText(tv);
tv.setText(tmp2);
}
});
Log.i("ifNull", " "+ tmp2);
flipper.addView(tv);
i++;
}
}