android - 2 days ago XML Layout ran perfectly, now (with no structural change) it gives me errors? -


two days ago, posted the following question. while there issues, still ran - test code on phone still. however, no major changes code (and no structural changes), program refuse run when second activity , crashes.

luckily, had posted of xml code activity in linked question.

error (warnings actually)

  1. element fragment not allowed here
  2. element imageview not allowed here

how can be?? working code ran on phone, , giving me long list of error messages , cannot run second activity, can run first activity.

detail

this inspection highlights unallowed xml tags in android resource files , androidmanifest.xml 

extra information

  1. i updated ide android studio 1.3 preview 4 preview 5 since posting linked question

code

ran 2 days ago

<android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:fitssystemwindows="true">      <android.support.design.widget.appbarlayout         android:id="@+id/appbar"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:theme="@style/themeoverlay.appcompat.dark.actionbar">          <android.support.design.widget.collapsingtoolbarlayout             android:id="@+id/collapsing_toolbar"             android:layout_width="match_parent"             android:layout_height="wrap_content"             app:contentscrim="?attr/colorprimary"             app:expandedtitlemarginend="16dp"             app:expandedtitlemarginstart="48dp"             app:layout_scrollflags="scroll|enteralways">              <imageview                 android:id="@+id/header"                 android:layout_width="match_parent"                 android:layout_height="wrap_content"                 android:background="@drawable/download"                  android:scaletype="centercrop" />              <android.support.v7.widget.toolbar                 android:id="@+id/anim_toolbar"                 android:layout_width="match_parent"                 android:layout_height="?attr/actionbarsize"                  app:layout_collapsemode="pin" />          </android.support.design.widget.collapsingtoolbarlayout>      </android.support.design.widget.appbarlayout>      <android.support.v4.widget.nestedscrollview         android:layout_width="fill_parent"         android:layout_height="fill_parent"         android:layout_below="@+id/anim_toolbar"         app:layout_behavior="@string/appbar_scrolling_view_behavior">          <fragment             android:id="@+id/detail"             android:name="<package>.<fragment_name>"             android:layout_width="match_parent"             android:layout_height="match_parent" />      </android.support.v4.widget.nestedscrollview>  </android.support.design.widget.coordinatorlayout> 

not working today

<?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:fitssystemwindows="true">      <android.support.design.widget.appbarlayout         android:id="@+id/appbar"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:fitssystemwindows="true">          <android.support.design.widget.collapsingtoolbarlayout             android:id="@+id/collapsing_toolbar"             android:layout_width="match_parent"             android:layout_height="wrap_content"             app:contentscrim="?attr/colorprimary"             app:expandedtitlemarginend="48dp"             app:expandedtitlemarginstart="48dp"             app:layout_scrollflags="scroll|exituntilcollapsed"             android:fitssystemwindows="true">              <!-- here....error -->             <imageview                   android:id="@+id/header"                 android:layout_width="match_parent"                 android:layout_height="wrap_content"                 android:background="@drawable/download"                 android:scaletype="centercrop"                 app:layout_collapsemode="parallax"                 android:contentdescription="movie poster"                 android:fitssystemwindows="true"/>              <android.support.v7.widget.toolbar                 android:id="@+id/anim_toolbar"                 android:layout_width="match_parent"                 android:layout_height="?attr/actionbarsize"                 android:fitssystemwindows="true" />          </android.support.design.widget.collapsingtoolbarlayout>      </android.support.design.widget.appbarlayout>      <android.support.v4.widget.nestedscrollview         android:layout_width="match_parent"         android:layout_height="match_parent"         android:id="@+id/scrollview"         android:layout_below="@+id/anim_toolbar"         app:layout_behavior="@string/appbar_scrolling_view_behavior" >              <!-- here....error -->             <fragment                 android:id="@+id/movie_detail"                 android:name="com.udacity.rucinskic.spotify_streamer.movies.fragments.movieoverviewfragment"                 android:layout_width="match_parent"                 android:layout_height="match_parent"                 tools:layout="@layout/fragment_movie_detail" />      </android.support.v4.widget.nestedscrollview>  </android.support.design.widget.coordinatorlayout> 

oncreateview

@override public view oncreateview(layoutinflater inflater, viewgroup container,                          bundle savedinstancestate) {      view rootview = inflater.inflate(r.layout.fragment_movie_poster, container, false);      textview relaseyear = (textview) rootview.findviewbyid(r.id.movie_release_year);     ratingbar rating = (ratingbar) rootview.findviewbyid(r.id.movie_rating);     textview overview = (textview) rootview.findviewbyid(r.id.movie_overview);      detailedmovie movie = getmovie();      dateformat format = new simpledateformat("yyyy", locale.us);      relaseyear.settext(format.format(movie.getdaterelease()));     rating.setrating(movie.getrating());     overview.settext(movie.getoverview());      return rootview;  } 

edit

