RomActivity.java :  » UnTagged » m-tune » com » mitman » mtuner » Android Open Source

Android Open Source » UnTagged » m tune 
m tune » com » mitman » mtuner » RomActivity.java
package com.mitman.mtuner;

import java.io.IOException;

import staticfunctions.ShellInterface;
import android.app.Activity;
//import android.graphics.drawable.Drawable;
import android.view.View.OnClickListener;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

public class RomActivity extends Activity {
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        TextView textview = new TextView(this);
        textview.setText("This is the ROM tab");
        setContentView(textview);
        ImageView torch_button = new ImageView(this);
        torch_button.setImageResource(R.drawable.icon);
        torch_button.layout(50, 50, 100, 50);
        torch_button.setOnClickListener(new OnClickListener(){

                public void onClick(View v) {
                  try {
                    if(ShellInterface.isSuAvailable()) { 
                      ShellInterface.runCommand("killall system_server");
                ShellInterface.runCommand("busybox killall system_server");
                ShellInterface.runCommand("reboot");
                    } 
                    
          } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
                          
                }});
        //setContentView(torch_button);
       }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.