Spec Crashing everytime somethign is toegevoegd

Spec for DisplayActivity.java crasht altijd wanneer ik iets toevoeg. Kan niet achterhalen wat ik verkeerd doe. Hier is mijn huidige code.

ControlActivity.java

package com.control.driswave;


import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;
import android.widget.Toast;

import com.control.driswave.R;
import com.stericson.RootTools.RootTools;

public class ControlActivity extends TabActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    if (RootTools.isAccessGiven()) {
        Toast root = Toast.makeText(getApplicationContext(), 
                "Root Granted", Toast.LENGTH_SHORT);
        root.show();
    } else {
        Toast noRoot = Toast.makeText(getApplicationContext(), 
                "Root Access Needed To Continue", Toast.LENGTH_LONG);
        noRoot.show();
        finish();
    }

    Resources res = getResources();//used to get res drawings (i.e. display files)
    TabHost tabHost = getTabHost();//used to create TabHost located in main.xml
    TabHost.TabSpec spec; //TabHost specifications which are the same in each view
    Intent intent; //intent for each tab. *RESEARCH INTENT*


   //New Class Added Caused FC. Was working. Spec no longer working again.

     //____Display
    intent = new Intent().setClass(this, DisplayActivity.class);

    spec = tabHost.newTabSpec("display").setIndicator("Display",
            res.getDrawable(R.drawable.ic_tab_display))
            .setContent(intent);//create picture to be used for tab
    tabHost.addTab(spec);

    //____Power
    intent = new Intent().setClass(this, PowerActivity.class);

    spec = tabHost.newTabSpec("power").setIndicator("Power", 
            res.getDrawable(R.drawable.ic_tab_display))
            .setContent(intent);
    tabHost.addTab(spec);





}
}

DisplayActivity.java

package com.control.driswave;

import java.io.File;

import com.stericson.RootTools.RootTools;

import android.app.Activity;
import android.os.Bundle;
import android.provider.Settings;
import android.view.View.OnClickListener;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import android.widget.Toast;

public class DisplayActivity extends Activity {
private int prevValue = Integer.parseInt(Settings.System.WINDOW_ANIMATION_SCALE);
private SeekBar brBar;
private TextView brightLevel;

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.display);


    //_____Disable Boot Animation_____// NEEDS TESTING http://mgmblog.com/2008/02/18/android-checkbox-oncheckedchangelistener/
    CheckBox dba = (CheckBox) findViewById(R.id.DBA);
    dba.setOnCheckedChangeListener(new OnCheckedChangeListener() {

        public void onCheckedChanged(CompoundButton dba, boolean isChecked) {
            if (dba.isChecked()) {
            RootTools.remount("/system/", "rw");
            File ba = new File("/System/Media/bootanimation.zip");
            ba.renameTo(new File("/System/Media/bootanimation.zip.bak"));
            Toast.makeText(getApplicationContext(), "Boot Animation Disabled", Toast.LENGTH_SHORT);
            } else {
                Toast.makeText(getApplicationContext(), "Boot Animation Enabled", Toast.LENGTH_SHORT);
            }

        }

    });




    //_____Disable Window Animations_____//
    CheckBox dwa = (CheckBox) findViewById(R.id.DWA);
    dwa.setOnCheckedChangeListener(new OnCheckedChangeListener() {
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

            if (buttonView.isChecked()) {
                Settings.System.putInt(getContentResolver(), Settings.System.WINDOW_ANIMATION_SCALE, 0);
            } else {
                Settings.System.putInt(getContentResolver(), Settings.System.WINDOW_ANIMATION_SCALE, prevValue);
            }
        }
    });


    //_____Brightness Seek Bar____//
    brBar = (SeekBar) findViewById(R.id.brSeekbar);
    brightLevel = (TextView) findViewById(R.id.brSeekbar_num);
    brBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

        public void onProgressChanged(SeekBar brBar, int brLevel, boolean arg2) {
            Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS, brLevel);
            brightLevel.setText(brLevel);

        }

        public void onStartTrackingTouch(SeekBar brBar) {
            brightLevel.setText("Changing...");

        }

        public void onStopTrackingTouch(SeekBar brBar) {
           //Nothing

        }


    });




}

}

Display.xml

<?xml version="1.0" encoding="utf-8"?>













ControlManifest.xml

<?xml version="1.0" encoding="utf-8"?>





















    
        
            

            
        
    
    
    
    
    



log.txt

