Trying to include toolbar..but getting this exception
<p>I'm having a toolbar and i have added an include statement in XML. But in MainActivity onCreate I getting this error please help me on this.
My Main Activity class :</p>

<pre><code>            package com.sample.passwordreset;

            import android.content.Intent;
            import android.os.Build;
            import android.os.Bundle;
            import android.util.Log;
            import android.view.Menu;
            import android.view.MenuItem;
            import android.view.Window;
            import android.view.WindowManager;
            import android.support.v7.widget.Toolbar;

            import com.parse.ParseUser;

            public class MainActivity extends BaseActivity {
                @Override
                protected void onCreate(Bundle savedInstanceState) {
                    super.onCreate(savedInstanceState);
                    setContentView(R.layout.activity_main);
                    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
                    setContentView(toolbar);
                    if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.LOLLIPOP) {
                        Window window = getWindow();
                        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
                        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
                        window.setStatusBarColor(getResources().getColor(R.color.colorAccent));
                    }
                    ParseUser currentUser = ParseUser.getCurrentUser();
                    if (currentUser == null) { //User not logged in
                        Log.d("MainAcitvity", "Sending to LoginActivity!");
                        Intent intent = new Intent(this, LoginActivity.class);
                        startActivity(intent);
                        finish();
                    }
                }
                @Override
                public boolean onCreateOptionsMenu(Menu menu) {
                    getMenuInflater().inflate(R.menu.menu_main, menu);
                    return false;
                }
                @Override
                public boolean onOptionsItemSelected(MenuItem item) {
                    int id = item.getItemId();
                    if (id == R.id.action_settings) {
                        return true;
                    }
                    return super.onOptionsItemSelected(item);
                }
            }
</code></pre>

<p>and my activity_main.xml</p>

<pre><code>            &lt;?xml version="1.0" encoding="utf-8"?&gt;
            &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:tools="http://schemas.android.com/tools"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@color/colorAccent"
                tools:context=".MainActivity"&gt;
                &lt;include
                    android:id="@+id/toolbar"
                    layout="@layout/toolbar" /&gt;
            &lt;/RelativeLayout&gt;
</code></pre>

<p>and here is my toolbar.xml</p>

<pre><code>            &lt;?xml version="1.0" encoding="utf-8"?&gt;
            &lt;android.support.v7.widget.Toolbar
                xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:app="http://schemas.android.com/apk/res-auto"
                android:id="@+id/toolbar"
                android:minHeight="?attr/actionBarSize"
                android:background="?attr/colorPrimary"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:paddingLeft="0dp"
                android:paddingRight="0dp"
                app:contentInsetEnd="0dp"
                app:contentInsetStart="0dp"
                app:titleTextAppearance="@style/AppTheme.Toolbar.Title"
                android:theme="@style/AppTheme"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
                /&gt;
</code></pre>

<p>The log cat error</p>

<pre><code>            Caused by: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
                                                                                          at android.view.ViewGroup.addViewInner(ViewGroup.java:3672)
                                                                                          at android.view.ViewGroup.addView(ViewGroup.java:3543)
                                                                                          at android.view.ViewGroup.addView(ViewGroup.java:3488)
                                                                                          at android.view.ViewGroup.addView(ViewGroup.java:3464)
                                                                                          at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:247)
                                                                                          at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:114)
                                                                                          at com.sample.passwordreset.MainActivity.onCreate(MainActivity.java:21)
                                                                                          at android.app.Activity.performCreate(Activity.java:5177)
                                                                                          at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
                                                                                          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
                                                                                          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135) 
                                                                                          at android.app.ActivityThread.access$700(ActivityThread.java:143) 
                                                                                          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1241) 
                                                                                          at android.os.Handler.dispatchMessage(Handler.java:99) 
                                                                                          at android.os.Looper.loop(Looper.java:137) 
                                                                                          at android.app.ActivityThread.main(ActivityThread.java:4950) 
                                                                                          at java.lang.reflect.Method.invokeNative(Native Method) 
                                                                                          at java.lang.reflect.Method.invoke(Method.java:511) 
                                                                                          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1004) 
                                                                                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:771) 
                                                                                          at dalvik.system.NativeStart.main(Native Method) 
            02-05 13:02:56.358 11190-11190/com.sample.passwordreset I/Process: Sending signal. PID: 11190 SIG: 9
</code></pre>

<p>LoginActivity</p>

