我想将结果发送到字符串数组而不是text.Here是用于在文本中发送结果的代码。但我想以字符串数组发送结果。
ChannelSftp sftpChannel = (ChannelSftp) channel;
try {
Vector ls=sftpChannel.ls("/home/abc/Desktop");
for(int i = 0; i < ls.size(); i++) {
text += sftpChannel.pwd() + "/" + (((LsEntry)ls.get(i)).getFilename()) + "\n";
}
t.post(new Runnable() {
public void run() { t.setText(text); }
});
} catch (SftpException e1) { }
答案 0 :(得分:0)
ChannelSftp sftpChannel = (ChannelSftp) channel;
try {
Vector ls=sftpChannel.ls("/home/abc/Desktop");
String[] strings = new String[ls.size];
for(int i = 0; i < ls.size(); i++) {
strings[i] = sftpChannel.pwd() + "/" + (((LsEntry)ls.get(i)).getFilename());
}
t.post(new Runnable() {
public void run() { t.setText(strings.toString()); }
});
} catch (SftpException e1) { }