2

当我在我的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();
4

1 回答 1

2

http://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html

String lineSep=System.getProperty("line.separator");

您可以使用它代替“\n”来换行。

于 2012-08-07T07:48:12.897 回答