質問編集履歴
1
余計なko-dowosakuzixyo
test
CHANGED
File without changes
|
test
CHANGED
@@ -24,11 +24,11 @@
|
|
24
24
|
|
25
25
|
```java
|
26
26
|
|
27
|
-
public String newSet(LayoutInflater inflaters, final Context contexts,View layouts,InputMethodManager inputMethodManagers) {
|
27
|
+
public String newSet(LayoutInflater inflaters, final Context contexts,View layouts,InputMethodManager inputMethodManagers) {
|
28
28
|
|
29
29
|
|
30
30
|
|
31
|
-
|
31
|
+
|
32
32
|
|
33
33
|
builder = new AlertDialog.Builder(context);
|
34
34
|
|
@@ -36,85 +36,73 @@
|
|
36
36
|
|
37
37
|
builder.setNegativeButton("ログイン", new DialogInterface.OnClickListener() {
|
38
38
|
|
39
|
-
public void onClick(DialogInterface dialog, int which) {
|
39
|
+
public void onClick(DialogInterface dialog, int which) {
|
40
40
|
|
41
|
-
EditText getusername2 = (EditText) layout.findViewById(R.id.username);
|
41
|
+
EditText getusername2 = (EditText) layout.findViewById(R.id.username);
|
42
42
|
|
43
|
-
|
43
|
+
String getusername = getusername2.getText().toString();
|
44
44
|
|
45
|
-
|
45
|
+
|
46
46
|
|
47
|
-
|
47
|
+
//データベースから取得してあればログイン
|
48
48
|
|
49
|
-
|
49
|
+
String sql = "select username from user where username = '" + getusername + "';";
|
50
50
|
|
51
|
-
|
51
|
+
System.out.println(sql);/////////////////////ログ出力
|
52
52
|
|
53
|
-
|
53
|
+
MyOpenHelper helper = new MyOpenHelper(context);
|
54
54
|
|
55
|
-
|
55
|
+
SQLiteDatabase db = helper.getWritableDatabase();
|
56
56
|
|
57
|
-
|
57
|
+
Cursor c = db.rawQuery(sql, null);
|
58
58
|
|
59
|
-
|
59
|
+
Integer count = c.getCount();
|
60
60
|
|
61
|
-
|
61
|
+
if (count != 0) {
|
62
62
|
|
63
|
-
|
63
|
+
c.moveToFirst();
|
64
64
|
|
65
|
-
c
|
65
|
+
String checkusername = c.getString(0);
|
66
66
|
|
67
|
-
|
67
|
+
Toast toast = Toast.makeText(context, "ログインしました", Toast.LENGTH_SHORT);
|
68
68
|
|
69
|
-
|
69
|
+
toast.show();
|
70
70
|
|
71
|
-
|
71
|
+
System.out.println("checkusername:"+checkusername);/////////////////////ログ出力
|
72
72
|
|
73
|
-
|
73
|
+
username = checkusername;
|
74
74
|
|
75
|
-
|
75
|
+
System.out.println("username:"+username);/////////////////////ログ出力
|
76
76
|
|
77
|
-
System.out.println("
|
77
|
+
System.out.println("ログイン完了" + username);/////////////////////ログ出力
|
78
78
|
|
79
|
-
|
79
|
+
}
|
80
|
-
|
81
|
-
System.out.println("username:"+username);/////////////////////ログ出力
|
82
|
-
|
83
|
-
System.out.println("ログイン完了" + username);/////////////////////ログ出力
|
84
|
-
|
85
|
-
|
86
80
|
|
87
81
|
|
88
82
|
|
89
|
-
}
|
83
|
+
});
|
90
84
|
|
91
|
-
|
92
|
-
|
93
|
-
});
|
94
|
-
|
95
|
-
alertDialog = builder.create();
|
85
|
+
alertDialog = builder.create();
|
96
86
|
|
97
87
|
alertDialog.setOnShowListener(new DialogInterface.OnShowListener() {
|
98
88
|
|
99
89
|
|
100
90
|
|
91
|
+
@Override
|
101
92
|
|
93
|
+
public void onShow(DialogInterface arg0) {
|
102
94
|
|
103
|
-
|
95
|
+
getusername2 = (EditText) layout.findViewById(R.id.username);
|
104
96
|
|
105
|
-
pu
|
97
|
+
//inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
106
98
|
|
107
|
-
|
99
|
+
inputMethodManager.showSoftInput(getusername2, 0);
|
108
100
|
|
109
|
-
//inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
110
|
-
|
111
|
-
inputMethodManager.showSoftInput(getusername2, 0);
|
112
|
-
|
113
|
-
}
|
101
|
+
}
|
114
102
|
|
115
103
|
|
116
104
|
|
117
|
-
});
|
105
|
+
});
|
118
106
|
|
119
107
|
alertDialog.show();
|
120
108
|
|