title: How i can to change activity on onpostexecute Android
body: <p>So i've tried to search on stackoverflow, but no one solution is useful for me. I want to get data from server, so I do post request and then if the result is true i need to change activity.</p>
  
  <pre><code>package com.example.earchive;
  
  import java.io.BufferedReader;
  import java.io.InputStreamReader;
  import java.util.ArrayList;
  import java.util.List;
  
  import org.apache.http.HttpResponse;
  import org.apache.http.NameValuePair;
  import org.apache.http.client.HttpClient;
  import org.apache.http.client.entity.UrlEncodedFormEntity;
  import org.apache.http.client.methods.HttpPost;
  import org.apache.http.impl.client.DefaultHttpClient;
  import org.apache.http.message.BasicNameValuePair;
  import org.json.JSONArray;
  import org.json.JSONException;
  import org.json.JSONObject;
  
  import android.app.Activity;
  import android.content.Intent;
  import android.os.AsyncTask;
  import android.os.Bundle;
  import android.view.Menu;
  import android.view.View;
  import android.widget.Button;
  import android.widget.EditText;
  
  public class LoginActivity extends Activity {
  
  
  
  
      public String propertyNumber;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_login);
  
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.login, menu);
  /*** Work with login button ***/        
          final Button button = (Button) findViewById(R.id.login_bt);
          button.setOnClickListener(new View.OnClickListener() {
              public void onClick(View v) {
  
                  FetchTask fetch = new FetchTask();
  
                  EditText email = (EditText)findViewById(R.id.email);
                  fetch.email =  email.getText().toString();
                  EditText password = (EditText)findViewById(R.id.password);
                  fetch.password =  password.getText().toString();
                  fetch.v = v;
                  fetch.execute();
  
              }
          });
  /*** End of work with login button ***/         
  
  
          return true;
  
  
      } 
  
  
      public class FetchTask extends AsyncTask&lt;Void, Void, JSONArray&gt; {
  
          public JSONArray result_arr;
          public String result_str,email,password,test;
          public boolean is_loged;
          public View v;
          @Override
  
          protected JSONArray doInBackground(Void... params) {
              try {
                  HttpClient httpclient = new DefaultHttpClient();
                  HttpPost httppost = new HttpPost("HERE MY LINK");
  
                  // Add your data
                  List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(2);
  
  
  
                  nameValuePairs.add(new BasicNameValuePair("em", this.email));
                  nameValuePairs.add(new BasicNameValuePair("pa", this.password));
                  nameValuePairs.add(new BasicNameValuePair("os", "android"));
                  httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
  
                  // Execute HTTP Post Request
                  HttpResponse response = httpclient.execute(httppost);
  
                  BufferedReader reader = new BufferedReader(new InputStreamReader(response.getEntity().getContent(), "utf-8"), 8);
                  StringBuilder sb = new StringBuilder();
                  sb.append(reader.readLine());
                  String line = "0";
                  while ((line = reader.readLine()) != null) {
                      sb.append(line);
                  }
                  reader.close();
                  String result11 = sb.toString();
  
                  this.result_str = result11;
                  // parsing data
                  JSONArray arr = new JSONArray(result11);
  
  
  
  
                  return new JSONArray(result11);
              } catch (Exception e) {
                  e.printStackTrace();
                  return null;
              }
          }
  
          @Override
          protected void onPostExecute(JSONArray result) {
  
              int auth;
              if (result != null) {
                  JSONObject json_data;
                  try {
                      json_data = result.getJSONObject(0);
                      auth = json_data.getInt("auth");
  
                      if(auth != 0)
                      {
                          startActivity(new Intent(LoginActivity.this, InboxActivity.class));  
  
  
                      }
                      else
                      {
  
                      }
                  } catch (JSONException e1) {
                      e1.printStackTrace();
                  }
  
              } else {
                  System.out.println("error occured");
  
              }
          }
      }
  }
  </code></pre>
  
  <p>My InboxActivity class</p>
  
  <pre><code>package com.example.earchive;
  
  import android.app.Activity;
  import android.os.Bundle;
  import android.view.Menu;
  import android.view.View;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.TextView;
  
  public class InboxActivity extends Activity {
  
      public String propertyNumber;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_inbox);
  
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          getMenuInflater().inflate(R.menu.login, menu);
          return true;    
      }    
  }
  </code></pre>
  
  <p>Here it is my code of AndroidManifest (res/AndroidManifest.xml)</p>
  
  <p>here is my code from res/AndroidManifest.xml</p>
  
  <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.earchive"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="8"
          android:targetSdkVersion="17" /&gt;
      &lt;uses-permission android:name="android.permission.INTERNET"/&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
          &lt;activity
              android:name="com.example.earchive.LoginActivity"
              android:label="@string/app_name" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>My error logs:</p>
  
  <pre><code>02-18 06:45:26.611: E/AndroidRuntime(1814): FATAL EXCEPTION: main
  02-18 06:45:26.611: E/AndroidRuntime(1814): Process: com.example.earchive, PID: 1814
  02-18 06:45:26.611: E/AndroidRuntime(1814): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.earchive/com.example.earchive.InboxActivity}; have you declared this activity in your AndroidManifest.xml?
  02-18 06:45:26.611: E/AndroidRuntime(1814):     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1628)
  02-18 06:45:26.611: E/AndroidRuntime(1814):     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)
  02-18 06:45:26.611: E/AndroidRuntime(1814):     at android.app.Activity.startActivityForResult(Activity.java:3424)
  02-18 06:45:26.611: E/AndroidRuntime(1814):     at android.app.Activity.startActivityForResult(Activity.java:3385)
  02-18 06:45:26.611: E/AndroidRuntime(1814):     at android.app.Activity.startActivity(Activity.java:3627)
  02-18 06:45:26.611: E/AndroidRuntime(1814):     at android.app.Activity.startActivity(Activity.java:3595)
  02-18 06:45:26.611: E/AndroidRuntime(1814):     at com.example.earchive.LoginActivity$FetchTask.onPostExecute(LoginActivity.java:155)
  02-18 06:45:26.611: E/AndroidRuntime(1814):     at com.example.earchive.LoginActivity$FetchTask.onPostExecute(LoginActivity.java:1)
  02-18 06:45:26.611: E/AndroidRuntime(1814):     at android.os.AsyncTask.finish(AsyncTask.java:632)
  02-18 06:45:26.611: E/AndroidRuntime(1814):     at android.os.AsyncTask.access$600(AsyncTask.java:177)
  02-18 06:45:26.611: E/AndroidRuntime(1814):     at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645)
  02-18 06:45:26.611: E/AndroidRuntime(1814):     at android.os.Handler.dispatchMessage(Handler.java:102)
  02-18 06:45:26.611: E/AndroidRuntime(1814):     at android.os.Looper.loop(Looper.java:136)
  02-18 06:45:26.611: E/AndroidRuntime(1814):     at android.app.ActivityThread.main(ActivityThread.java:5017)
  02-18 06:45:26.611: E/AndroidRuntime(1814):     at java.lang.reflect.Method.invokeNative(Native Method)
  02-18 06:45:26.611: E/AndroidRuntime(1814):     at java.lang.reflect.Method.invoke(Method.java:515)
  02-18 06:45:26.611: E/AndroidRuntime(1814):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
  02-18 06:45:26.611: E/AndroidRuntime(1814):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
  02-18 06:45:26.611: E/AndroidRuntime(1814):     at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>When I run my application and when I send post request I see error <code>"Unfortunately, APPNAME has stopped"</code></p>
  
  <p>What I need to do?</p>
  
  <p>Thank's to all!</p>