5,597,501 Members 31,550 Now Online
XDA Developers Android and Mobile Development Forum

[Q] HELP ME - Eclipse Android (ADT)

Tip us?
 
gnmmarechal
Old
#1  
Member - OP
Thanks Meter 43
Posts: 93
Join Date: Apr 2013

 
DONATE TO ME
Default [Q] HELP ME - Eclipse Android (ADT)

So, Im making a Root Checker app for android with Root Tools.

However, when I run it on a device, the button doesnt do anything... Here's my code:


MainActivity.java
Code:
package com.gs2012.rootchecker;

import com.stericson.RootTools.RootTools;

import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.app.Activity;
import android.view.Menu;
import android.widget.Button;
import android.widget.TextView;

public class MainActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		Button aButton;
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		aButton = (Button) this.findViewById(R.id.button1);
		final TextView hasbusybox = (TextView) this.findViewById(R.id.TextView03);
		final TextView hassu = (TextView) this.findViewById(R.id.TextView02);
		final TextView hasroot = (TextView) this.findViewById(R.id.TextView04);
		aButton.setOnClickListener(new OnClickListener() {
			public void onClick1(final View v) {
			// Here is where we tell it what to do
				if (RootTools.isBusyboxAvailable())
				{
					hasbusybox.setText("Busybox OK");
				}
				else
				{
				hasbusybox.setText("NOT OK");
				}
				if (RootTools.isRootAvailable())
				{
					hassu.setText("SU OK");
				}
				else {
					{
						hassu.setText("NOT OK");
					}
					if (RootTools.isAccessGiven())
					{
						hasroot.setText("ROOT OK");
					}
					else
					{
						hasroot.setText("NOT OK");
						
					}
				}
				}

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				
			;}});
			
			


	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

}
activity_main.xml
Code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:text="Click the button to check for root access."
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <Button
        android:id="@+id/button1"
        style="?android:attr/buttonStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/textView1"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="47dp"
        android:text="CHECK NOW" />

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/button1"
        android:layout_marginTop="80dp"
        android:text="Busybox installed:"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <TextView
        android:id="@+id/textView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/textView2"
        android:layout_alignBottom="@+id/textView2"
        android:layout_marginLeft="16dp"
        android:layout_toRightOf="@+id/textView2"
        android:text="NOT CHECKED"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <TextView
        android:id="@+id/TextView01"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/textView2"
        android:layout_marginTop="29dp"
        android:layout_toLeftOf="@+id/textView3"
        android:text="SU installed:"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <TextView
        android:id="@+id/TextView03"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/TextView01"
        android:layout_marginTop="28dp"
        android:layout_toLeftOf="@+id/textView3"
        android:text="Has root access:"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <TextView
        android:id="@+id/TextView04"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/TextView03"
        android:layout_alignBottom="@+id/TextView03"
        android:layout_alignLeft="@+id/textView3"
        android:text="NOT CHECKED"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <TextView
        android:id="@+id/TextView02"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/TextView03"
        android:layout_alignLeft="@+id/TextView04"
        android:text="NOT CHECKED"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <TextView
        android:id="@+id/TextView05"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:text="Click the button to check for root access."
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <TextView
        android:id="@+id/textView4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignRight="@+id/textView1"
        android:text="By Gnm Software 2012"
        android:textAppearance="?android:attr/textAppearanceLarge" />

</RelativeLayout>
 
gnmmarechal
Old
#2  
Member - OP
Thanks Meter 43
Posts: 93
Join Date: Apr 2013

 
DONATE TO ME
Bump

Sent from my GT-S6310N using xda app-developers app




My Devices:

Samsung Galaxy Gio (Stock Rooted 2.3.6, AOSP 4.2.2, Paranoid Android v1.5, CyanogenMod 11(Android 4.4.2), CyanogenMod 10.1 (Android 4.2.2), GlassROM Iridiscent v1.2 (Android 4.2.2) )using CWM

Samsung Galaxy Young (Stock Rooted with Xposed Framework (Android 4.1.2) ) using CWM.

HTC Polaris (Touch Cruise) running Windows Mobile 6.1 Pro and Android 1.5
Tags
adt, android, eclipse, java, root
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes