Android Open Source - vgandroid-demo Main Activity






From Project

Back to project page vgandroid-demo.

License

The source code is released under:

GNU Lesser General Public License

If you think the Android project vgandroid-demo 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

// Copyright (c) 2012-2013, https://github.com/rhcad/touchvg
//  www.jav  a  2s  . com
package touchvg.demo1;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class MainActivity extends ListActivity {
    private static final String TAG = "vgdemo";
    private static final String[] VIEWS = new String[] {
        "ExampleActivity1", "ExampleActivitySF", "ExampleActivityPager",
        "ExampleActivityImagePager", "DragObserverActivity" };

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setListAdapter(new ArrayAdapter<String>(this,
                android.R.layout.simple_list_item_1,
                android.R.id.text1, VIEWS));
    }

    @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {
        super.onListItemClick(l, v, position, id);

        try {
            String name = "touchvg.demo1." + VIEWS[position];
            Class<?> cls = Class.forName(name);
            Intent i = new Intent(this, cls);
            startActivity(i);
        } catch (Exception e) {
            Log.d(TAG, "onListItemClick", e);
        }
    }
}




Java Source Code List

touchvg.demo1.DragObserverActivity.java
touchvg.demo1.ExampleActivity1.java
touchvg.demo1.ExampleActivityImagePager.java
touchvg.demo1.ExampleActivityPager.java
touchvg.demo1.ExampleActivitySF.java
touchvg.demo1.MainActivity.java