質問編集履歴

2

2018/06/09 11:19

投稿

退会済みユーザー
test CHANGED
@@ -1 +1 @@
1
- VideoViewをタップさせて画面遷移させたいのですが
1
+ 未解決ですが。。。。。。。
test CHANGED
@@ -1,143 +1 @@
1
- 最近興味を持ち勉強し始めた初心者です。
2
-
3
- ボタンを押しての遷移ではなく、VideoViewをタップさせて画面遷移させたいのですがで試しているエミュレーターでうまくいきません。なぜでしょうか?
4
-
5
- また他に良い方法あればご教授お願いします。
6
-
7
- Compile Sdk Version API 27:Android8.1
8
-
9
- Min Sdk Version API 23:Android6.0
10
-
11
- Target Sdk Version API 27:Android8.1
12
-
13
- ### 発生している問題・エラーメッセージ
14
-
15
- API27Runすると遷移するのですが、API24でのRun遷移ができせん
1
+ 長期間載せないつもりしたので未解決ですがありとうございした
16
-
17
- ボタン処理ではどちらも遷移するのですが。
18
-
19
- ```
20
-
21
-
22
-
23
-
24
-
25
- ### 該当のソースコード
26
-
27
- MainActivity.java
28
-
29
- import android.content.Intent;
30
-
31
- import android.net.Uri;
32
-
33
- import android.support.v7.app.AppCompatActivity;
34
-
35
- import android.os.Bundle;
36
-
37
- import android.view.View;
38
-
39
- import android.widget.VideoView;
40
-
41
-
42
-
43
- public class MainActivity extends AppCompatActivity implements View.OnClickListener {
44
-
45
-
46
-
47
- @Override
48
-
49
- protected void onCreate(Bundle savedInstanceState) {
50
-
51
- super.onCreate(savedInstanceState);
52
-
53
- setContentView(R.layout.activity_main);
54
-
55
-
56
-
57
- findViewById(R.id.v).setOnClickListener(this);
58
-
59
-
60
-
61
- VideoView v = (VideoView) findViewById(R.id.v);
62
-
63
- v.setVideoURI(Uri.parse("android.resource://" + this.getPackageName() + "/" + R.raw.title));
64
-
65
- v.start();
66
-
67
-
68
-
69
- }
70
-
71
- public void onClick(View view) {
72
-
73
- Intent intent = new Intent(getApplication(), Main2Activity.class);
74
-
75
- startActivity(intent);
76
-
77
- }
78
-
79
- }
80
-
81
- ```
82
-
83
- avtivity_main.xml
84
-
85
- ```<?xml version="1.0" encoding="utf-8"?>
86
-
87
- <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
88
-
89
- xmlns:app="http://schemas.android.com/apk/res-auto"
90
-
91
- xmlns:tools="http://schemas.android.com/tools"
92
-
93
- android:layout_width="match_parent"
94
-
95
- android:layout_height="match_parent"
96
-
97
- tools:context=".MainActivity">
98
-
99
-
100
-
101
-
102
-
103
- <VideoView
104
-
105
- android:id="@+id/v"
106
-
107
- android:layout_width="match_parent"
108
-
109
- android:layout_height="match_parent"
110
-
111
- app:layout_constraintBottom_toBottomOf="parent"
112
-
113
- app:layout_constraintEnd_toEndOf="parent"
114
-
115
- app:layout_constraintStart_toStartOf="parent"
116
-
117
- app:layout_constraintTop_toTopOf="parent"
118
-
119
- app:layout_constraintVertical_bias="0.0" />
120
-
121
-
122
-
123
-
124
-
125
- </android.support.constraint.ConstraintLayout>
126
-
127
- コード
128
-
129
- ```
130
-
131
-
132
-
133
-
134
-
135
- ### 試したこと
136
-
137
- 何を試して良いのかすら分かりませんでしたので他のクリックでの遷移のやり方だけです。avtivity_main.xmlでのVideoViewにandroid:onClick="onButton"
138
-
139
- MainActivity.javaでonButton()
140
-
141
- onTouchEvent(MotionEvent event)での処理の仕方がどうしたら良いのか分からないため試していません。
142
-
143
- 説明すらまともにできずにすいません。

1

タグの追加

2018/06/09 11:18

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
File without changes