This is the code I am using
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
showVoiceText.setText("I am working");
}
However it seems not to be called... It never displays "I am working"
This is my xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.phoenix.coreai.HomeActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Core A.I."
android:id="@+id/showVoiceOutput"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Enable voice control"
tools:layout_editor_absoluteX="88dp"
tools:layout_editor_absoluteY="167dp" />
</android.support.constraint.ConstraintLayout>
This is not my main activity, my main activity is just an intro playing a small mp4 file
This is the main activity code
package com.example.phoenix.coreai;
import android.content.Intent;
import android.net.Uri;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.VideoView;
public class MainActivity extends AppCompatActivity {
VideoView view;
private static int SPLASH_TIME_OUT = 2700;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
view = (VideoView) findViewById(R.id.videoView);
videoPlay(view);
new Handler().postDelayed(new Runnable(){
@Override
public void run(){
Intent homeIntent = new Intent(MainActivity.this, HomeActivity.class);
startActivity(homeIntent);
finish();
}
},SPLASH_TIME_OUT);
}
public void videoPlay(View v){
String videoPath = "android.resource://com.example.phoenix.coreai/" + R.raw.spashscreen;
Uri uri = Uri.parse(videoPath);
view.setVideoURI(uri);
view.start();
}
}
and this is the xml of the main activity
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
tools:context="com.example.phoenix.coreai.MainActivity">
<VideoView
android:id="@+id/videoView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginTop="-27dp"
app:layout_constraintTop_toTopOf="parent"
tools:layout_editor_absoluteX="0dp">
</VideoView>
</LinearLayout>
I cannot debug the application through my mobile it has a custom rom and android studio wont recognize it
Let's assume that I would like to call this void from onCreate
private void musicScan(){
File f = new File(path);
File file[] = f.listFiles();
fileArray = new String[file.length];
for (int i = 0; i < file.length; ++i){
fileArray[i] = file[i].getName();
}
}
It does not seem to execute the void that I am calling