title: Error when pressing back button
body: <p>In my android application when press back button show this errors in logcat :</p>
  
  <pre><code>09-01 14:07:42.995: E/AndroidRuntime(6279): FATAL EXCEPTION: main
  09-01 14:07:42.995: E/AndroidRuntime(6279): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.nabege/com.example.nabege.Edit_Collection_Activity}: java.lang.NullPointerException
  09-01 14:07:42.995: E/AndroidRuntime(6279):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
  09-01 14:07:42.995: E/AndroidRuntime(6279):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
  09-01 14:07:42.995: E/AndroidRuntime(6279):     at android.app.ActivityThread.access$600(ActivityThread.java:123)
  09-01 14:07:42.995: E/AndroidRuntime(6279):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
  09-01 14:07:42.995: E/AndroidRuntime(6279):     at android.os.Handler.dispatchMessage(Handler.java:99)
  09-01 14:07:42.995: E/AndroidRuntime(6279):     at android.os.Looper.loop(Looper.java:137)
  09-01 14:07:42.995: E/AndroidRuntime(6279):     at android.app.ActivityThread.main(ActivityThread.java:4424)
  09-01 14:07:42.995: E/AndroidRuntime(6279):     at java.lang.reflect.Method.invokeNative(Native Method)
  09-01 14:07:42.995: E/AndroidRuntime(6279):     at java.lang.reflect.Method.invoke(Method.java:511)
  09-01 14:07:42.995: E/AndroidRuntime(6279):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
  09-01 14:07:42.995: E/AndroidRuntime(6279):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
  09-01 14:07:42.995: E/AndroidRuntime(6279):     at dalvik.system.NativeStart.main(Native Method)
  09-01 14:07:42.995: E/AndroidRuntime(6279): Caused by: java.lang.NullPointerException
  09-01 14:07:42.995: E/AndroidRuntime(6279):     at com.example.nabege.Edit_Collection_Activity.onCreate(Edit_Collection_Activity.java:30)
  09-01 14:07:42.995: E/AndroidRuntime(6279):     at android.app.Activity.performCreate(Activity.java:4465)
  09-01 14:07:42.995: E/AndroidRuntime(6279):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
  09-01 14:07:42.995: E/AndroidRuntime(6279):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
  09-01 14:07:42.995: E/AndroidRuntime(6279):     ... 11 more
  </code></pre>
  
  <p>my activity codes like this:</p>
  
  <pre><code>public class Edit_Collection_Activity extends ActionBarActivity {
      private DB_Nabege_helper nabege_db = new DB_Nabege_helper(this);
      private EditText txt_update_collection;
      private Button btn_update_collection;
      private Button btn_cancel_update_collection;
      private int id_collection;
      private String name_collection;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_edit__collection);
  
          Bundle extra = getIntent().getExtras();
  
          id_collection = extra.getInt("id_collection");
          name_collection = extra.getString("name_collection");
  
          //
          txt_update_collection = (EditText) findViewById(R.id.editText_update_collection);
          txt_update_collection.setText(name_collection);
          // update collection
          btn_update_collection = (Button) findViewById(R.id.btn_update_collection);
          btn_update_collection.setOnClickListener(new OnClickListener() {
              @Override
              public void onClick(View v) {
                  nabege_db.open();
                  nabege_db.update_colletion(id_collection, txt_update_collection.getText().toString());
                  nabege_db.close();
                  Toast.makeText(getApplicationContext(), "تغییرات با موفقیت ثبت شد.", Toast.LENGTH_SHORT).show();
                  //go To pre Activity
                  goback();
  
              }
          });
          //go back
          btn_cancel_update_collection =(Button)findViewById(R.id.btn_update_collection_cancel);
          btn_cancel_update_collection.setOnClickListener(new OnClickListener() {
  
              @Override
              public void onClick(View v) {
                  goback();
              }
          });
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.edit__collection_, menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          // Handle action bar item clicks here. The action bar will
          // automatically handle clicks on the Home/Up button, so long
          // as you specify a parent activity in AndroidManifest.xml.
          int id = item.getItemId();
          if (id == R.id.action_settings) {
              return true;
          }
          return super.onOptionsItemSelected(item);
      }
          private void goback() {
      super.finish();
  }
  }
  </code></pre>
  
  <p>I run the activity by The following codes in previous activity.
  In previous activity is a list view that by click on the list view items show Dialog then by press button in this Dialog run The following code :</p>
  
  <pre><code> edit_collection.setOnClickListener(new OnClickListener() {
          @Override
          public void onClick(View v) {
              Intent goToEditCollectionActivity = new Intent(Collection_List_Activity.this, Edit_Collection_Activity.class);
              startActivity(goToEditCollectionActivity);
              goToEditCollectionActivity.putExtra("id_collection", id_tbl_collection[index_collection]);
              goToEditCollectionActivity.putExtra("name_collection", name_collection_tbl_collection[index_collection]);
              menu_collection_listDialog.cancel();
              startActivity(goToEditCollectionActivity);
          }
      });
  </code></pre>
  
  <p>Please  help</p>