kirehashi1224 / itspfug202_client Goto Github PK
View Code? Open in Web Editor NEWITSP2018 FuG202
ITSP2018 FuG202
嫌だボタンを押すと、ページが書き換わるのではなく増えていく(スタックに積まれる)挙動だと、ホーム画面に戻るのが面倒です。
原因は現状不明だけどserializableを継承したRestaurantクラスの扱いが原因と思われる
07-24 14:30:54.529 8066-8066/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: jp.ac.titech.itpro.sdl.itspfug202, PID: 8066
java.lang.RuntimeException: Parcelable encountered IOException writing serializable object (name = jp.ac.titech.itpro.sdl.itspfug202.model.Restaurant)
at android.os.Parcel.writeSerializable(Parcel.java:1526)
at android.os.Parcel.writeValue(Parcel.java:1474)
at android.os.Parcel.writeArrayMapInternal(Parcel.java:723)
at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1408)
at android.os.Bundle.writeToParcel(Bundle.java:1133)
at android.os.Parcel.writeBundle(Parcel.java:763)
at android.support.v4.app.FragmentState.writeToParcel(FragmentState.java:123)
at android.os.Parcel.writeTypedArray(Parcel.java:1306)
at android.support.v4.app.FragmentManagerState.writeToParcel(FragmentManager.java:619)
at android.os.Parcel.writeParcelable(Parcel.java:1495)
at android.os.Parcel.writeValue(Parcel.java:1401)
at android.os.Parcel.writeArrayMapInternal(Parcel.java:723)
at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1408)
at android.os.Bundle.writeToParcel(Bundle.java:1133)
at android.os.Parcel.writeBundle(Parcel.java:763)
at android.app.ActivityManagerProxy.activityStopped(ActivityManagerNative.java:3672)
at android.app.ActivityThread$StopInfo.run(ActivityThread.java:3770)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:159)
at android.app.ActivityThread.main(ActivityThread.java:6130)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: java.io.NotSerializableException: jp.ac.titech.itpro.sdl.itspfug202.model.Restaurant$TimeSpanList
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1224)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1584)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1549)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1472)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1218)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
at android.os.Parcel.writeSerializable(Parcel.java:1521)
at android.os.Parcel.writeValue(Parcel.java:1474)
at android.os.Parcel.writeArrayMapInternal(Parcel.java:723)
at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1408)
at android.os.Bundle.writeToParcel(Bundle.java:1133)
at android.os.Parcel.writeBundle(Parcel.java:763)
at android.support.v4.app.FragmentState.writeToParcel(FragmentState.java:123)
at android.os.Parcel.writeTypedArray(Parcel.java:1306)
at android.support.v4.app.FragmentManagerState.writeToParcel(FragmentManager.java:619)
at android.os.Parcel.writeParcelable(Parcel.java:1495)
at android.os.Parcel.writeValue(Parcel.java:1401)
at android.os.Parcel.writeArrayMapInternal(Parcel.java:723)
at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1408)
at android.os.Bundle.writeToParcel(Bundle.java:1133)
at android.os.Parcel.writeBundle(Parcel.java:763)
at android.app.ActivityManagerProxy.activityStopped(ActivityManagerNative.java:3672)
at android.app.ActivityThread$StopInfo.run(ActivityThread.java:3770)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:159)
at android.app.ActivityThread.main(ActivityThread.java:6130)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
仕様ではなくバグです
https://console.firebase.google.com/project/fug202-e1f3d/crashlytics/app/android:jp.ac.titech.itpro.sdl.itspfug202/issues/5bd97740f8b88c2963f1dee0?time=last-seven-days&sessionId=5BD97B940035000178661533DD180421_DNE_0_v2
https://console.firebase.google.com/project/fug202-e1f3d/crashlytics/app/android:jp.ac.titech.itpro.sdl.itspfug202/issues/5bd97f1ff8b88c2963f2c14c?time=last-seven-days&sessionId=5BD980F502B8000112091533DD180421_DNE_0_v2
こっちについては再現ができて、自分の場合は検索窓に 240KB のテキストを入れて検索すると発生しました(あまり真剣に対応しなくても良さそうだけど検索窓に文字数制限をかけるのが丸いかな)
android:maxLength="100"
みたいな感じに1行付け足すだけで解決しそうな気持ちがある
対処法は2つ
1.検索窓を削除する
2.検索できるようにする
フラグメント内のViewにActivityからアクセスしようとしてぬるぽになっているようです
07-20 21:38:54.771 17442-17442/jp.ac.titech.itpro.sdl.itspfug202 E/AndroidRuntime: FATAL EXCEPTION: main
Process: jp.ac.titech.itpro.sdl.itspfug202, PID: 17442
java.lang.RuntimeException: Unable to start activity ComponentInfo{jp.ac.titech.itpro.sdl.itspfug202/jp.ac.titech.itpro.sdl.itspfug202.RestaurantDetailActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setText(java.lang.CharSequence)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2652)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2713)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1463)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:159)
at android.app.ActivityThread.main(ActivityThread.java:6130)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setText(java.lang.CharSequence)' on a null object reference
at jp.ac.titech.itpro.sdl.itspfug202.RestaurantDetailActivity.onCreate(RestaurantDetailActivity.java:47)
at android.app.Activity.performCreate(Activity.java:6743)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2605)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2713)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1463)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:159)
at android.app.ActivityThread.main(ActivityThread.java:6130)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
レストランデータを受け取った時、そのデータが適切でないとと落ちる。例外処理で受けるべき。
enumなのに配列の順番で代入を行ったり、使わないstringが残ったまま(どうしようもなさそう)になっていたりしてよろしくない。restaurantクラスの変数名も分かりにくい。
RestaurantDetailActivity で遷移元によって処理が異なるはずなのに、検索から遷移したときの処理がどちらでも実行されているのが怪しい。
10-10 15:47:44.481 11100-11100/jp.ac.titech.itpro.sdl.itspfug202 E/AndroidRuntime: FATAL EXCEPTION: main Process: jp.ac.titech.itpro.sdl.itspfug202, PID: 11100 java.lang.RuntimeException: Parcelable encountered IOException writing serializable object (name = jp.ac.titech.itpro.sdl.itspfug202.model.Restaurant) at android.os.Parcel.writeSerializable(Parcel.java:1526) at android.os.Parcel.writeValue(Parcel.java:1474) at android.os.Parcel.writeArrayMapInternal(Parcel.java:723) at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1408) at android.os.Bundle.writeToParcel(Bundle.java:1133) at android.os.Parcel.writeBundle(Parcel.java:763) at android.support.v4.app.FragmentState.writeToParcel(FragmentState.java:123) at android.os.Parcel.writeTypedArray(Parcel.java:1306) at android.support.v4.app.FragmentManagerState.writeToParcel(FragmentManager.java:619) at android.os.Parcel.writeParcelable(Parcel.java:1495) at android.os.Parcel.writeValue(Parcel.java:1401) at android.os.Parcel.writeArrayMapInternal(Parcel.java:723) at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1408) at android.os.Bundle.writeToParcel(Bundle.java:1133) at android.os.Parcel.writeBundle(Parcel.java:763) at android.app.ActivityManagerProxy.activityStopped(ActivityManagerNative.java:3672) at android.app.ActivityThread$StopInfo.run(ActivityThread.java:3770) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:159) at android.app.ActivityThread.main(ActivityThread.java:6130) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755) Caused by: java.io.NotSerializableException: jp.ac.titech.itpro.sdl.itspfug202.model.Restaurant$TimeSpanList at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1224) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1584) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1549) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1472) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1218) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346) at android.os.Parcel.writeSerializable(Parcel.java:1521)
デバイスの画面サイズの変化に対応させるためディスプレイの横幅の25%の正方形にするなどした方がいいかもしれないです。
FATAL EXCEPTION: main
Process: jp.ac.titech.itpro.sdl.itspfug202, PID: 10780
java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference
at jp.ac.titech.itpro.sdl.itspfug202.DetailInformationFragment$1.onResponse(DetailInformationFragment.java:86)
at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run(ExecutorCallAdapterFactory.java:68)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
現状ではRestaurantDetailActivityとDetailInformationFragmentの2か所にViewの操作の記述があります。
前者はランダム検索の際にwebAPIの返答を非同期に待つ必要から、後者は既に存在しているRestaurantモデルのデータを受け取って操作する必要からここに書かれています。
対策としてはランダム検索でwebAPIの返答後に画面遷移することで後者に記述を一元化できるはずです。
フィードバックからの引用
店舗情報が(ネットワークエラーなどで)取得できないときにその旨を表示してほしい
ボタンのデザインがなんとなく不満
いくつか案をあげてみたい
します
気持ちがある(要素を追加するときとかに楽になるし)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.