Re: Fragments Tutorial

810 views
Skip to first unread message

Lars Vogel

unread,
Nov 23, 2012, 9:06:17 AM11/23/12
to vog...@googlegroups.com
Should be fixed now. 

Thanks!

2012/11/21 Syannako <syan...@gmail.com>
Greetings,
I am trying to complete the Fragments tutorial (chapter 18) but i run into the following problem. The step 18.5 contains the following:

<code>Intent intent = new Intent(getActivity().getApplicationContext(),
          DetailActivity.class);</code>

But there is no DetailActivity in the current chapter. In the next chapter there is indeed a DetailActivity activity but it refers to portrait mode.

--
You received this message because you are subscribed to the Google Groups "vogella" group.
To view this discussion on the web visit https://groups.google.com/d/msg/vogella/-/n1qunMQsL6QJ.
To post to this group, send email to vog...@googlegroups.com.
To unsubscribe from this group, send email to vogella+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/vogella?hl=en.


Lars Vogel

unread,
Nov 27, 2012, 3:40:05 PM11/27/12
to vog...@googlegroups.com, syan...@gmail.com
Yes, log would be helpful.

2012/11/26 Gus <gus....@gmail.com>
I am currently trying to learn about fragments and i am trying to run on emulator this tutorial. I haven't changed anything on the code and i am getting everytime fc(unfortunately, RSS Reader has stoped when i run the app. The emulator is running android 4.1. I get on logcat mistakes which i can not understand or locate on code because i am newbie on android programming and in developing on eclipse.

P.S If needed i can post the log

--
You received this message because you are subscribed to the Google Groups "vogella" group.
To view this discussion on the web visit https://groups.google.com/d/msg/vogella/-/X24P7UhCLTQJ.

Lars Vogel

unread,
Jan 29, 2013, 12:54:20 PM1/29/13
to vog...@googlegroups.com
Hi,

I suggest not to use the support library for this tutorial.
com.example.android.rssfeed.MyListFragment should be extending the
normal Fragment and not the support one.

Best regards, Lars

2013/1/29 Leonardo <leon...@fivesistemas.com.br>:
> I'm having the same problem. I haven't changed anything on the code. The error in log is:
>
> java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.android.rssreader/com.example.android.rssreader.RssFeedActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
>
> Caused by: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment com.example.android.rssfeed.MyListFragment: make sure class name exists, is public, and has an empty constructor that is public
> To unsubscribe from this group and stop receiving emails from it, send an email to vogella+u...@googlegroups.com.
> To post to this group, send email to vog...@googlegroups.com.
> Visit this group at http://groups.google.com/group/vogella?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Lars Vogel

unread,
Jan 29, 2013, 1:16:28 PM1/29/13
to vog...@googlegroups.com
Not according to the error message you posted.

Best regards, Lars

2013/1/29 Leonardo <leon...@fivesistemas.com.br>:
> But I'm using the normal Fragment.
>
> Em terça-feira, 29 de janeiro de 2013 15h54min20s UTC-2, vogella escreveu:
>> Hi,
>>
>>
>>
>> I suggest not to use the support library for this tutorial.
>>
>> com.example.android.rssfeed.MyListFragment should be extending the
>>
>> normal Fragment and not the support one.
>>
>>
>>
>> Best regards, Lars
>>
>>
>

Lars Vogel

unread,
Jan 29, 2013, 1:37:09 PM1/29/13
to vog...@googlegroups.com
Can you post the full error trace?

2013/1/29 Leonardo <leon...@fivesistemas.com.br>:
> Sorry, but I was trying others ways. But the error is the same.
>
> Caused by: android.app.Fragment$InstantiationException: Unable to instantiate fragment com.example.android.rssfeed.MyListFragment: make sure class name exists, is public, and has an empty constructor that is public
>
>
>
> Em terça-feira, 29 de janeiro de 2013 16h16min28s UTC-2, vogella escreveu:
>> Not according to the error message you posted.
>>
>>
>>
>> Best regards, Lars
>>
>>
>>
>

Lars Vogel

unread,
Feb 4, 2013, 5:07:57 PM2/4/13
to vog...@googlegroups.com
I doubt that this is really the full error trace, Android error
messages are typically longer. Sorry can't help you based on this
little information.

2013/1/29 Leonardo <leon...@fivesistemas.com.br>:
>
>
> java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.android.rssreader/com.example.android.rssreader.RssFeedActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
>
> Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
>
> Caused by: android.app.Fragment$InstantiationException: Unable to instantiate fragment com.example.android.rssfeed.MyListFragment: make sure class name exists, is public, and has an empty constructor that is public
>
> Em terça-feira, 29 de janeiro de 2013 16h37min09s UTC-2, vogella escreveu:
>> Can you post the full error trace?
>>
>>
>

Lars Vogel

unread,
Mar 5, 2013, 6:34:08 PM3/5/13
to vog...@googlegroups.com
Can you describe the problem you are facing? I don't remember this discussion.

Best regards, Lars

2013/3/5 Gus <gus....@gmail.com>
The problem still persists. The only logical explanation is that i am doing something wrong with the DetailFragment and MyListFragment registration in manifest xml.

sorry for my ignorance but i am a newbie in android developing and i am trying to understand what is going on.

Steen Hansen

unread,
Jun 14, 2013, 3:27:33 AM6/14/13
to vog...@googlegroups.com
I may have a solution to this problem. I were struggling with this for a day and finally when desperation set in I did the following:
1. Open project->Properties->Android
2. Check Android 3.0 in Project Build Target
3. Run the app again

For some reasons I could not get it to work with Android 4.2.2? but now it works fine and the "Binary XML file line #7: Error inflating class fragment" error is gone!

Best regards,
Steen

Reply all
Reply to author
Forward
0 new messages