Android Open Source - DynamicListView Main Activity






From Project

Back to project page DynamicListView.

License

The source code is released under:

Apache License

If you think the Android project DynamicListView listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.example.dynamiclistview;
/*from w w w  .  j a  va 2  s. c  om*/
import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.os.Bundle;
import android.widget.Toast;

import com.example.dynamiclistview.DynamicListView.OnClickButtonListener;

public class MainActivity extends Activity {

  private DynamicListView myListView;
  private MyAdapter mAdapter;
  private List<String> mContentList = new ArrayList<String>();

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    
    myListView = (DynamicListView) findViewById(R.id.my_list_view);
    myListView.setOnClickButtonListener(new OnClickButtonListener() {

      @Override
      public void onClickButton(int index) {
        Toast.makeText(MainActivity.this, "????? " + index + " ???",
            Toast.LENGTH_SHORT).show();
      }
    });
    initList();
    mAdapter = new MyAdapter(this, 0, mContentList);
    myListView.setAdapter(mAdapter);
  }

  private void initList() {
    mContentList.add("Content Item 1");
    mContentList.add("Content Item 2");
    mContentList.add("Content Item 3");
    mContentList.add("Content Item 4");
    mContentList.add("Content Item 5");
    mContentList.add("Content Item 6");
    mContentList.add("Content Item 7");
    mContentList.add("Content Item 8");
    mContentList.add("Content Item 9");
    mContentList.add("Content Item 10");
    mContentList.add("Content Item 11");
    mContentList.add("Content Item 12");
    mContentList.add("Content Item 13");
    mContentList.add("Content Item 14");
    mContentList.add("Content Item 15");
    mContentList.add("Content Item 16");
    mContentList.add("Content Item 17");
    mContentList.add("Content Item 18");
    mContentList.add("Content Item 19");
    mContentList.add("Content Item 20");
  }

}




Java Source Code List

com.example.dynamiclistview.DynamicListView.java
com.example.dynamiclistview.MainActivity.java
com.example.dynamiclistview.MyAdapter.java