/[aagtl_public1]/src/com/zoffcc/applications/aagtl/EmulatedMenuActivity.java
aagtl

Contents of /src/com/zoffcc/applications/aagtl/EmulatedMenuActivity.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4 - (show annotations) (download)
Sat Aug 1 08:47:10 2015 UTC (2 years, 1 month ago) by zoffadmin
File size: 2225 byte(s)
1.0.35
1 /**
2 * aagtl Advanced Geocaching Tool for Android
3 * loosely based on agtl by Daniel Fett <fett@danielfett.de>
4 * Copyright (C) 2010 - 2013 Zoff <aagtl@work.zoff.cc>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 */
20
21 package com.zoffcc.applications.aagtl;
22
23 import android.app.Activity;
24 import android.app.ListActivity;
25 import android.content.Intent;
26 import android.os.Bundle;
27 import android.view.View;
28 import android.widget.ArrayAdapter;
29 import android.widget.ListView;
30
31 public class EmulatedMenuActivity extends ListActivity
32 {
33
34 private int selected_id = -1;
35 public static String[] MenuItemsList = null;
36 public static int[] MenuItemsIdMapping = null;
37
38 @Override
39 public void onCreate(Bundle savedInstanceState)
40 {
41 super.onCreate(savedInstanceState);
42
43 ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, MenuItemsList);
44 setListAdapter(adapter);
45 // this.getListView().setFastScrollEnabled(true);
46 }
47
48 @Override
49 protected void onListItemClick(ListView l, View v, int position, long id)
50 {
51 super.onListItemClick(l, v, position, id);
52 // System.out.println("sel object=" + getListView().getItemAtPosition(position).toString()); // --> the string of the menuitem
53 // Get the item that was clicked
54 this.selected_id = MenuItemsIdMapping[position];
55 // close this activity
56 executeDone();
57 }
58
59 private void executeDone()
60 {
61 Intent resultIntent = new Intent();
62 resultIntent.putExtra("selected_id", this.selected_id);
63 setResult(Activity.RESULT_OK, resultIntent);
64 finish();
65 }
66
67 }

   
Visit the aagtl Website