Android function helper class
<p>I've been trying to find a tutorial or example on creating Helper class. The only thing that i keep running across is tutorials on Database Helpers. What I'm wanting to do is instead of using repetitive functions or statements etc... i tried to make a helper class to contain he repetitive code but for some reason i can not get it to work. Heres a quick example how/what i am trying to do. </p>

<p><strong>Helper Class</strong></p>

<pre><code> public class Helper extends Activity {

    Context ctx;
    static SharedPreferences settings;
    public static SharedPreferences.Editor edit;
    public static final String PREF = "PrefTest";
    static boolean c;
    static int B;
    static String A, a, b, C, D, E, F;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        settings = getSharedPreferences(PREF,MODE_PRIVATE);         
        edit = settings.edit(); 
    }
    public static String userId() {     
        a = settings.getString("Phone", "");
        return a;
    }

    public static String pwd(){
        b = settings.getString("pwd", "");
        return b;
    }

    public static boolean lock(){
        c = settings.getBoolean("pwd", false);
        return c;
    }   
    public static String version(Context ctx) {
        A = ctx.getResources().getString(R.string.version);
        return A;
    }   
    public static void saveUser(String user){
        if(user == null || user == ""){
            edit.putString("Phone", "User N/A");
            edit.commit();
        }else{
            edit.putString("Phone", user);
            edit.commit();
        }       
    } 
    public static void savePwd(String D){
        if(D == null || D ==""){
            edit.putString("pwd",D);
            edit.commit();
        }else{
            edit.putString("pwd",Error.validate(D + userId()));
            edit.commit();
        }       
    }
    public static void saveLock(boolean lock) {
        if (lock){
            edit.putBoolean("Locked", true);
            edit.commit();
        }else{
            edit.putBoolean("Locked", false);
            edit.commit();
        }
    }
    public static int passwordCheck() {
        if (pwd() == null || pwd() == "") {
            B = 0;
        } else {
            B = 1;
        }
        return B;
    }
    public static int phoneCheck() {
        if (userId() == null || userId() == "") {
            B = 0; 
        } else {
            B = 1;
        }
        return B;
    }
    public static int lockCheck() {
        if (lock()) {
            B = 1; 
        } else {
            B = 0;
        }
        return B;
    }
}
</code></pre>

<p>now when i call :</p>

<pre><code>int ab = Helper.phoneCheck();
        if(ab == 0){
            try{
                Helper.saveUser("TestUser");
            }catch(Exception e){
                e.printStackTrace();
            }
        }
</code></pre>

<p>it crashes the app, been working on trying to figure out why and i keep running into dead ends and now seeing if someone might be able to help me out with this</p>

<p><strong>LogCat</strong></p>

<pre><code>05-30 01:25:11.067: D/dalvikvm(1411): GC_EXTERNAL_ALLOC freed 43K, 53% free 2551K/5379K, external 716K/1038K, paused 125ms
05-30 01:25:11.237: D/AndroidRuntime(1411): Shutting down VM
05-30 01:25:11.237: W/dalvikvm(1411): threadid=1: thread exiting with uncaught exception (group=0x40015560)
05-30 01:25:11.277: E/AndroidRuntime(1411): FATAL EXCEPTION: main
05-30 01:25:11.277: E/AndroidRuntime(1411): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.test.prefapp/com.test.prefapp.StartUp}: java.lang.NullPointerException
05-30 01:25:11.277: E/AndroidRuntime(1411):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
05-30 01:25:11.277: E/AndroidRuntime(1411):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
05-30 01:25:11.277: E/AndroidRuntime(1411):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
05-30 01:25:11.277: E/AndroidRuntime(1411):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
05-30 01:25:11.277: E/AndroidRuntime(1411):     at android.os.Handler.dispatchMessage(Handler.java:99)
05-30 01:25:11.277: E/AndroidRuntime(1411):     at android.os.Looper.loop(Looper.java:123)
05-30 01:25:11.277: E/AndroidRuntime(1411):     at android.app.ActivityThread.main(ActivityThread.java:3683)
05-30 01:25:11.277: E/AndroidRuntime(1411):     at java.lang.reflect.Method.invokeNative(Native Method)
05-30 01:25:11.277: E/AndroidRuntime(1411):     at java.lang.reflect.Method.invoke(Method.java:507)
05-30 01:25:11.277: E/AndroidRuntime(1411):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
05-30 01:25:11.277: E/AndroidRuntime(1411):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
05-30 01:25:11.277: E/AndroidRuntime(1411):     at dalvik.system.NativeStart.main(Native Method)
05-30 01:25:11.277: E/AndroidRuntime(1411): Caused by: java.lang.NullPointerException
05-30 01:25:11.277: E/AndroidRuntime(1411):     at com.test.prefapp.Helper.userId(Helper.java:51)
05-30 01:25:11.277: E/AndroidRuntime(1411):     at com.test.prefapp.Helper.phoneCheck(Helper.java:194)
05-30 01:25:11.277: E/AndroidRuntime(1411):     at com.test.prefapp.StartUp.onCreate(StartUp.java:44)
05-30 01:25:11.277: E/AndroidRuntime(1411):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-30 01:25:11.277: E/AndroidRuntime(1411):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
</code></pre>
