Ok I've solved my problem...
I was using a custom adapter for my listview in the main activity; I've modified this adapter for a fragment and used it in the FirstActivity() instead in the MainActivity().
Question
I've been trying to fix a problem that I'm facing for hours now; My ViewPagerIndicator works fine, I can switch properly between tabs and even can see the content in Fragments properly as long as it's not a ViewList... The ViewPager can't seem to display any ListView in any way!
Note: -when hovering over android.support.v4.view.ViewPager I get a "This element neither has attached source nor attached Javadoc and hence no Javadoc could be found"; I don't know if it's related to my problem since it wasn't mention when I was searching a fix.
-the setAdapter(..) (to set the content of my ListView) won't work also; I guess it's related to the problem also.
Please if anyone can help me I'd apperciate it.
Thanks in advance.
(Will post my code if anyone is willing to help :) )
EDIT:
Thanks a lot Yatin for your quick reply :) I have 4 tabs that I can switch between.. for testing I made a tab which contains a button and a listview.. the button is displayed properly but the listview wont show...
bottom.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/mainbottom"
android:orientation="horizontal" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<ListView
android:id="@+id/secondlist"
android:layout_width="192dp"
android:layout_height="721dp"
android:layout_weight="0.45"
tools:listitem="@android:layout/simple_list_item_2" >
</ListView>
</LinearLayout>
main.xml
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="650dp">
<com.viewpagerindicator.TitlePageIndicator
android:id="@+id/indicator"
android:padding="10dip"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:background="#000000"
android:textColor="#2FB3E3"
app:footerColor="#2FB3E3"
app:footerLineHeight="1dp"
app:footerIndicatorHeight="3dp"
app:footerIndicatorStyle="underline"
app:selectedColor="#FFFFFF"
app:selectedBold="true"
/>
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
/>
</LinearLayout>
FragmentAdapter.java
public FragmentAdapter(FragmentManager fm) {
super(fm);
}
@Override
public int getIconResId(int index) {
return 0;
}
@Override
public android.support.v4.app.Fragment getItem(int position)
{
android.support.v4.app.Fragment fragment = new FirstActivity();
switch(position){
case 0:
fragment = new FirstActivity();
break;
case 1:
fragment = new SecondActivity();
break;
case 2:
fragment = new ThirdActivity();
break;
case 3:
fragment = new FourthActivity();
break;
}
return fragment;
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return 4;
}
@Override
public CharSequence getPageTitle(int position){
String title = "";
switch(position){
case 0:
title = "First";
break;
case 1:
title = "Second";
break;
case 2:
title = "Third";
break;
case 3:
title = "Fourth";
break;
}
return title;
}
}
Solution
Ok I've solved my problem...
I was using a custom adapter for my listview in the main activity; I've modified this adapter for a fragment and used it in the FirstActivity() instead in the MainActivity().