I want to make a vertically side view pager in my fragment
i tried Like this, but i don't know to how to pass view back to women class form TestFragment class
This is my main class
public class women extends Fragment
{
#Override
public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstance)
{
startActivity(new Intent(getActivity(), women_activity.class));
return null;
}
public class women_activity extends FragmentActivity{
View view;
#SuppressLint("ShowToast")
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.frgment_1);
//Set up the pager
DirectionalViewPager pager = (DirectionalViewPager)findViewById(R.id.pager);
pager.setAdapter(new TestFragmentAdapter(getSupportFragmentManager()));
pager.setOrientation(DirectionalViewPager.VERTICAL);
}
}
TestFragmentAdapter class
public class TestFragmentAdapter extends FragmentPagerAdapter {
protected static final String[] CONTENT = new String[] { "This", "Is Is", "A A A", "Test", };
public TestFragmentAdapter(FragmentManager fm) {
super(fm);
// TODO Auto-generated constructor stub
}
#Override
public int getCount() {
// TODO Auto-generated method stub
return CONTENT.length;
}
#Override
public Fragment getItem(int position) {
// TODO Auto-generated method stub
return TestFragment.newInstance(CONTENT[position]);
}
}
TestFragment Class
public class TestFragment extends Fragment{
View mView,layout ;
ViewPager mViewPager;
private String mContent="????";
private static final String KEY_CONTENT = "TestFragment:Content";
#SuppressWarnings("deprecation")
#Override
public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState)
{
//mView = inflater.inflate(R.layout.frgment_1, container,false);
if ((savedInstanceState != null) && savedInstanceState.containsKey(KEY_CONTENT)) {
mContent = savedInstanceState.getString(KEY_CONTENT);
}
TextView text = new TextView(getActivity());
text.setText(mContent);
text.setTextSize(20 * getResources().getDisplayMetrics().density);
text.setPadding(20, 20, 20, 20);
text.setGravity(Gravity.CENTER);
LinearLayout layout = new LinearLayout(getActivity());
layout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
layout.setGravity(Gravity.CENTER);
layout.addView(text);
return layout;
}
public static TestFragment newInstance(String content) {
TestFragment fragment = new TestFragment();
StringBuilder builder = new StringBuilder();
for (int i = 0; i < 30; i++) {
builder.append(content).append(" ");
}
builder.deleteCharAt(builder.length() - 1);
fragment.mContent = builder.toString();
return fragment;
}
Related
in my App i have Gridview and TabActivity.
my Rice.class has gridview,
in MainActivity.class has tabActivity ,
myChild Tabs are FragmentA,FragmentB,FragmnetC.
i want pass my gridview index to FragmnetA.how can i slove this problem.
Rice.class
public class Rice extends ActionBarActivity {
FragmentA fa;
GridView gridView;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_rice);
gridView=(GridView) findViewById(R.id.gridViewR);
gridView.setAdapter(new MyRAdapter(this));
Intent intent = getIntent();
//Breakfast bf = (Breakfast) getFragmentManager().findFragmentById(R.id.fragment2);
gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
Intent intent = new Intent(getApplicationContext(),MainActivity.class);
intent.putExtra("index",i);
startActivity(intent);
}
});
}
}
class MyRAdapter extends BaseAdapter {
private Context mContext;
public MyRAdapter(Context c) {
mContext = c;
}
public int getCount() {
return mThumbIds.length;
}
public Object getItem(int position) {
return null;
}
public long getItemId(int position) {
return 0;
}
public View getView(int position, View convertView, ViewGroup parent) {
ImageView imageView;
if (convertView == null) { // if it's not recycled, initialize some attributes
imageView = new ImageView(mContext);
//imageView.setLayoutParams(new GridView.LayoutParams(450, 200));
//imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
//imageView.setPadding(5, 5, 5, 5);
} else {
imageView = (ImageView) convertView;
}
imageView.setImageResource(mThumbIds[position]);
return imageView;
}
private Integer[] mThumbIds = {
R.drawable.back_1, R.drawable.back_2,
R.drawable.back_3, R.drawable.back_4,
R.drawable.back_5, R.drawable.back_6,
R.drawable.back_11,
};
}
MainActivity.class
public class MainActivity extends FragmentActivity {
ViewPager viewPager=null;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
viewPager = (ViewPager) findViewById(R.id.pager);
FragmentManager fragmentManager = getSupportFragmentManager();
viewPager.setAdapter(new MyFrAdapter(fragmentManager));
Intent intent = getIntent();
int index = intent.getIntExtra("index",0);
}
}
class MyFrAdapter extends FragmentPagerAdapter{
public MyFrAdapter(FragmentManager fm) {
super(fm);
}
#Override
public Fragment getItem(int i) {
Fragment fragment = null;
if(i==0){
fragment = new FragmentA();
}
if(i==1){
fragment = new FragmentB();
}
if(i==2){
fragment = new FragmentC();
}
return fragment;
}
#Override
public int getCount() {
return 3;
}
#Override
public CharSequence getPageTitle(int position) {
if(position == 0){
return "Ingredient";
}
if(position == 1){
return "Recipe";
}
if(position == 2){
return "Summary";
}
return null;
}
}
FragmentA.class
public class FragmentA extends Fragment {
TextView textView;
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_a,container,false);
textView = (TextView) view.findViewById(R.id.textView);
return view;
}
}
public class MainActivity extends FragmentActivity {
int mIndex;
ViewPager viewPager=null;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
viewPager = (ViewPager) findViewById(R.id.pager);
FragmentManager fragmentManager = getSupportFragmentManager();
viewPager.setAdapter(new MyFrAdapter(fragmentManager));
Intent intent = getIntent();
mIndex = intent.getIntExtra("index",0);
}
class MyFrAdapter extends FragmentPagerAdapter{
public MyFrAdapter(FragmentManager fm) {
super(fm);
}
#Override
public Fragment getItem(int i) {
Fragment fragment = null;
if(i==0){
fragment = new FragmentA().newInstance(mIndex);
}
if(i==1){
fragment = new FragmentB();
}
if(i==2){
fragment = new FragmentC();
}
return fragment;
}
#Override
public int getCount() {
return 3;
}
#Override
public CharSequence getPageTitle(int position) {
if(position == 0){
return "Ingredient";
}
if(position == 1){
return "Recipe";
}
if(position == 2){
return "Summary";
}
return null;
}
}
}
//...
public class FragmentA extends Fragment {
TextView textView;
int FragmentA_index;
public static final String EXTRA_INDEX = "mypackage.index";
public static FragmentA newInstance(int index) {
Bundle args = new Bundle();
args.putInt(EXTRA_INDEX, index);
FragmentA fragment = new FragmentA();
fragment.setArguments(args);
return fragment;
}
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FragmentA_index = getArguments().getInt(EXTRA_INDEX);
}
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_a,container,false);
textView = (TextView) view.findViewById(R.id.textView);
return view;
}
}
I have a viewpager with image fragments in it that works but on back was getting an error saying that there is no empty constructor. I made one but now my images don't show up because imageResourceId is null. I've tried a million things and can't figure it out.
public final class TestFragment extends Fragment {
String imageResourceId;
public TestFragment() {
}
public TestFragment(String cONTENT) {
imageResourceId = cONTENT;
}
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
ImageView image = new ImageView(getActivity());
new DownloadImageTask((ImageView) image).execute(imageResourceId);
LinearLayout layout = new LinearLayout(getActivity());
layout.setGravity(Gravity.CENTER);
layout.addView(image);
return layout;
}
}
class TestFragmentAdapter extends FragmentPagerAdapter implements
IconPagerAdapter {
public String[] CONTENT;
private int mCount;
protected static final int[] ICONS = new int[] {
R.drawable.perm_group_calendar, R.drawable.perm_group_camera,
R.drawable.perm_group_device_alarms, R.drawable.perm_group_location };
public TestFragmentAdapter(FragmentManager fm, JSONArray photoData) {
super(fm);
// photoData = (JSONArray) userProfile.get("photos");
CONTENT = new String[photoData.length()];
mCount = photoData.length();
for (int i = 0; i < photoData.length(); i++) {
JSONObject mainPhoto;
try {
mainPhoto = photoData.getJSONObject(i);
CONTENT[i] = mainPhoto.getString("src_big");
} catch (JSONException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
notifyDataSetChanged();
}
#Override
public Fragment getItem(int position) {
return new TestFragment(CONTENT[position]);
}
#Override
public int getCount() {
return mCount;
}
#Override
public int getIconResId(int index) {
return ICONS[index % ICONS.length];
}
public void setCount(int count) {
if (count > 0 && count <= 10) {
mCount = count;
notifyDataSetChanged();
}
}
in the activity
mAdapter = new TestFragmentAdapter(
getSupportFragmentManager(), photoData);
mPager = (ViewPager) findViewById(R.id.pager);
mPager.setAdapter(mAdapter);
mIndicator = (LinePageIndicator) findViewById(R.id.indicator);
mIndicator.setViewPager(mPager);
Android uses the empty constructor of a fragment to restore the fragment when there is a configuration change, that's why you can't modify it, and you can't override it because you get an error in eclipse. The best practice to pass arguments to a fragment, when instantiating it, is to use an static factory method:
public class TestFragment extends Fragment {
String imageResourceId;
public static TestFragment newInstance(String resource) {
TestFragment f = new TestFragment();
Bundle args = new Bundle();
args.putString("Resource", resource);
f.setArguments(args);
return f;
}
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
imageResourceId = getArguments().getString("Resource");
}
}
To instanciate it you use the static method:
TestFragment fragment = TestFragment.newInstance("some string");
Need help to fix a code I saw in a https://stackoverflow.com/a/9275732/1938357. The solution I need is get the current view onany page in my viewpager based application
Below is the code for reference
public View getCurrentView(ViewPager pager) {
for (int i = 0; i < pager.getChildCount(); i++) {
View child = pager.getChildAt(i);
if (child.getX() <= pager.getScrollX() + pager.getWidth()
&& child.getX() + child.getWidth() >= pager.getScrollX() + pager.getWidth()) {
return child;
}
}
return getChildAt(0);
I am trying to access the current view in the view pager and used the code above. It works fine when I scroll forwards. But when I scroll backwards then after 2 backward scrolls this stops working.
Public class myActivity extends FragmentActivity
//Variable declarations
protected void onCreate(Bundle savedInstanceState) {
ViewPager mPager = (ViewPager) findViewById(R.id.pager);
mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
mPager.setAdapter(mPagerAdapter);
View CurrView;
OnPageChangeListener pageChangelistener = new OnPageChangeListener() {
#Override
public void onPageSelected(int pageSelected) {
doTextViewChnges();//access the text view and update it based on pageSelected
---THIS IS WHERE I AM STUCK IN TRYING TO GET THE TEXTVIEW IN MY CURRENT FRAGMWNT/VIEW-------
}
mPager.setOnPageChangeListener(pageChangelistener);
}
private class ScreenSlidePagerAdapter extends FragmentStatePagerAdapter {
public ScreenSlidePagerAdapter(android.support.v4.app.FragmentManager fm) {
super(fm);
}
#Override
public android.support.v4.app.Fragment getItem(int position) {
return ScreenSlidePageFragment.create(position, <other parameters I want to pass>);
}
#Override
public int getCount() {
return NUM_PAGES;
}
}
And below is my ScreenSlidePageFragment class
public class ScreenSlidePageFragment extends android.support.v4.app.Fragment {
public static final String ARG_PAGE = "pagenumber";
public static final String ARG_PAGEARRAY = "pages";
private int mPageNumber;
//Declare other variables
#SuppressLint("NewApi")
public static ScreenSlidePageFragment create(int pageNumber, String[] pages, int bookmarkPageNumber, String storyName, int linesInOnePage) {
ScreenSlidePageFragment fragment = new ScreenSlidePageFragment();
Bundle args = new Bundle();
args.putInt(ARG_PAGE, pageNumber);
args.putStringArray(ARG_PAGEARRAY, pages);
fragment.setArguments(args);
return fragment;
}
#SuppressLint("NewApi")
public ScreenSlidePageFragment() {
}
#SuppressLint("NewApi")
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mPageNumber = getArguments().getInt(ARG_PAGE);
pages = getArguments().getStringArray(ARG_PAGEARRAY);
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
rootView = (ViewGroup) inflater
.inflate(R.layout.activity_story, container, false);
//load layout with all components filled up for that page
loadView(rootView);
return rootView;
}
public int getPageNumber() {
return mPageNumber;
}
It is very hard to discuss in comments with example of code.
As I see in grepcode FragmentStatePagerAdapter.setPrimaryItem(), receive object as android.support.v4.app.Fragment. But you are receive ClassCastException when trying to cast object as Fragment. Can you check your casting: do you really cast object in android.support.v4.app.Fragment not in android.app.Fragment? If all right, add your exception message to your question, please.
UPDATE:
If your ScreenSlidePagerAdapter has method getCurrentView(), then your method 'getCurrentView()' can work like this:
public View getCurrentView(ViewPager pager) {
return ((ScreenSlidePagerAdapter) pager.getAdapter()).getCurrentView();
}
And method getCurrentView() of your ScreenSlidePagerAdapter:
public View getCurrentView() {
return currView;
}
UPDATE 2:
I've made some modification with your code:
Your Activity with private Adapter:
public class myActivity extends FragmentActivity implements ISelectItemListener {
// Your variable declarations and methods
#Override
protected void onCreate(Bundle savedInstanceState) {
final ViewPager pager = (ViewPager) findViewById(R.id.pager);
mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
pager.setAdapter(mPagerAdapter);
pager.setOnPageChangeListener(
new OnPageChangeListener() {
#Override
public void onPageSelected(int pageSelected) {
final ScreenSlidePageFragment fragment = mPagerAdapter.getFragment(pageSelected);
if (fragment != null) {
fragment.doTextViewChnges();
}
}
#Override
public void onPageScrollStateChanged(int arg0) {
// TODO Auto-generated method stub
}
#Override
public void onPageScrolled(int arg0, float arg1, int arg2) {
// TODO Auto-generated method stub
}
});
}
private class ScreenSlidePagerAdapter extends FragmentStatePagerAdapter {
//Your variable declarations
private final ScreenSlidePageFragment[] mFragments;
public ScreenSlidePagerAdapter(android.support.v4.app.FragmentManager fm) {
super(fm);
mFragments = new ScreenSlidePageFragment[NUM_PAGES];
}
#Override
public int getCount() {
return NUM_PAGES;
}
// It will create new ScreenSlidePageFragment by position if it's not exsist
#Override
public android.support.v4.app.Fragment getItem(int position) {
if (getFragment(position) == null) {
mFragments[position] = ScreenSlidePageFragment.create(position, <other parameters I want to pass>);
}
return getFragment(position);
}
// It will give you ScreenSlidePageFragment if it's exists, or null
public ScreenSlidePageFragment getFragment(int position) {
return mFragments[position];
}
}
}
Your Fragment:
public class ScreenSlidePageFragment extends Fragment {
//Your variables and methods
public static ScreenSlidePageFragment create(int pageNumber, String[] pages, int bookmarkPageNumber, String storyName, int linesInOnePage) {
final Bundle args = new Bundle();
args.putInt(ARG_PAGE, pageNumber);
args.putStringArray(ARG_PAGEARRAY, pages);
final ScreenSlidePageFragment fragment = new ScreenSlidePageFragment();
fragment.setArguments(args);
return fragment;
}
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mPageNumber = getArguments().getInt(ARG_PAGE);
pages = getArguments().getStringArray(ARG_PAGEARRAY);
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
rootView = (ViewGroup) inflater.inflate(R.layout.activity_story, container, false);
loadView(rootView);
return rootView;
}
public int getPageNumber() {
return mPageNumber;
}
// Let's keep logic of modifications in fragment
public void doTextViewChnges() {
final View view = getView();
// do what you want with your View and his children
}
}
This code is very simple. I have a ViewPager with several Fragment inside. And a "Add new pager" button to add new pager to the first position of ViewPager.
Here is my code
public class TestPagerActivity extends SherlockFragmentActivity {
private ArrayList<String> mData = new ArrayList<String>();
private ViewPager mPager;
private TestPagerAdapter mAdapter;
#Override
protected void onCreate(Bundle b) {
// TODO Auto-generated method stub
super.onCreate(b);
setContentView(R.layout.testpager);
mData.add("Looking");
mData.add("into");
mData.add("your");
mData.add("dark");
mData.add("blue");
mData.add("eyes");
mPager = (ViewPager) findViewById(R.id.pager);
mAdapter = new TestPagerAdapter(getSupportFragmentManager(), mData);
mPager.setAdapter(mAdapter);
}
public void onAddNewPagerClick(View v) {
mData.add(0, "When");
mAdapter.notifyDataSetChanged();
mPager.invalidate();
}
public static class TestPagerAdapter extends FragmentStatePagerAdapter {
private List<String> mData;
public TestPagerAdapter(FragmentManager fm) {
super(fm);
}
public TestPagerAdapter(FragmentManager fm, List<String> data) {
super(fm);
mData = data;
}
public void updateAdapter(List<String> data) {
mData = data;
notifyDataSetChanged();
}
#Override
public Fragment getItem(int position) {
return TestFragment.newInstance(mData.get(position), position + "/" + mData.size());
}
#Override
public int getCount() {
return mData.size();
}
}
public static class TestFragment extends SherlockFragment {
private static final String KEY_CONTENT = "TestFragment:Content";
private static final String KEY_POSITION = "TestFragment:Position";
public static TestFragment newInstance(String content, String position) {
TestFragment fragment = new TestFragment();
StringBuilder builder = new StringBuilder();
builder.append("Page ").append(position).append("\n");
for (int i = 0; i < 20; i++) {
builder.append(content).append(" ");
}
builder.deleteCharAt(builder.length() - 1);
fragment.mContent = builder.toString();
return fragment;
}
private String mContent = "???";
private String mPosition = "x/y";
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if ((savedInstanceState != null) && savedInstanceState.containsKey(KEY_CONTENT)) {
mContent = savedInstanceState.getString(KEY_CONTENT);
mPosition = savedInstanceState.getString(KEY_POSITION);
}
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
TextView text = new TextView(getActivity());
text.setGravity(Gravity.CENTER);
text.setText(mContent);
text.setTextSize(20 * getResources().getDisplayMetrics().density);
text.setPadding(20, 20, 20, 20);
LinearLayout layout = new LinearLayout(getActivity());
layout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
layout.setGravity(Gravity.CENTER);
layout.addView(text);
return layout;
}
#Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putString(KEY_CONTENT, mContent);
outState.putString(KEY_POSITION, mPosition);
}
}
}
The problem is: when I refresh the ViewPager after adding a new pager, its content doesn't display correctly. At the beginning, I have 6 pages, but after adding a new one, there are still 6 pages displayed here while I expect 7 pages.
Can anyone tell me what's wrong here? Thanks for any advise.
The first thing that stands out is that you're inserting new items at the front of your list of pages, yet you haven't implemented the PagerAdapter method getItemPosition(Object) to tell the ViewPager where pages have moved after a data set change. As the method's documentation states, the default implementation reports that pages never change positions. A ViewPager with pages that change position will not behave properly if your adapter does not correctly implement this method.
avoid FragmentPagerAdapter and use FragmentStatePagerAdapter.
I hope it will work for you also.
Hiho!
I use a ViewPager with fragmenst in my Android App. The fragments are working, but lose the displayed data. So at the firts call off my View Adapter, I can set data to the LinearLayout from fragments 1 and 2, the fragment 3 is not available. So I put data on fragment 1 and 2. When I now switch the fragmenst from one to three, the fragment on number one loses the data and get blank. How can I fix the data to display that it es displayed all of the time? If to create the information dynamicly and not in a xml file.
I hope you understand me and can help me.
public class PageAdapter extends FragmentStatePagerAdapter {
private int num_pages;
private String[] titles;
public PageAdapter(FragmentManager fm) {
super(fm);
// TODO Auto-generated constructor stub
}
#Override
public Fragment getItem(int pos) {
PageFragment f = new PageFragment(pos);
return f;
}
#Override
public int getCount() {
// TODO Auto-generated method stub
return num_pages;
}
#Override
public CharSequence getPageTitle(int position){
return titles[position];
}
public void set_num_pages(int num){
num_pages=num;
}
public void set_titles(String[] a_titles){
titles=a_titles;
}
}
Next class:
public class PageFragment extends Fragment {
private int fragmentNR;
public PageFragment(){}
public PageFragment(int nr) {
this.fragmentNR = nr;
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = new View(getActivity());
if (fragmentNR == 0)
v = inflater.inflate(R.layout.info_1, container, false);
else if (fragmentNR == 1)
v = inflater.inflate(R.layout.info_2, container, false);
else if (fragmentNR == 2)
v = inflater.inflate(R.layout.info_3, container, false);
return v;
}
}
Next class:
public class MannschaftInfos extends FragmentActivity {
private String mannschaftInfos;
private int mannschaftID;
private int anzahl;
private String[] titel = new String[3];
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// set the callback listener, to receive a message when an ad was loaded
mannschaftID = getIntent().getExtras().getInt("id");
titel[0]=(String) this.getText(R.string.Info);
titel[1]=(String) this.getText(R.string.aufstellung);
titel[2]=(String) this.getText(R.string.miStatistik);
anzahl=3;
new AbrufMannschaftInfo(this).laden(mannschaftID);
AbrufMannschaftInfo.setMannschaftListesListener(new Datenlistener());
}
private class Datenlistener implements MannschaftInfosListener {
public void mannschaftInfosListenerrueck(String rueck) {
setContentView(R.layout.info_mannschaft);
PageAdapter mPageAdapter = new PageAdapter(getSupportFragmentManager());
ViewPager mViewPager = (ViewPager) findViewById(R.id.viewpager);
mPageAdapter.set_num_pages(anzahl);
mPageAdapter.set_titles(titel);
mViewPager.setAdapter(mPageAdapter);
mannschaftInfos=rueck;
LinearLayout llf1 = (LinearLayout) findViewById(R.id.ll_fragment1);
llf1.removeAllViews();
llf1.setPadding(5, 5, 5, 5);
llf1.setOrientation(LinearLayout.VERTICAL);
LinearLayout llf2 = (LinearLayout) findViewById(R.id.ll_fragment2);
llf2.removeAllViews();
llf2.setPadding(5, 5, 5, 5);
llf2.setOrientation(LinearLayout.VERTICAL);
LinearLayout llf3 = (LinearLayout) findViewById(R.id.ll_fragment3);
llf3.removeAllViews();
llf3.setPadding(5, 5, 5, 5);
llf3.setOrientation(LinearLayout.VERTICAL);
View ruler_1 = new View(MannschaftInfos.this); ruler_1.setBackgroundColor(Color.parseColor("#FFFFFF"));
View ruler_2 = new View(MannschaftInfos.this); ruler_2.setBackgroundColor(Color.parseColor("#FFFFFF"));
View ruler_3 = new View(MannschaftInfos.this); ruler_3.setBackgroundColor(Color.parseColor("#FFFFFF"));
View ruler_4 = new View(MannschaftInfos.this); ruler_4.setBackgroundColor(Color.parseColor("#FFFFFF"));
MannschaftInfosAufbereiten mInfos = new MannschaftInfosAufbereiten(mannschaftInfos);
mInfos.show_wappen(llf1, MannschaftInfos.this);
llf1.addView(ruler_1,new ViewGroup.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, 3));
mInfos.show_stadion(llf1, MannschaftInfos.this);
llf1.addView(ruler_2,new ViewGroup.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, 3));
mInfos.show_ligen(llf1, MannschaftInfos.this);
mInfos.show_stat(llf2, MannschaftInfos.this);
}
}
}