Android Open Source - paged-listview Main Activity






From Project

Back to project page paged-listview.

License

The source code is released under:

MIT License

If you think the Android project paged-listview 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.github.alexkolpa.pagedlistview.sample;
//w  ww.ja v  a2s .c  om
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;


public class MainActivity extends ActionBarActivity implements AdapterView.OnItemClickListener {

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    String[] names = getResources().getStringArray(R.array.activity_names);

    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, names);

    ListView listView = (ListView)findViewById(R.id.activity_list);
    listView.setAdapter(adapter);
    listView.setOnItemClickListener(this);
  }

  @Override
  public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    Class intentClazz;
    switch (position) {
      case 0:
        intentClazz = FooterActivity.class;
        break;
      case 1:
        intentClazz = CustomActivity.class;
        break;
      default:
        throw new IllegalArgumentException("Incorrect position!");
    }

    Intent intent = new Intent(this, intentClazz);
    startActivity(intent);
  }
}




Java Source Code List

com.github.alexkolpa.pagedlistview.PagedListView.java
com.github.alexkolpa.pagedlistview.sample.AbstractPagedActivity.java
com.github.alexkolpa.pagedlistview.sample.CustomActivity.java
com.github.alexkolpa.pagedlistview.sample.FooterActivity.java
com.github.alexkolpa.pagedlistview.sample.MainActivity.java
com.github.alexkolpa.pagedlistview.sample.MyPageable.java