Cousin Romeo
Cousin Romeo

Reputation: 11

Android ViewPagerIndicator errors

Chcę zrobić Android Viewpager as Image Slide Gallery.

I have this ( Unfortunately, I have errors.):

Code + LogCat

To moderators: Please paste code here because i can't... I have errors.

Upvotes: 0

Views: 192

Answers (1)

A--C
A--C

Reputation: 36449

You are definitely to launch a Fragment as an Activity

<activity
        android:name="com.test.PlaceDetailsFragment"
</activity>

Fragments are contained in Activities; you cannot launch a Fragment as an Activity - they're not interchangable. This means that you have to make a SherlockActivity that holds your Fragment (call the Activity MainActivity - simple and meaningful name), then you should be able to get everything launched (not guaranteeting the Fragment code is proper, there's too much code to look at). Start with this tutorial, then move on to this tutorial. They both give you a lot of information about how to properly build android apps. Then once you've grasped the subject, don't forget to change your manifest so it points to the Activity instead.

<activity
    android:name="com.test.MainActivity"
    android:label="@string/app_name" >
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

Eg, in your main.xml layout, you should have:

<fragment   android:name="com.test.PlaceDetailsFragment"
            android:id="@+id/fragment"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

Upvotes: 1

Related Questions