1 |
/**
|
2 |
* ZANavi, Zoff Android Navigation system.
|
3 |
* Copyright (C) 2011 Zoff <zoff@zoff.cc>
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* version 2 as published by the Free Software Foundation.
|
8 |
*
|
9 |
* This program is distributed in the hope that it will be useful,
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12 |
* GNU General Public License for more details.
|
13 |
*
|
14 |
* You should have received a copy of the GNU General Public License
|
15 |
* along with this program; if not, write to the
|
16 |
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
17 |
* Boston, MA 02110-1301, USA.
|
18 |
*/
|
19 |
|
20 |
package com.zoffcc.applications.zanavi;
|
21 |
|
22 |
import android.app.Activity;
|
23 |
import android.app.ListActivity;
|
24 |
import android.content.Intent;
|
25 |
import android.os.Bundle;
|
26 |
import android.view.View;
|
27 |
import android.widget.ArrayAdapter;
|
28 |
import android.widget.ListView;
|
29 |
|
30 |
public class NavitDeleteSelectMapActivity extends ListActivity
|
31 |
{
|
32 |
private int selected_id = -1;
|
33 |
|
34 |
@Override
|
35 |
public void onCreate(Bundle savedInstanceState)
|
36 |
{
|
37 |
super.onCreate(savedInstanceState);
|
38 |
|
39 |
NavitMapDownloader.init_ondisk_maps();
|
40 |
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, NavitMapDownloader.OSM_MAP_NAME_LIST_ondisk);
|
41 |
setListAdapter(adapter);
|
42 |
this.getListView().setFastScrollEnabled(true);
|
43 |
}
|
44 |
|
45 |
@Override
|
46 |
protected void onListItemClick(ListView l, View v, int position, long id)
|
47 |
{
|
48 |
super.onListItemClick(l, v, position, id);
|
49 |
// Get the item that was clicked
|
50 |
this.selected_id = position;
|
51 |
// close this activity
|
52 |
executeDone();
|
53 |
}
|
54 |
|
55 |
private void executeDone()
|
56 |
{
|
57 |
Intent resultIntent = new Intent();
|
58 |
resultIntent.putExtra("selected_id", String.valueOf(this.selected_id));
|
59 |
setResult(Activity.RESULT_OK, resultIntent);
|
60 |
finish();
|
61 |
}
|
62 |
}
|