LoginSignup
0

More than 3 years have passed since last update.

アンドロイドJavaでのIllegalArgumentException: No view found for id in fragmentsの対応

Last updated at Posted at 2019-06-28

いきなりでてきたIllegalArgumentException

初めて投稿してみます。
いつもは個人開発でアンドロイドアプリ作ってます。

最近エンジニアとして仕事を手に入れたので、来月7月から渋谷らへんで
働く予定です。どうぞよろしくお願いします。

さて、ちょっとこのエラーで1時間ほど潰してしまったのでシェア。

onCreate(savedInstanceState)が原因だったくさい

僕のコードだと、

super.onCreate(savedInstanceState);から
super.onCreate(null);へ変更

することで解決しました。

起動時のログイン画面部分だったのですが、バンドルのローディングがうまくいっていなかったよう。

こちらの変更でしっかりとコードが通っていたら、
savedInstanceStateが不要でしっかりとactivityが再生成されてるから問題なさげです。

参考

Understand the Activity Lifecycle
https://developer.android.com/guide/components/activities/activity-lifecycle

stackoverflow:"IllegalArgumentException: No view found for id in fragments"
https://stackoverflow.com/questions/28637046/illegalargumentexception-no-view-found-for-id-in-fragments

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0