0
私は現在、Webベースのアプリケーションで起動しているアプリケーションの起動時間に関して、その利点を測定するアプリを開発中です。私はYoutubeアプリとウェブインターフェースを起動するためにインテントを使用することにしましたが、現在は起動時間を測定するのに苦労しています。私は途中でニュービーです。Androidアプリの実行に時間がかかる
package com.example.thabo.app_optimization;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
String TestVid_ID = "giYeaKsXnsI";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void watchYoutubeVideo(String id, String runType){
Intent appIntent = new Intent(Intent.ACTION_VIEW,
Uri.parse("vnd.youtube:" + id));
Intent webIntent = new Intent(Intent.ACTION_VIEW,
Uri.parse("http://www.youtube.com/watch?v=" + id));
if (runType == "app") {
startActivity(appIntent);}
else
startActivity(webIntent);
display();
}
/**
* Method to initialize the application
*/
public void RUN_APP(View view) {
watchYoutubeVideo(TestVid_ID, "app");
}
public void RUN_WEB(View view){
watchYoutubeVideo(TestVid_ID, "web");
}
/**
* Method to display the name of the current activity onscreen
* */
private void display() {
TextView Activity = (TextView) findViewById(
R.id.Activity);
Activity.setText(this.getClass().getSimpleName());
}
}