<pre><code>        public class LoginActivity extends NoAuthActivity {
                            private EditText mUsernameField;
                            private EditText mPasswordField;
                            private TextView mErrorField;
                            private ProgressBar spinner;

                            @Override
                            protected void onCreate(Bundle savedInstanceState) {
                                super.onCreate(savedInstanceState);
                                setContentView(R.layout.activity_login);
                                Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
                                //setSupportActionBar(toolbar);

                                mUsernameField = (EditText) findViewById(R.id.login_email);
                                mPasswordField = (EditText) findViewById(R.id.login_password);
                                mErrorField = (TextView) findViewById(R.id.error_messages);

                                spinner = (ProgressBar)findViewById(R.id.progressBar1);
                                spinner.setVisibility(View.GONE);

                                Parse.initialize(this);

                                Parse.setLogLevel(Parse.LOG_LEVEL_DEBUG);

                                ParseQuery&lt;ParseObject&gt; qtw = ParseQuery.getQuery("tw");

                                qtw.getFirstInBackground(new GetCallback&lt;ParseObject&gt;() {
                                    @Override
                                    public void done(ParseObject object, ParseException e) {
                                        if (e == null) {
                                            ParseTwitterUtils.initialize("Rakesh", "Maski");
                                        }else
                                        {
                                            Log.d("tx:Error",e.getMessage());
                                        }

                                    }

                                   /* public void done(ParseObject obj, ParseObject e) {
                                        if (e == null) {
                                            String tw_consumer_key = obj.get("keyid").toString();
                                            String tw_consumer_secret = obj.get("secretid").toString();
                                            //ParseTwitterUtils.initialize(tw_consumer_key, tw_consumer_secret);
                                        } else {
                                            //Log.d("Tw: Error", e.getMessage());
                                        }
                                    }*/

                                });
                            }

                            public void signInNormal(final View v) {
                                v.setEnabled(false);
                                spinner.setVisibility(View.VISIBLE);
                                InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
                                mgr.hideSoftInputFromWindow(mUsernameField.getWindowToken(), 0);

                                if (mUsernameField.getText().length()==0 || mPasswordField.getText().length()==0){
                                    v.setEnabled(true);
                                    spinner.setVisibility(View.GONE);
                                    mErrorField.setText("All the fields are required. Please fill them.");
                                    return;
                                }

                                ParseUser.logInInBackground(mUsernameField.getText().toString(),
                                        mPasswordField.getText().toString(), new LogInCallback() {
                                            @Override
                                            public void done(ParseUser user, ParseException e) {
                                                if (user != null) {
                                                    boolean verify = user.getBoolean("emailVerified");
                                                    if (!verify) {
                                                        spinner.setVisibility(View.GONE);
                                                        mErrorField.setText("Are you sure you're verified? Verify by opening link we have sent to your registered email &amp; then login again.");
                                                    } else {
                                                        spinner.setVisibility(View.GONE);
                                                        Intent intent = new Intent(LoginActivity.this, MainActivity.class);
                                                        startActivity(intent);
                                                        finish();
                                                    }
                                                } else {
                                                     //Signup failed. Look at the ParseException to see
                                                    // what happened.
                                                    switch (e.getCode()) {
                                                        case ParseException.USERNAME_TAKEN:
                                                            mErrorField
                                                                    .setText("Sorry, this username has already been taken.");
                                                            break;
                                                        case ParseException.USERNAME_MISSING:
                                                            mErrorField
                                                                    .setText("Sorry, you must supply a username to register.");
                                                            break;
                                                        case ParseException.PASSWORD_MISSING:
                                                            mErrorField
                                                                    .setText("Sorry, you must supply a password to register.");
                                                            break;
                                                        case ParseException.OBJECT_NOT_FOUND:
                                                            mErrorField
                                                                    .setText("Sorry, those credentials were invalid.");
                                                            break;
                                                        case ParseException.CONNECTION_FAILED:
                                                            mErrorField
                                                                    .setText("Internet connection was not found. Please see your connection settings.");
                                                            break;
                                                        default:
                                                            mErrorField.setText(e.getLocalizedMessage());
                                                            break;
                                                    }
                                                    v.setEnabled(true);
                                                    spinner.setVisibility(View.GONE);
                                                }
                                            }
                                        });
                            }

                            public void showRegistration(View v) {
                                Intent intent = new Intent(this, RegisterActivity.class);
                                startActivity(intent);
                                finish();
                            }

                            public void forgpassActivity(View v) {
                                Intent intent = new Intent(this, ForgotPassActivity.class);
                                startActivity(intent);
                                finish();
                            }


                            public void signInTwitter(final View v) {
                                v.setEnabled(false);
                                spinner.setVisibility(View.VISIBLE);
                                ParseTwitterUtils.logIn(this, new LogInCallback() {
                                    @Override
                                    public void done(ParseUser user, ParseException err) {
                                        if (user == null) {
                                            Log.d("RYC", "Uh oh. The user cancelled the Twitter login.");
                                            spinner.setVisibility(View.GONE);
                                            v.setEnabled(true);
                                        } else if (user.isNew()) {
                                            Log.d("RYC", "User signed up and logged in through Twitter!");
                                            String userscreenName = ParseTwitterUtils.getTwitter().getScreenName();
                                            user.put("screenName", userscreenName);
                                            try {
                                                user.save();
                                            } catch (ParseException e) {
                                                e.printStackTrace();
                                            }
                                            spinner.setVisibility(View.GONE);
                                            LoginActivity.this.startActivity(new Intent(LoginActivity.this, MainActivity.class));
                                            finish();
                                        } else {
                                            Log.d("RYC", "User logged in through Twitter!");
                                            String userscreenName = ParseTwitterUtils.getTwitter().getScreenName();
                                            user.put("screenName", userscreenName);
                                            try {
                                                user.save();
                                            } catch (ParseException e) {
                                                e.printStackTrace();
                                            }
                                            spinner.setVisibility(View.GONE);
                                            LoginActivity.this.startActivity(new Intent(LoginActivity.this, MainActivity.class));
                                            finish();
                                        }
                                    }
                                });
                            }
                        }
</code></pre>