1) What is the error you are getting?
2) What is ModesLvAdapter? You didn't provide that class.  You basically
gave us everything about your project except the ONE thing that has to do
with your question.

On Thu, Jul 23, 2015 at 5:56 AM gvi70000 <[email protected]> wrote:

> Here is how the UI should look like
>
>
> On Thursday, July 23, 2015 at 12:42:29 PM UTC+2, gvi70000 wrote:
>>
>> I would like to have your guidance to solve a problem that i have with my
>> first android app (SlidingTabLayout) I have the following
>> ViewPagerAdapter.java
>>
>> import android.support.v4.app.Fragment;
>> import android.support.v4.app.FragmentManager;
>> import android.support.v4.app.FragmentStatePagerAdapter;
>>
>> /**
>>  * Created by John on 6/12/2015.
>>  */
>> public class ViewPagerAdapter extends FragmentStatePagerAdapter {
>>
>>     CharSequence Titles[]; // This will Store the Titles of the Tabs which 
>> are Going to be passed when ViewPagerAdapter is created
>>     int NumbOfTabs; // Store the number of tabs, this will also be passed 
>> when the ViewPagerAdapter is created
>>
>>
>>     // Build a Constructor and assign the passed Values to appropriate 
>> values in the class
>>     public ViewPagerAdapter(FragmentManager fm, CharSequence mTitles[], int 
>> mNumbOfTabsumb) {
>>         super(fm);
>>
>>         this.Titles = mTitles;
>>         this.NumbOfTabs = mNumbOfTabsumb;
>>
>>     }
>>
>>     //This method return the fragment for the every position in the View 
>> Pager
>>     @Override
>>     public Fragment getItem(int position) {
>>         return Tab_Modes.init(position);
>>     }
>>
>>     // This method return the titles for the Tabs in the Tab Strip
>>
>>     @Override
>>     public CharSequence getPageTitle(int position) {
>>         return Titles[position];
>>     }
>>
>>     // This method return the Number of tabs for the tabs Strip
>>
>>     @Override
>>     public int getCount() {
>>         return NumbOfTabs;
>>     }
>> }
>>
>>
>> The custom data structure class
>>
>> /**
>>  * Created by John on 7/22/2015.
>>  */
>> public class NameImg {
>>     public String itemName;
>>     public String itemDesc;
>>     public int itemImg;
>>
>>     public NameImg() {
>>         super();
>>     }
>>
>>     public NameImg(String itemName, String itemDesc, int itemImg) {
>>         super();
>>         this.itemName = itemName;
>>         this.itemDesc = itemDesc;
>>         this.itemImg = itemImg;
>>     }
>>
>>     public String getName() {
>>         return this.itemName;
>>     }
>>
>>     public void setName(String itemName) {
>>         this.itemName = itemName;
>>     }
>>
>>     public String getDesc() {
>>         return this.itemDesc;
>>     }
>>
>>     public void setDesc(String itemDesc) {
>>         this.itemDesc = itemDesc;
>>     }
>>
>>     public int getImg() {
>>         return this.itemImg;
>>     }
>>
>>     public void setImg(int itemImg) {
>>         this.itemImg = itemImg;
>>     }
>>
>> }
>>
>>
>> and the tab
>>
>> /**
>>  * Created by John on 6/12/2015.
>>  */
>> public class Tab_Modes extends Fragment {
>>     int tab_idx;
>>     private ListView myLV;
>>
>>     static Tab_Modes init(int val) {
>>         Tab_Modes myTab = new Tab_Modes();
>>         // Supply val input as an argument.
>>         Bundle args = new Bundle();
>>         args.putInt("val", val);
>>         myTab.setArguments(args);
>>         return myTab;
>>     }
>>
>>     /**
>>      * Retrieving this instance's number from its arguments.
>>      */
>>
>>     public void onCreate(LayoutInflater inflater, ViewGroup container, 
>> Bundle savedInstanceState) {
>>         // super.onCreate(savedInstanceState);
>>         tab_idx = getArguments() != null ? getArguments().getInt("val") : 1;
>>
>>         NameImg usb[] = new NameImg[]
>>                 {
>>                         new NameImg("1", "USB1", R.drawable.hand),
>>                         new NameImg("2", "USB2", R.drawable.bulb),
>>                         new NameImg("3", "USB3", R.drawable.bullet)
>>                 };
>>         NameImg[][] list_NameImg = new NameImg[][]{basic, spi, i2c, usb};
>>         ModesLvAdapter adapter = new ModesLvAdapter(this, R.layout.my_list, 
>> list_NameImg[tab_idx][]);
>>         myLV = (ListView) myLV.findViewById(R.id.customListView);
>>         View v = inflater.inflate(R.layout.my_list, null);
>>         myLV.setAdapter(adapter);
>>     }
>> }
>>
>>
>> The activity_main.xml
>>
>> LinearLayout 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"
>>     android:orientation="vertical"
>>     tools:context=".MainActivity">
>>
>>     <include
>>         android:id="@+id/tool_bar"
>>         layout="@layout/tool_bar"
>>         android:layout_height="wrap_content"
>>         android:layout_width="match_parent"
>>         />
>>
>>     <com.grozeaion.www.gvicameraremotecontrol.SlidingTabLayout
>>         android:id="@+id/tabs"
>>         android:layout_width="match_parent"
>>         android:layout_height="wrap_content"
>>         android:elevation="2dp"
>>         android:background="@color/ColorPrimary"/>
>>
>>     <android.support.v4.view.ViewPager
>>         android:id="@+id/pager"
>>
>>         android:layout_height="match_parent"
>>         android:layout_width="match_parent"
>>         android:layout_weight="1"
>>         ></android.support.v4.view.ViewPager>
>>
>> </LinearLayout>
>>
>>
>> tab_bodes.xml
>>
>> <?xml version="1.0" encoding="utf-8"?>
>> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android";
>>     android:layout_width="match_parent"
>>     android:layout_height="match_parent">
>>
>>
>>    <ListView
>>         android:id="@+id/customListView"
>>         android:layout_width="match_parent"
>>         android:layout_height="wrap_content"
>>         android:layout_alignParentLeft="true"
>>         android:layout_alignParentTop="true" >
>>     </ListView>
>> </LinearLayout>
>>
>>
>>
>> and my_list.xml
>>
>> <?xml version="1.0" encoding="utf-8"?>
>> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android";
>>     android:layout_width="match_parent"
>>     android:layout_height="match_parent"
>>     android:orientation="horizontal" >
>>
>>     <ImageView
>>         android:id="@+id/item_icon"
>>         android:layout_width="60dp"
>>         android:layout_height="60dp"
>>     android:padding="5dp" />
>>
>>     <LinearLayout android:layout_width="wrap_content"
>>         android:layout_height="wrap_content"
>>         android:orientation="vertical">
>>
>>     <TextView
>>         android:id="@+id/item_name"
>>         android:layout_width="wrap_content"
>>         android:layout_height="wrap_content"
>>         android:text="Medium Text"
>>         android:textAppearance="?android:attr/textAppearanceMedium"
>>         android:layout_marginLeft="10dp"
>>         android:layout_marginTop="5dp"
>>         android:padding="2dp"
>>         android:textColor="#33CC33" />
>>
>>         <TextView android:id="@+id/item_desc"
>>             android:layout_height="wrap_content"
>>             android:layout_width="wrap_content"
>>             android:paddingLeft="8dip"
>>             android:paddingBottom="6dip"
>>             android:textSize="15dip"
>>             android:layout_below="@id/item_name"/>
>>     </LinearLayout>
>> </LinearLayout>
>>
>>
>> i dont know what i am doing wrong when i try to call the adapter
>>
>>  ModesLvAdapter adapter = new ModesLvAdapter(this, R.layout.my_list, 
>> list_NameImg[tab_idx][]);
>>
>>
>> Any help is much appreciated.
>>
>>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Android Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to