0

Super newb here. Been searching for 4 hours on google and these forums and do not see this addressed. Sorry if it is, but like i said, SUPER newb here.

I need a scroll view that has a linear layout in it. IN the linear layout I need customized "mini-layouts" in that. These are dynamically pulled in.

The idea is a user logs in, and we return a data stream with their content. A mini-layout will consist of an image, text above and below, and a button.

I got an xml for this, but when I go through the list of data it will not let me attach that xml more than once. Help please, and if I am doing this in the worst way let me know.

Thanks.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.springboard_view);

    // Set page title
    TextView temp = (TextView) findViewById(R.id.page_label);
    temp.setText("Springboard");

    // Get the message from the intent, format and set
    // We also need to keep the pdf's for the library page
    Intent intent = getIntent();
    String message = intent.getStringExtra(ffacademyActivity.EXTRA_MESSAGE);
    List<String[]> formattedStrings = formatStrings(message);
    List<String[]> pdfStrings = new ArrayList<String[]>();

    String[] almostThere;


    mInflater = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    LinearLayout convertView = (LinearLayout)mInflater.inflate(R.layout.sb_icon,null);



    while(!formattedStrings.isEmpty()) {
        setContentView(R.layout.sb_icon);
        almostThere = formattedStrings.remove(0);   

        if (almostThere[0].contains("product")) {
            TextView tempText = (TextView) findViewById(R.id.spring_board_title);
            tempText.setText(almostThere[2]);
            tempText = (TextView)findViewById(R.id.spring_board_description);
            tempText.setText(almostThere[5]);
        } else if (almostThere[0].contains("link")) {
            TextView tempText = (TextView) findViewById(R.id.spring_board_title);
            tempText.setText(almostThere[1]);
            tempText = (TextView)findViewById(R.id.spring_board_description);
            tempText.setText(almostThere[4]);
        } else {
            pdfStrings.add(almostThere);
        }

        setContentView(R.layout.springboard_view);
        LinearLayout linearLayout = (LinearLayout)findViewById(R.id.sbpad);
        linearLayout.addView(convertView);
    }



}
user1318747
  • 345
  • 4
  • 12

1 Answers1

1

Isn't this just an ordinary ListView with an ArrayAdapter. Like the one in this example: Custom ListView items and adapters

Peter
  • 2,165
  • 2
  • 17
  • 25
  • Yes, yes it is. Like I said, super newb question. I found out about adapters a little after posting this, but thanks for the correct answer! – user1318747 Nov 27 '13 at 23:45