title: Insert NewChidldActivity in-Between MainActivity and FirstChildAcvitity And Change Default ChildActivity to the NewChildActivity
body: <p>Fellow Friends,</p>
  
  <p>thank you all for your usual support.</p>
  
  <p>I have developed an an examination app with login functionality.</p>
  
  <p>Previously, the app had 3 Activities (MainActivity, WelcomeScreenActivity and QuestionsAcvitity). This app is working perfectly.</p>
  
  <p>However, when the user logs in from the MainActivity, the WelcomeScreenActivity shows.
  But I need to INSERT another activity (PROFILE_ACTIVITY) between the MainActivity and the WelcomeScreenActivity so that, when the user logs in successfully, the app will display the user's PROFILEACTIVITY.</p>
  
  <p>Pictures below the page</p>
  
  <h2><strong>Previous Code before the new ProfileActivity</strong></h2>
  
  <p><strong>MainActivity.java code</strong></p>
  
  <pre><code>@Override
          protected void onPostExecute(Void result){
              if (!responseData.equals( "User Not Found" )) {
                  message = "Welcome";
                  data = responseData;//store the user id from the server in data
                  //Bundle bundle = new Bundle();//bundle the message and parse it to the next activity
                  //bundle.putString("dispMsg", message);//bundle the message using the variable dispMsg
                  //intent.putExtras(bundle);
                  startActivity(intent);
                  statusBar.setText(message);
              } else {
                  message = responseData;//"Incorrect Username or Password. Try again!";
                  statusBar.setText(message);
              }
              super.onPostExecute(result);
          }
  </code></pre>
  
  <p><strong>DisplayWelcomeScreenActivity.java code</strong>
  This activity displays after a successful login.</p>
  
  <pre><code>@Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_display_welcome_screen);
  
      // Get the Intent that started this activity and extract the string
          intent = getIntent();
  }
  </code></pre>
  
  <p>To pass from this WelcomeActivity to the next QuestionsActivity, the code below does that on buttonclick() event</p>
  
  <pre><code>public void courseClicked(View v) {
  
          String course = "";
          Intent intent = new Intent(this, CSS_342_Questions.class);
          int qNum = 0;
  
         switch (v.getId()){
             case R.id.buttonCSS342:
                 course = "CSS 342";
                 qNum=1;
                 break;
             case R.id.buttonCSS352:
                 course = "CSS 352";
                 qNum=1;
                 break;
             case R.id.buttonCSS354:
                 course = "CSS 354";
                 qNum=1;
                 break;
             case R.id.buttonCSS356:
                 course = "CSS 356";
                 qNum=1;
                 break;
             case R.id.buttonCSS381:
                 course = "CSS 381";
                 qNum=1;
                 break;
             case R.id.buttonPCR362:
                 course = "PCR 362";
                 qNum=1;
                 break;
         }
          Bundle bundle = new Bundle();
          bundle.putString("dispCode", course);
          bundle.putInt("qNum", qNum);
          //bundle.putString("dispMsg", "Welcome");
          intent.putExtras(bundle);
  
          startActivity(intent);
      }
  </code></pre>
  
  <p>The QuestionsActivity gets displayed using the code below.</p>
  
  <pre><code>@Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_css_342__questions);
  
          // Get the Intent that started this activity and extract the string
          intent = getIntent();
          bundle = getIntent().getExtras();
  
          showCode = bundle.getString("dispCode");
          qNum = bundle.getInt("qNum");
  }
  </code></pre>
  
  <p>This code below is the Manifest xml that links the 3 activities together for proper navigation.</p>
  
  <p><strong>AndroidManifest.XML code</strong></p>
  
  <pre><code>?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.examinationportal"&gt;
  
      &lt;uses-permission
          android:name="android.permission.INTERNET"
          android:required="true" /&gt;
      &lt;uses-permission
          android:name="android.permission.ACCESS_NETWORK_STATE"
          android:required="true" /&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name"
          android:roundIcon="@mipmap/ic_launcher_round"
          android:supportsRtl="true"
          android:theme="@style/Theme.AppCompat.DayNight.DarkActionBar"&gt;
          &lt;activity android:name=".MainActivity"&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;activity android:name=".DisplayWelcomeScreen"
              android:label="@string/welcome_screen_title"
              android:parentActivityName=".MainActivity"&gt;
  
              &lt;!-- The meta-data tag is required if you support API level 15 and lower --&gt;
              &lt;meta-data
                  android:name="android.support.PARENT_ACTIVITY"
                  android:value=".MainActivity" /&gt;
  
          &lt;/activity&gt;
  
          &lt;activity
              android:name=".CSS_342_Questions"
              android:allowTaskReparenting="true"
              android:label="@string/question_screen"
              android:parentActivityName=".DisplayWelcomeScreen"&gt;
  
              &lt;!-- The meta-data tag is required if you support API level 15 and lower --&gt;
              &lt;meta-data
                  android:name="android.support.PARENT_ACTIVITY"
                  android:value=".DisplayWelcomeScreen" /&gt;
          &lt;/activity&gt;
          &lt;activity
              android:name=".RegisterUserActivity"
              android:label="@string/new_user_form"
              android:parentActivityName=".MainActivity"&gt;
  
              &lt;!-- The meta-data tag is required if you support API level 15 and lower --&gt;
              &lt;meta-data
                  android:name="android.support.PARENT_ACTIVITY"
                  android:value=".MainActivity" /&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>Now, I want to insert a new activity (ProfileActivity) between the MainActivity and the DisplayScreenActivity.</p>
  
  <p>I have changed the AndroidManifest xml code below.
  The app is crashing. The LogCat shows the line where the app is crashing  <code>**StartActivity(intent)**</code> in MainActivity.java; line 153</p>
  
  <h2><strong>The Code After the new Activity</strong></h2>
  
  <p>The MainActivity code still remains the same.</p>
  
  <p><strong>The new AndroidManifest.xml code</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.examinationportal"&gt;
  
      &lt;uses-permission
          android:name="android.permission.INTERNET"
          android:required="true" /&gt;
      &lt;uses-permission
          android:name="android.permission.ACCESS_NETWORK_STATE"
          android:required="true" /&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name"
          android:roundIcon="@mipmap/ic_launcher_round"
          android:supportsRtl="true"
          android:theme="@style/Theme.AppCompat.DayNight.DarkActionBar"&gt;
          &lt;activity android:name=".MainActivity"&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;activity android:name=".ProfileAcvitity"
              android:label="@string/student_profile"
              android:parentActivityName=".MainActivity"&gt;
  
              &lt;!-- The meta-data tag is required if you support API level 15 and lower --&gt;
              &lt;meta-data
                  android:name="android.support.PARENT_ACTIVITY"
                  android:value=".MainActivity" /&gt;
  
          &lt;/activity&gt;
  
          &lt;activity
              android:name=".RegisterUserActivity"
              android:label="@string/new_user_form"
              android:parentActivityName=".MainActivity"&gt;
  
              &lt;!-- The meta-data tag is required if you support API level 15 and lower --&gt;
              &lt;meta-data
                  android:name="android.support.PARENT_ACTIVITY"
                  android:value=".MainActivity" /&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p><strong>New ProfileActivity.java code</strong></p>
  
  <pre><code>public class ProfileAcvitity extends AppCompatActivity {
      public Intent intent;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_profile_acvitity);
  
          intent = getIntent();
      }
  </code></pre>
  
  <h2>LOGCAT INFORMATION</h2>
  
  <pre><code>04-25 13:53:33.680 14789-14789/com.example.examinationportal E/AndroidRuntime: FATAL EXCEPTION: main
                                                                                 Process: com.example.examinationportal, PID: 14789
                                                                                 android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.examinationportal/com.example.examinationportal.DisplayWelcomeScreen}; have you declared this activity in your AndroidManifest.xml?
                                                                                     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1805)
                                                                                     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1523)
                                                                                     at android.app.Activity.startActivityForResult(Activity.java:4034)
                                                                                     at android.support.v4.app.BaseFragmentActivityJB.startActivityForResult(BaseFragmentActivityJB.java:50)
                                                                                     at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:79)
                                                                                     at android.app.Activity.startActivityForResult(Activity.java:3986)
                                                                                     at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:859)
                                                                                     at android.app.Activity.startActivity(Activity.java:4325)
                                                                                     at android.app.Activity.startActivity(Activity.java:4293)
                                                                                     at com.example.examinationportal.MainActivity$GetText.onPostExecute(MainActivity.java:153)
                                                                                     at com.example.examinationportal.MainActivity$GetText.onPostExecute(MainActivity.java:83)
                                                                                     at android.os.AsyncTask.finish(AsyncTask.java:651)
                                                                                     at android.os.AsyncTask.-wrap1(AsyncTask.java)
                                                                                     at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:668)
                                                                                     at android.os.Handler.dispatchMessage(Handler.java:111)
                                                                                     at android.os.Looper.loop(Looper.java:207)
                                                                                     at android.app.ActivityThread.main(ActivityThread.java:5763)
                                                                                     at java.lang.reflect.Method.invoke(Native Method)
                                                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
                                                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
  </code></pre>
  
  <p>Please help me solve this problem.</p>
  
  <p>Thank you.</p>
  
  <p><a href="https://i.stack.imgur.com/xkjyE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xkjyE.png" alt="enter image description here"></a><a href="https://i.stack.imgur.com/7WNAY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7WNAY.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/Kb1l9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Kb1l9.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/6EXap.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6EXap.png" alt="enter image description here"></a></p>