/[zanavi_public1]/navit/navit/android/src/com/retain/dialog/RenameDialog.java
ZANavi

Contents of /navit/navit/android/src/com/retain/dialog/RenameDialog.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 19 - (show annotations) (download)
Sun Dec 11 12:56:26 2011 UTC (12 years, 4 months ago) by zoff99
File size: 2077 byte(s)
new Java clases for numberpicker(s)
1 /**
2 * from:
3 * http://code.google.com/p/retain-android/
4 *
5 * http://www.apache.org/licenses/LICENSE-2.0
6 *
7 */
8 /**
9 * ZANavi, Zoff Android Navigation system.
10 * Copyright (C) 2011 Zoff <zoff@zoff.cc>
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * version 2 as published by the Free Software Foundation.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the
23 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 * Boston, MA 02110-1301, USA.
25 */
26
27 package com.retain.dialog;
28
29 import android.app.Activity;
30 import android.app.AlertDialog;
31 import android.content.DialogInterface;
32 import android.widget.EditText;
33
34 import com.retain.dialog.RenameHandlerInterface.OnRenameItemListener;
35
36 public class RenameDialog extends AlertDialog
37 {
38
39 private EditText mET;
40 private long mRowId;
41 private OnRenameItemListener mRenameListener;
42 private Activity mActivity;
43
44 public RenameDialog(Activity activity, String title, String name, OnRenameItemListener renameListener)
45 {
46 super(activity);
47
48 mET = new EditText(activity);
49 mET.setText(name);
50 mRenameListener = renameListener;
51 mActivity = activity;
52
53 setView(mET);
54 setCancelable(true);
55 setTitle(title);
56
57 setButton("Ok", new DialogInterface.OnClickListener()
58 {
59 @Override
60 public void onClick(DialogInterface dialog, int which)
61 {
62 String title = mET.getText().toString();
63 mRenameListener.onRenameItem(title);
64 return;
65 }
66 });
67 setButton2("Cancel", new DialogInterface.OnClickListener()
68 {
69 @Override
70 public void onClick(DialogInterface dialog, int which)
71 {
72 dialog.dismiss();
73 }
74 });
75
76 }
77
78 }

   
Visit the ZANavi Wiki