stack trace

    process: com.udacity.rucinskic.spotify_streamer, pid: 27320     java.lang.runtimeexception: unable start activity componentinfo{com.udacity.rucinskic.spotify_streamer/com.udacity.rucinskic.spotify_streamer.secondaryactivity}: android.view.inflateexception: binary xml file line #66: error inflating class fragment             @ android.app.activitythread.performlaunchactivity(activitythread.java:2712)             @ android.app.activitythread.handlelaunchactivity(activitythread.java:2777)             @ android.app.activitythread.access$900(activitythread.java:179)             @ android.app.activitythread$h.handlemessage(activitythread.java:1462)             @ android.os.handler.dispatchmessage(handler.java:102)             @ android.os.looper.loop(looper.java:145)             @ android.app.activitythread.main(activitythread.java:5972)             @ java.lang.reflect.method.invoke(native method)             @ java.lang.reflect.method.invoke(method.java:372)             @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1399)             @ com.android.internal.os.zygoteinit.main(zygoteinit.java:1194)      caused by: android.view.inflateexception: binary xml file line #66: error inflating class fragment             @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:770)             @ android.view.layoutinflater.rinflate(layoutinflater.java:813)             @ android.view.layoutinflater.rinflate(layoutinflater.java:821)             @ android.view.layoutinflater.inflate(layoutinflater.java:511)             @ android.view.layoutinflater.inflate(layoutinflater.java:415)             @ android.view.layoutinflater.inflate(layoutinflater.java:366)             @ android.support.v7.app.appcompatdelegateimplv7.setcontentview(appcompatdelegateimplv7.java:249)             @ android.support.v7.app.appcompatactivity.setcontentview(appcompatactivity.java:106)             @ com.udacity.rucinskic.spotify_streamer.secondaryactivity.oncreate(secondaryactivity.java:21)             @ android.app.activity.performcreate(activity.java:6289)             @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1119)             @ android.app.activitythread.performlaunchactivity(activitythread.java:2665)             at android.app.activitythread.handlelaunchactivity(activitythread.java:2777)             at android.app.activitythread.access$900(activitythread.java:179)             at android.app.activitythread$h.handlemessage(activitythread.java:1462)             at android.os.handler.dispatchmessage(handler.java:102)             at android.os.looper.loop(looper.java:145)             at android.app.activitythread.main(activitythread.java:5972)             at java.lang.reflect.method.invoke(native method)             at java.lang.reflect.method.invoke(method.java:372)             at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1399)             at com.android.internal.os.zygoteinit.main(zygoteinit.java:1194)      caused by: java.lang.illegalargumentexception: bad class: class java.util.gregoriancalendar             @ java.text.dateformat.format(dateformat.java:296)             @ java.text.format.format(format.java:93)             @ com.udacity.rucinskic.spotify_streamer.movies.fragments.movieoverviewfragment.oncreateview(movieoverviewfragment.java:35)             @ android.support.v4.app.fragment.performcreateview(fragment.java:1789)             @ android.support.v4.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:924)             @ android.support.v4.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:1116)             @ android.support.v4.app.fragmentmanagerimpl.addfragment(fragmentmanager.java:1218)             @ android.support.v4.app.fragmentmanagerimpl.oncreateview(fragmentmanager.java:2170)             @ android.support.v4.app.fragmentactivity.oncreateview(fragmentactivity.java:300)             @ android.support.v7.app.appcompatdelegateimplv7.callactivityoncreateview(appcompatdelegateimplv7.java:838)             @ android.support.v7.app.appcompatdelegateimplv11.callactivityoncreateview(appcompatdelegateimplv11.java:34)             @ android.support.v7.app.appcompatdelegateimplv7.oncreateview(appcompatdelegateimplv7.java:826)             @ android.support.v4.view.layoutinflatercompathc$factorywrapperhc.oncreateview(layoutinflatercompathc.java:44)             @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:732)             at android.view.layoutinflater.rinflate(layoutinflater.java:813)             at android.view.layoutinflater.rinflate(layoutinflater.java:821)             at android.view.layoutinflater.inflate(layoutinflater.java:511)             at android.view.layoutinflater.inflate(layoutinflater.java:415)             at android.view.layoutinflater.inflate(layoutinflater.java:366)             at android.support.v7.app.appcompatdelegateimplv7.setcontentview(appcompatdelegateimplv7.java:249)             at android.support.v7.app.appcompatactivity.setcontentview(appcompatactivity.java:106)             at com.udacity.rucinskic.spotify_streamer.secondaryactivity.oncreate(secondaryactivity.java:21)             at android.app.activity.performcreate(activity.java:6289)             at android.app.instrumentation.callactivityoncreate(instrumentation.java:1119)             at android.app.activitythread.performlaunchactivity(activitythread.java:2665)             at android.app.activitythread.handlelaunchactivity(activitythread.java:2777)             at android.app.activitythread.access$900(activitythread.java:179)             at android.app.activitythread$h.handlemessage(activitythread.java:1462)             at android.os.handler.dispatchmessage(handler.java:102)             at android.os.looper.loop(looper.java:145)             at android.app.activitythread.main(activitythread.java:5972)             at java.lang.reflect.method.invoke(native method)             at java.lang.reflect.method.invoke(method.java:372)             at com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1399)             at com.android.internal.os.zygoteinit.main(zygoteinit.java:1194) 

i had same problem. try exchanging imageview android.support.v7.widget.appcompatimageview. solved problem me!


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -