/*
* Copyright 2010, 2011, 2012 mapsforge.org
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.mapsforge.applications.android.samples;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
/**
* A simple start screen for the sample activities.
*/
public class Samples extends Activity {
private Button createButton(final Class<?> clazz) {
Button button = new Button(this);
button.setText(clazz.getSimpleName());
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(Samples.this, clazz));
}
});
return button;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_samples);
LinearLayout linearLayout = (LinearLayout) findViewById(R.id.samples);
linearLayout.addView(createButton(BasicMapViewer.class));
linearLayout.addView(createButton(DualMapViewer.class));
linearLayout.addView(createButton(OverlayMapViewer.class));
linearLayout.addView(createButton(OverlayBenchmark.class));
}
}