我有这个脚本.
我已经经历了堆栈溢出问题的许多变化,并使用解决方案尝试构建知识来做到这一点,但它似乎每次都失败,有人可以帮忙吗?
public class Main extends Activity implements OnClickListener {
private EditText value;
private Button btn;
private ProgressBar pb;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
value = (EditText) findViewById(R.id.editText1);
btn = (Button) findViewById(R.id.button1);
pb = (ProgressBar) findViewById(R.id.progressBar1);
pb.setVisibility(View.GONE);
btn.setOnClickListener(this);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
public void onClick(View v) {
// TODO Auto-generated method stub
if (value.getText().toString().length() < 1) {
// out of range
Toast.makeText(this, "please enter something", Toast.LENGTH_LONG)
.show();
} else …Run Code Online (Sandbox Code Playgroud)