06-25 17:38:44.035: D/dalvikvm(25731): GC_EXPLICIT freed 58K, 43% free 3067K/5379K, external 2540K/2666K, paused 41ms
06-25 17:38:48.293: D/AndroidRuntime(25731): Shutting down VM
06-25 17:38:48.293: W/dalvikvm(25731): threadid=1: thread exiting with uncaught exception (group=0x4001e560)
06-25 17:38:48.332: E/AndroidRuntime(25731): FATAL EXCEPTION: main
06-25 17:38:48.332: E/AndroidRuntime(25731): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.control.driswave/com.control.driswave.ControlActivity}: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.control.driswave/com.control.driswave.DisplayActivity}: java.lang.NumberFormatException: unable to parse 'window_animation_scale' as integer
06-25 17:38:48.332: E/AndroidRuntime(25731):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1702)
06-25 17:38:48.332: E/AndroidRuntime(25731):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1722)
06-25 17:38:48.332: E/AndroidRuntime(25731):    at android.app.ActivityThread.access$1500(ActivityThread.java:124)
06-25 17:38:48.332: E/AndroidRuntime(25731):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:974)
06-25 17:38:48.332: E/AndroidRuntime(25731):    at android.os.Handler.dispatchMessage(Handler.java:99)
06-25 17:38:48.332: E/AndroidRuntime(25731):    at android.os.Looper.loop(Looper.java:130)
06-25 17:38:48.332: E/AndroidRuntime(25731):    at android.app.ActivityThread.main(ActivityThread.java:3821)
06-25 17:38:48.332: E/AndroidRuntime(25731):    at java.lang.reflect.Method.invokeNative(Native Method)
06-25 17:38:48.332: E/AndroidRuntime(25731):    at java.lang.reflect.Method.invoke(Method.java:507)
06-25 17:38:48.332: E/AndroidRuntime(25731):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-25 17:38:48.332: E/AndroidRuntime(25731):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-25 17:38:48.332: E/AndroidRuntime(25731):    at dalvik.system.NativeStart.main(Native Method)
06-25 17:38:48.332: E/AndroidRuntime(25731): Caused by: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.control.driswave/com.control.driswave.DisplayActivity}: java.lang.NumberFormatException: unable to parse 'window_animation_scale' as integer
06-25 17:38:48.332: E/AndroidRuntime(25731):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1624)
06-25 17:38:48.332: E/AndroidRuntime(25731):    at android.app.ActivityThread.startActivityNow(ActivityThread.java:1530)
06-25 17:38:48.332: E/AndroidRuntime(25731):    at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:127)
06-25 17:38:48.332: E/AndroidRuntime(25731):    at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:339)
06-25 17:38:48.332: E/AndroidRuntime(25731):    at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:696)
06-25 17:38:48.332: E/AndroidRuntime(25731):    at android.widget.TabHost.setCurrentTab(TabHost.java:328)
06-25 17:38:48.332: E/AndroidRuntime(25731):    at android.widget.TabHost.addTab(TabHost.java:218)
06-25 17:38:48.332: E/AndroidRuntime(25731):    at com.control.driswave.ControlActivity.onCreate(ControlActivity.java:46)
06-25 17:38:48.332: E/AndroidRuntime(25731):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-25 17:38:48.332: E/AndroidRuntime(25731):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1666)
06-25 17:38:48.332: E/AndroidRuntime(25731):    ... 11 more
06-25 17:38:48.332: E/AndroidRuntime(25731): Caused by: java.lang.NumberFormatException: unable to parse 'window_animation_scale' as integer
06-25 17:38:48.332: E/AndroidRuntime(25731):    at java.lang.Integer.parse(Integer.java:383)
06-25 17:38:48.332: E/AndroidRuntime(25731):    at java.lang.Integer.parseInt(Integer.java:372)
06-25 17:38:48.332: E/AndroidRuntime(25731):    at java.lang.Integer.parseInt(Integer.java:332)
06-25 17:38:48.332: E/AndroidRuntime(25731):    at com.control.driswave.DisplayActivity.(DisplayActivity.java:20)
06-25 17:38:48.332: E/AndroidRuntime(25731):    at java.lang.Class.newInstanceImpl(Native Method)
06-25 17:38:48.332: E/AndroidRuntime(25731):    at java.lang.Class.newInstance(Class.java:1409)
06-25 17:38:48.332: E/AndroidRuntime(25731):    at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
06-25 17:38:48.332: E/AndroidRuntime(25731):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1616)
06-25 17:38:48.332: E/AndroidRuntime(25731):    ... 20 more
1
Zoals altijd, als je een crash hebt, plaats dan de LogCat met de informatie over de crash.
toegevoegd de auteur Barak, de bron
het is toegevoegd.
toegevoegd de auteur Adrian Le Roy Devezin, de bron

1 antwoord

Nou, je probleem is dit:

Java.lang.NumberFormatException: kan 'window_animation_scale' niet parseren als integer

Corrigeer dat en de rest zou in de rij moeten vallen.

2
toegevoegd