Back to project page EulerSolutions.
The source code is released under:
MIT License
If you think the Android project EulerSolutions listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.eulersolutions.controllers; /*from www . j ava 2s. co m*/ import com.eulersolutions.controllers.R; import com.eulersolutions.model.CompletedProblems; import com.eulersolutions.model.ProblemSummary; import android.os.Bundle; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.util.Log; import android.view.Menu; import android.view.View; import android.widget.AdapterView; import android.widget.ListView; import android.widget.AdapterView.OnItemClickListener; public class MainActivity extends Activity { private static final String TAG = "EulerSolutions-MainActivity"; @Override protected void onCreate(Bundle savedInstanceState) { Log.i(TAG, "Entered on Create"); super.onCreate(savedInstanceState); CompletedProblems problems = new CompletedProblems(this); ProblemSelectArrayAdapter problemAdapter = new ProblemSelectArrayAdapter(this, R.layout.layout_problem_select_row, R.id.problemName, problems.getCompletedProblems()); setContentView(R.layout.activity_main); ListView problemListView = (ListView) this.findViewById(R.id.problemSelectListview); problemListView.setAdapter(problemAdapter); problemListView.setOnItemClickListener(new OnItemClickListener(){ @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Context context; Intent displayProblem; ProblemSelectArrayAdapter adapter = (ProblemSelectArrayAdapter) parent.getAdapter(); ProblemSummary problem = adapter.getItem(position); context = adapter.getContext(); displayProblem = new Intent(context, ProblemPresentationActivity.class); displayProblem.putExtra(ProblemPresentationActivity.PARCEL_NAME, problem); context.startActivity(displayProblem); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } }