java - Android - Threads not executing -
So yes, my thread is not executed, or is code inside it. I just wanted to run a shell script from my SDCD, and show a "loading" circle or "progress" circle or whatever you want to call it. When I click on the button to run the thread, I get the progress / loading bar / circle, but it just sits there and does nothing. I have seen some examples, but still I can not understand what I did. Here's my code:
package com. CDOnPlasSmods; Import java.io.file; Import java.io.FileOutputStream; Import java.io.IOException; Import java.io.InputStream; Import java.util.concurrent.TimeoutException; Import com.stericson.RootTools. *; Import com.stericson.RootTools.exceptions.RootDeniedException; Import com.stericson.RootTools.execution.CommandCapture; Import android App Import android.app.ProgressDialog; Import android.content.res.AssetManager; Importroid.os.Bundle; Import android.os environment; Import Android.os.Handler; Android Import; message; Import android.util.log; Import android.view.View; Import android.widget.Button; Import android.widget.TextView; Increases public class installation activity {Personal Stable Progressive Development Progress; @ Override protected void saved create (bundled Instansstet) {Suprknkret (saved Instensstet); SetContentView (R.layout.install); Button bInstall = (button) findViewById (R.id.bInstallTheme); BInstall.setOnClickListener (New View.OnClickListener () {@Override Click Public Zero (see ARG0) {showDialog ();}}); } Public Zero Show Dialeg () {progressDialog = ProgressDialog.show (Install.This, "", "Installing Theme", is true); Thread thread = new thread (); Thread.start (); } Public run zero () {try {thread.leep (1000); Command Capture Command = New Command Capture (0, "su", "sh / sdcard / plasma / scripts / installation.ash"); Try {RootTools.getShell (true) .add (command). WaitForFinish (); } Grip (Interrupted e) e.printStackTrace (); } Hold (IOException e) {e.printStackTrace (); } Hold (Timeout Exception E) {e.printStackTrace (); } Hold (root directory) {e.printStackTrace (); }} Grip (Interrupted e) e.printStackTrace (); } Handler.and Acclaims (0); } Private State Handler Handler = New Handler () {@ Override Public Wide Handmessase (Message Message) {progressDialog.dismiss (); }}; } So am I doing something wrong? Why will not this drive my code? Thanks!
Do not know what the thread is not running. Expanding the establishment activity of the public class {{code}
The establishment activity of the public class is removed Runanbal { Change more
thread thread = new thread (); to
thread thread = new thread (this);
Comments
Post a Comment