質問編集履歴
3
文法の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -124,8 +124,6 @@
|
|
124
124
|
}
|
125
125
|
AsyncHttpRequest2 task = new AsyncHttpRequest2((Activity) v.getContext());
|
126
126
|
task.execute(url);
|
127
|
-
AsyncHttpRequest2 task2 = new AsyncHttpRequest2((Activity) v.getContext());
|
128
|
-
task2.execute(url);
|
129
127
|
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
|
130
128
|
((Activity) v.getContext()).finish();
|
131
129
|
SakuhinIchiranActivity.sakka.clear();
|
2
コードを差し替え
test
CHANGED
File without changes
|
test
CHANGED
@@ -88,10 +88,10 @@
|
|
88
88
|
```
|
89
89
|
②の表示、クリックリスナーを担うRecyclerViewAdapter
|
90
90
|
```Java
|
91
|
-
public class
|
91
|
+
public class SakuhinIchiranRecyclerviewAdapter extends RecyclerView.Adapter<AtoWaRecyclerViewHolder>{
|
92
92
|
private List<RowData> list;
|
93
93
|
|
94
|
-
public
|
94
|
+
public SakuhinIchiranRecyclerviewAdapter(List<RowData> list){
|
95
95
|
this.list = list;
|
96
96
|
}
|
97
97
|
|
@@ -110,23 +110,26 @@
|
|
110
110
|
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
111
111
|
@Override
|
112
112
|
public void onClick(View v) {
|
113
|
-
Intent intent = new Intent(v.getContext(), Sakuhin
|
113
|
+
Intent intent = new Intent(v.getContext(), ReadfromSakuhinmeiActivity.class);
|
114
114
|
int position = holder.getLayoutPosition();
|
115
|
-
String
|
115
|
+
String sakkaSeq = SakuhinIchiranActivity.sakka.get(position);
|
116
|
-
String
|
116
|
+
String cardSeq = SakuhinIchiranActivity.card.get(position);
|
117
|
-
String
|
117
|
+
String firstURL = "https://www.aozora.gr.jp/cards/" + sakkaSeq +"/" + cardSeq + ".html";
|
118
|
+
intent.putExtra("sakka", sakkaSeq);
|
118
119
|
URL url = null;
|
119
120
|
try {
|
120
|
-
url = new URL(
|
121
|
+
url = new URL(firstURL);
|
121
122
|
} catch (MalformedURLException e) {
|
122
123
|
e.printStackTrace();
|
123
124
|
}
|
124
|
-
|
125
|
+
AsyncHttpRequest2 task = new AsyncHttpRequest2((Activity) v.getContext());
|
126
|
+
task.execute(url);
|
125
|
-
AsyncHttpRequest task
|
127
|
+
AsyncHttpRequest2 task2 = new AsyncHttpRequest2((Activity) v.getContext());
|
126
|
-
task
|
128
|
+
task2.execute(url);
|
127
|
-
|
128
129
|
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
|
129
130
|
((Activity) v.getContext()).finish();
|
131
|
+
SakuhinIchiranActivity.sakka.clear();
|
132
|
+
SakuhinIchiranActivity.card.clear();
|
130
133
|
v.getContext().startActivity(intent);
|
131
134
|
|
132
135
|
}
|
1
書式の改善
test
CHANGED
File without changes
|
test
CHANGED
@@ -25,8 +25,8 @@
|
|
25
25
|
|
26
26
|
|
27
27
|
### 該当のソースコード
|
28
|
-
|
29
|
-
|
28
|
+
(webファイル取得)
|
29
|
+
```Java
|
30
30
|
public class AsyncHttpRequest extends AsyncTask<URL, Void, String> {
|
31
31
|
private Activity mainActivity;
|
32
32
|
protected String resultText;
|
@@ -86,8 +86,8 @@
|
|
86
86
|
|
87
87
|
}
|
88
88
|
```
|
89
|
-
|
90
|
-
|
89
|
+
②の表示、クリックリスナーを担うRecyclerViewAdapter
|
90
|
+
```Java
|
91
91
|
public class AtoWaRecyclerviewAdapter3 extends RecyclerView.Adapter<AtoWaRecyclerViewHolder>{
|
92
92
|
private List<RowData> list;
|
93
93
|
|
@@ -140,7 +140,8 @@
|
|
140
140
|
}
|
141
141
|
|
142
142
|
```
|
143
|
-
|
143
|
+
③のアクティビティ
|
144
|
+
```Java
|
144
145
|
public class SakuhinIchiranActivity extends AppCompatActivity {
|
145
146
|
public static List<String> sakka = new ArrayList<>();//④でのURL生成用のリスト
|
146
147
|
public static List<String> card = new ArrayList<>();//④でのURL生成用
|