0

I am trying to add the following library:

https://github.com/infospace/android_oauth2_webview

to my project but I am getting an error:

Class is not a View android.support.v4.app.Fragment

(I also updated the v4 support libraries for the library and my project) Here's my main page on project:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"

tools:context=".MainActivity" >
<android.support.v4.app.Fragment
    android:id="@+id/webview"
    android:name="com.infospace.android.oauth2.AuthenticationFragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
     />

</RelativeLayout>

What am I doing wrong?

vvvvv
  • 25,404
  • 19
  • 49
  • 81
dinbrca
  • 1,101
  • 1
  • 14
  • 30

1 Answers1

0

You need to use a FragmentActivity instead of Activity if you are including Fragments from the support library.

corsair992
  • 3,050
  • 22
  • 33
  • at first it was fragment which gave me: "Error inflating class fragment", until i saw http://stackoverflow.com/questions/11873794/error-inflating-class-fragment-class-not-found-android-view-fragment-but-i-am-in any other idea? – dinbrca Jan 03 '14 at 12:22
  • @dinbrca: Sorry, my answer was wrong; I saw this answer accepted on a similar question and copied it without thinking. Are you using `FragmentActivity` where this layout is inflated? – corsair992 Jan 03 '14 at 17:15
  • No.. The library uses Fragment and not FragmentActivity. Although - I have tried to convert it manually from Fragment to FragmentActivity and got another error.. – dinbrca Jan 03 '14 at 18:22
  • @dinbrca: You need to convert your `Activity`s to `FragmentActivity`s if you are using `Fragment`s from the support library. – corsair992 Jan 03 '14 at 18:25
  • I already tried converting from fragment to FragmentActivity.. it gives me "Class is not a View android.support.v4.app.FragmentActivity" – dinbrca Jan 03 '14 at 19:49
  • @dinbrca: You need to convert your **`Activity`** to `FragmentActivity`, *not* `Fragment`. – corsair992 Jan 03 '14 at 19:53