Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/392.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 当我点击";检查BusyBox";按钮_Java_Android_Button_Busybox_Roottools - Fatal编程技术网

Java 当我点击";检查BusyBox";按钮

Java 当我点击";检查BusyBox";按钮,java,android,button,busybox,roottools,Java,Android,Button,Busybox,Roottools,我制作了一个应用程序,使用RootTools检查root用户。现在,我添加了一个选项来检查BusyBox的可用性。当我点击“CheckforBusyBox”时,什么也没发生,尽管“CheckforRoot”工作得很好。我不明白为什么会这样。请帮忙 package com.maverick.checkforroot; import com.stericson.RootTools.RootTools; import android.app.Activity; import android.app

我制作了一个应用程序,使用RootTools检查root用户。现在,我添加了一个选项来检查BusyBox的可用性。当我点击“CheckforBusyBox”时,什么也没发生,尽管“CheckforRoot”工作得很好。我不明白为什么会这样。请帮忙

package com.maverick.checkforroot;

import com.stericson.RootTools.RootTools;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    TextView Manufacturer = (TextView) findViewById(R.id.Manufacturer);
    String Manu = android.os.Build.MANUFACTURER;;
    Manufacturer.setText(Manu);

    TextView tv1 = (TextView) findViewById(R.id.tv1);
    String Model = android.os.Build.MODEL;
    tv1.setText(Model);

    TextView Product = (TextView) findViewById(R.id.Product);
    String Pro = android.os.Build.PRODUCT;;
    Product.setText(Pro);

    Button Root = (Button) findViewById(R.id.Root);
    Root.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            if (RootTools.isAccessGiven()) {

                    AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
                    builder.setIcon(R.drawable.ic_launcher);
                    builder.setTitle("Congratulations!");
                    builder.setMessage("You Have Root Access!");

                    builder.setPositiveButton("OKAY", new DialogInterface.OnClickListener() {

                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            dialog.cancel();
                        }
                    });

                    AlertDialog dialog = builder.create();
                    dialog.show();
                }

            else  {
                 AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
                    builder.setIcon(R.drawable.ic_launcher);
                    builder.setTitle("Oops!");
                    builder.setMessage("No Root Access!");
                    builder.setPositiveButton("OKAY", new DialogInterface.OnClickListener() {

                        @Override
                        public void onClick(DialogInterface dialog, int which) {

                            dialog.cancel();
                        }
                    });

                    AlertDialog dialog = builder.create();
                    dialog.show();  
            }
            Button BusyBox = (Button) findViewById(R.id.BusyBox);
            BusyBox.setOnClickListener(new OnClickListener() {

                @Override
                public void onClick(View arg0) {

                    if (RootTools.isBusyboxAvailable()) {
                        Toast.makeText(MainActivity.this,"No BusyBox!", Toast.LENGTH_LONG).show();

                    } else {
                        Toast.makeText(MainActivity.this,"BusyBox Is Available!", Toast.LENGTH_LONG).show();

                    }

                }
            });

        }

    });
}}

BusyBox
按钮有关的所有代码(包括其
OnClickListener
的定义)都写在
按钮
OnClickListener
代码中。移动代码,它应该对您有用。

似乎您在根按钮的onClickListener中声明了所有BusyBox按钮和内容。好的。我正在检查。我已更正代码!它现在正在工作。非常感谢。