Trying to pass the content of an editText from one class to another in android but m unable to do so....m getting a null pointer exception?
<pre><code>public void onClick(View arg0) {

    if (hasValidInput()) {
        //showActivityIndicators();
        Intent result = new Intent();
        Bundle b = new Bundle();
        b.putString("username", "abcd");
        b.putString("apiKey", "hello");
        b.putString("server", getAuthServer());
        result.putExtra("accountInfo", b);
        setResult(RESULT_OK, result);
        //Account acc = new Account();
        //Bundle c = new Bundle();
        //acc.setPassword(c.getString("apiKey"));
        //acc.setUsername(c.getString("username"));
        //acc.setAuthServerV2(c.getString("server"));
        //Log.d("info", "the set server was " + c.getString("server"));
        //Log.d("info", "the server is " + acc.getAuthServerV2());
        //accounts.add(acc);
        //SharedPreferences.Editor editor = getPreferences(MODE_PRIVATE).edit(); 
        EditText mSaved = (EditText)findViewById(R.id.containername);
         //editor.putString("text", mSaved.getText().toString()); 
         SharedPreferences prefs = getPreferences(Context.MODE_WORLD_READABLE );
         Editor editor1 = prefs.edit();
         editor1.putString("name",mSaved.getText().toString());
         editor1.commit();


        //login();

        finish();
    } else {
        showAlert("Required Fields Missing", "Username and API Key are required.");
    }

}
</code></pre>

<p>I'm calling it in a different class in the following function as...</p>

<pre><code> public class CreateContainerTask extends AsyncTask&lt;Void, Void, HttpBundle&gt; {
    private CloudServersException exception;

    protected void onPreExecute(){
        showDialog();
    }

    @Override
    protected HttpBundle doInBackground(Void... arg0) {
        HttpBundle bundle = null;
        //EditText containerName = (EditText) findViewById(R.id.containername);
        SharedPreferences prefs = getPreferences(MODE_WORLD_READABLE);  
        String containerName = prefs.getString("name", null);
        Log.d("info", containerName);
        try {

            bundle = (new ContainerManager(getContext())).create(containerName);
        } catch (CloudServersException e) {
            exception = e;
        }
        return bundle;
    }

    @Override
    protected void onPostExecute(HttpBundle bundle) {
        hideDialog();
        /*HttpResponse response = bundle.getResponse();
        if (response != null) {
            int statusCode = response.getStatusLine().getStatusCode();
            if (statusCode == 201) {
                setResult(Activity.RESULT_OK);
                finish();
            } else {
                CloudServersException cse = parseCloudServersException(response);
                if ("".equals(cse.getMessage())) {
                    showError("There was a problem creating your container.", bundle);
                } else {
                    showError("There was a problem creating your container: " + cse.getMessage() + " See details for more information.", bundle);
                }
            }
        } else if (exception != null) {
            showError("There was a problem creating your container: " + exception.getMessage()+" See details for more information.", bundle);               
        }*/
        finish();
    }
}
</code></pre>

<p>in the above code I'm trying to make a container in the cloud using the username
but it gives a null pointer and the app stops</p>
