1

So I was basically searching around for a custom ViewGroup that could side-scroll and lock into place, and found one here: https://github.com/ysamlan/horizontalpager/tree/master/src/com/github/ysamlan/horizontalpager

Afterwards, I proceeded to edit my attrs.xml file like so:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <declare-styleable name="HorizontalPager">
    <attr name="handle" format="reference" />
    <attr name="content" format="reference" />
    <attr name="collapsedHeight" format="dimension" />
</declare-styleable>
</resources>

And so the problems with the main xml was fixed (or so Eclipse said):

<?xml version="1.0" encoding="utf-8"?>
<!--main.xml-->
<com.vrise.bellarmine.HorizontalPager      xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:cl="http://schemas.android.com/apk/res/com.vrise.bellarmine"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
 android:id="@+id/real_view_switcher">
<LinearLayout 
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffccd0"
>
     <TextView
        android:text="Countries List"
    android:textColor="#b3000d"
    android:gravity="center_vertical|center_horizontal"
    android:textSize="26dip"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:textStyle="bold"
    android:background="#ffb0b6"
    android:layout_marginBottom="5dip"
    android:typeface="sans"/>
 <RelativeLayout
  android:layout_width="fill_parent"
 android:layout_height="wrap_content"
 android:background="#570000">
 <TextView android:id="@+id/tv_1"
    android:textColor="#FFFFFF"
    android:gravity="center_vertical|left"
    android:textSize="16dip"
    android:layout_height="wrap_content"
    android:textStyle="bold"
    android:typeface="serif"
    android:layout_width="70dip"
    android:paddingLeft="20dip"
    android:text="Abbr">
 </TextView>
 <TextView android:id="@+id/tv_2"
    android:textColor="#FFFFFF"
    android:gravity="center_vertical|left"
    android:textSize="16dip"
    android:layout_height="wrap_content"
    android:textStyle="bold"
    android:typeface="serif"
    android:layout_width="200dip"
    android:layout_toRightOf="@+id/tv_1"
    android:text="Countries">
 </TextView>

</RelativeLayout>
<ListView
android:id="@+id/lv_country"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:cacheColorHint="#00000000">
</ListView>
 </LinearLayout>
  </com.vrise.bellarmine.HorizontalPager>

The error log, however, still gives me eclipse.buildId=M20110909-1335

Error
Thu Feb 16 02:05:50 PST 2012
com.vrise.bellarmine.HorizontalPager failed to instantiate.

java.lang.NullPointerException
at com.vrise.bellarmine.HorizontalPager.init(HorizontalPager.java:131)
at com.vrise.bellarmine.HorizontalPager.<init>(HorizontalPager.java:120)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)

What would be the reason for this? I think I did all of the things right...

Elias Wu
  • 71
  • 7

0 Answers0