我有问题 当我点击我的android上的“list domain”按钮时,在linux(服务器)中将执行命令
cat /var/listdomain.txt
和linux将提供输出
irfan.com
jarkom.com
you.co.id
但我的android上的输出就像这样
irfan.comjarkom.comyou.co.id
我应该怎么做我的android输出
irfan.com
jarkom.com
you.co.id
这是我在eclips中的语法
public final Button.OnClickListener bLihatIsi = new Button.OnClickListener() {
@Override
public void onClick(View v) {
try {
AlertDialog.Builder dialog = new AlertDialog.Builder(actual);
dialog.setTitle(getResources().getString(R.string.execute)
+ getResources().getString(R.string.Terminal)
+ " ?");
dialog.setMessage(getResources().getString(
R.string.popLihat)
+ " ?");
dialog.setNegativeButton(getResources().getString(
R.string.no),
new DialogInterface.OnClickListener() {
@Override
public void onClick(
DialogInterface dialogInterface, int i) {
}
});
dialog.setPositiveButton(getResources().getString(
R.string.yes),
new DialogInterface.OnClickListener() {
@Override
public void onClick(
DialogInterface dialogInterface, int i) {
Spinner spinner = (Spinner) findViewById(R.id.spinner);
Server server = serverlist.get(spinner.getSelectedItemPosition() - 1);
if (server != null ){
final String LIHATISI = "cat /var/listdomain.txt";
DnsConnect u = new DnsConnect();
Command c = new Command (getResources().getText(R.string.konfdnsdel).toString(), LIHATISI, server);
u.setCommand(LIHATISI);
pd = ProgressDialog.show(actual, getResources().
getString(R.string.PleaseWait), c.getName());
actualThreadCommand = c;
Thread thread = new Thread(actual);
thread.start();
} else {
Toast.makeText(getBaseContext(),
getResources().getText(R.string.tabelkosongkonten),
Toast.LENGTH_LONG).show();
}
}
});
dialog.show();
答案 0 :(得分:2)
http://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html
String lineSep=System.getProperty("line.separator");
你可以使用它代替“\ n”来打破界限。