I m still learning and I ve tried to figure this out and I figured I d ask the experts. Any ideas?
I get the error on this line: final Button btn = (Button) findViewById ([btnIds]);
public class choiceTest extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.atcchoice);
}
final OnClickListener listener = new OnClickListener() {
public void onClick(View v){
switch(v.getId()){
case R.id.sec1:
break;
case R.id.sec2:
break;
case R.id.sec3:
break;
}
}
};
final int[] btnIds = new int[]{R.id.sec1, R.id.sec2, R.id.sec3};{
for(int i = 0; i < btnIds.length; i++) {
final Button btn = (Button) findViewById ([btnIds]);
btn.setOnClickListener(listener);
}
}
}
此外,这是下载方案,我正在利用阿因奇下载我的档案。 我可以对上述法典作什么补充,把我的下载者URL改为另一个下载? 否则,我将有很长的法典...... 这里是如何下载《URL法》。
private void startDownload() {
DownloadFile downloadFile = new DownloadFile();
downloadFile.execute("http://www.website.com/document.pdf");
}
The async code to download it:
class DownloadFile extends AsyncTask<String, Integer, String> {
URL url = new URL(aurl[0]);