質問編集履歴
2
Log.v("test",data.getData().toString());の結果追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -180,7 +180,19 @@
|
|
180
180
|
|
181
181
|
half_sleepingさんのおっしゃっていたLogの内容は以下です。
|
182
182
|
|
183
|
+
|
184
|
+
|
185
|
+
Log.v("test","path=" + path);
|
186
|
+
|
183
|
-
V/test﹕ path=null
|
187
|
+
V/test﹕ path=null
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
Log.v("test",data.getData().toString());
|
192
|
+
|
193
|
+
V/test﹕ content://com.android.providers.media.documents/document/image%3A209887
|
194
|
+
|
195
|
+
|
184
196
|
|
185
197
|
エラー表示等はありませんでした。
|
186
198
|
|
1
half_sleepingさんの指摘点の追加、ソースをアクティビティ全体のものへと変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -6,15 +6,123 @@
|
|
6
6
|
|
7
7
|
|
8
8
|
|
9
|
-
|
9
|
+
public class AddDiary extends Activity implements View.OnClickListener {
|
10
10
|
|
11
|
-
|
11
|
+
private static final int REQUEST_GALLERY= 0;
|
12
12
|
|
13
|
-
intent.setType("image/*");
|
14
13
|
|
15
|
-
intent.setAction(Intent.ACTION_GET_CONTENT);
|
16
14
|
|
15
|
+
@Override
|
16
|
+
|
17
|
+
protected void onCreate(Bundle savedInstanceState) {
|
18
|
+
|
19
|
+
super.onCreate(savedInstanceState);
|
20
|
+
|
21
|
+
setContentView(R.layout.activity_add_diary);
|
22
|
+
|
23
|
+
Button date = (Button) findViewById(R.id.BtnDate);
|
24
|
+
|
25
|
+
Button save = (Button) findViewById(R.id.BtnSave);
|
26
|
+
|
27
|
+
Button back = (Button) findViewById(R.id.BtnReturn);
|
28
|
+
|
29
|
+
Button selectpic = (Button) findViewById(R.id.BtnSelPic);
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
date.setOnClickListener(this);
|
34
|
+
|
35
|
+
save.setOnClickListener(this);
|
36
|
+
|
37
|
+
back.setOnClickListener(this);
|
38
|
+
|
39
|
+
selectpic.setOnClickListener(this);
|
40
|
+
|
41
|
+
}
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
@Override
|
46
|
+
|
47
|
+
public boolean onCreateOptionsMenu(Menu menu) {
|
48
|
+
|
49
|
+
// Inflate the menu; this adds items to the action bar if it is present.
|
50
|
+
|
51
|
+
getMenuInflater().inflate(R.menu.menu_add_diary, menu);
|
52
|
+
|
53
|
+
return true;
|
54
|
+
|
55
|
+
}
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
@Override
|
60
|
+
|
61
|
+
public boolean onOptionsItemSelected(MenuItem item) {
|
62
|
+
|
63
|
+
// Handle action bar item clicks here. The action bar will
|
64
|
+
|
65
|
+
// automatically handle clicks on the Home/Up button, so long
|
66
|
+
|
67
|
+
// as you specify a parent activity in AndroidManifest.xml.
|
68
|
+
|
69
|
+
int id = item.getItemId();
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
//noinspection SimplifiableIfStatement
|
74
|
+
|
75
|
+
if (id == R.id.action_settings) {
|
76
|
+
|
77
|
+
return true;
|
78
|
+
|
79
|
+
}
|
80
|
+
|
81
|
+
return super.onOptionsItemSelected(item);
|
82
|
+
|
83
|
+
}
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
@Override
|
88
|
+
|
89
|
+
public void onClick(View v) {
|
90
|
+
|
91
|
+
switch (v.getId()) {
|
92
|
+
|
93
|
+
case R.id.BtnDate:
|
94
|
+
|
95
|
+
//日付ダイアログ呼び出し
|
96
|
+
|
97
|
+
break;
|
98
|
+
|
99
|
+
case R.id.BtnSave:
|
100
|
+
|
101
|
+
//記入されているデータの保存
|
102
|
+
|
103
|
+
break;
|
104
|
+
|
105
|
+
case R.id.BtnReturn:
|
106
|
+
|
107
|
+
//タイトル画面に戻る
|
108
|
+
|
109
|
+
break;
|
110
|
+
|
111
|
+
case R.id.BtnSelPic:
|
112
|
+
|
113
|
+
// ギャラリー呼び出し
|
114
|
+
|
115
|
+
Intent intent = new Intent();
|
116
|
+
|
117
|
+
intent.setType("image/*");
|
118
|
+
|
119
|
+
intent.setAction(Intent.ACTION_GET_CONTENT);
|
120
|
+
|
17
|
-
startActivityForResult(intent, REQUEST_GALLERY);
|
121
|
+
startActivityForResult(intent, REQUEST_GALLERY);
|
122
|
+
|
123
|
+
}
|
124
|
+
|
125
|
+
}
|
18
126
|
|
19
127
|
|
20
128
|
|
@@ -50,6 +158,8 @@
|
|
50
158
|
|
51
159
|
}
|
52
160
|
|
161
|
+
}
|
162
|
+
|
53
163
|
|
54
164
|
|
55
165
|
開発環境
|
@@ -63,3 +173,17 @@
|
|
63
173
|
|
64
174
|
|
65
175
|
すみませんが、よろしくお願い致します。
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
追記
|
180
|
+
|
181
|
+
half_sleepingさんのおっしゃっていたLogの内容は以下です。
|
182
|
+
|
183
|
+
V/test﹕ path=null
|
184
|
+
|
185
|
+
エラー表示等はありませんでした。
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
ソース文をWeb上から持ってきた分ではなくアクティビティ全体のソースに変更しました。
|