title: How to solve the Fragment Error
body: <p>Below is my code.</p>
  
  <p><strong>MainActivity.java</strong> code below:</p>
  
  <pre><code>public class Login extends AppCompatActivity {
   @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_login);
          getSupportFragmentManager().beginTransaction().replace(R.id.loginFrame, new LoginFragment()).commit();
  
      }
  }
  </code></pre>
  
  <p><strong>Fragment Activity</strong> .java code which is called in <strong>MainActivity.java</strong></p>
  
  <pre><code>  public class LoginFragment extends Fragment {
          EditText emailEt,passwordEt;
          String email,password;
          Button login,signup;
          @Nullable
          @Override
          public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
              View rootview = super.onCreateView(inflater, container, savedInstanceState);
  
              emailEt=(EditText)rootview.findViewById(R.id.emailEt);
              passwordEt=(EditText)rootview.findViewById(R.id.passEt);
              login=(Button)rootview.findViewById(R.id.loginBtn);
              signup=(Button)rootview.findViewById(R.id.signupBtn);
  
              login.setOnClickListener(new View.OnClickListener() {
                  @Override
                  public void onClick(View v) {
                      email=emailEt.getText().toString();
                      password=passwordEt.getText().toString();
  
                      if(email.length()==0){
                          emailEt.requestFocus();
                          emailEt.setError("FIELD CANNOT BE EMPTY");
                      }else if(password.length()==0){
                          passwordEt.requestFocus();
                          passwordEt.setError("FIELD CANNOT BE EMPTY");
                      }else{
                          Toast.makeText(getActivity(),"Validation Done",Toast.LENGTH_SHORT).show();
                          Intent in=new Intent(getActivity(),Options_class.class);
                          startActivity(in);
                      }
                  }
              });
  
              signup.setOnClickListener(new View.OnClickListener() {
                  @Override
                  public void onClick(View v) {
                      Intent intent=new Intent(getActivity(),Signup.class);
                      startActivity(intent);
                  }
              });
              return rootview;
          }
      }
  </code></pre>
  
  <p>Error <strong>logcat</strong> of code which show oncreate() Error in mainclass</p>
  
  <blockquote>
    <p>t dalvik.system.VMRuntime.newNonMovableArray(Native Method)
                                                                                   at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
                                                                                   at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:620)
                                                                                   at
    android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:455)
                                                                                   at
    android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:1152)
                                                                                   at
    android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:724)
                                                                                   at
    android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:575)
                                                                                   at android.content.res.Resources.loadDrawable(Resources.java:854)
                                                                                   at android.content.res.TypedArray.getDrawable(TypedArray.java:928)
                                                                                   at android.widget.ImageView.(ImageView.java:167)
                                                                                   at android.widget.ImageView.(ImageView.java:155)
                                                                                   at
    android.support.v7.widget.AppCompatImageView.(AppCompatImageView.java:60)
                                                                                   at
    android.support.v7.widget.AppCompatImageView.(AppCompatImageView.java:56)
                                                                                   at
    android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:106)
                                                                                   at
    android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1021)
                                                                                   at
    android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1080)
                                                                                   at
    android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:47)
                                                                                   at
    android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:769)
                                                                                   at
    android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
                                                                                   at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
                                                                                   at
    android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
                                                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
                                                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
                                                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
                                                                                   at
    android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:288)
                                                                                   at
    android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
                                                                                   at com.example.nirmit.demo_frg.Login.onCreate(Login.java:13)
                                                                                   at android.app.Activity.performCreate(Activity.java:6672)
                                                                                   at
    android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1140)
                                                                                   at
    android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2612)
                                                                                   at
    android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2724)
                                                                                   at android.app.ActivityThread.-wrap12(ActivityThread.java)
                                                                                   at
    android.app.ActivityThread$H.handleMessage(ActivityThread.java:1473)
                                                                                   at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                   at android.os.Looper.loop(Looper.java:154)
                                                                                   at android.app.ActivityThread.main(ActivityThread.java:6123)
                                                                                   at java.lang.reflect.Method.invoke(Native Method)
                                                                                   at
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
                                                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)</p>
  </blockquote>
  
  <p>Can any body help me to solve this problem of logcat in mainActivity and fragment code.</p>