我想製作一個語音識別android應用程序。我想知道如何製作應用程序的數據庫。我的應用程序將使用一些命令,如accept call
接受電話,打開'UC browser
打開UC瀏覽器和其他一些命令。現在我已經完成了六個活動,其中我已經展示了哪些命令應該用於不同的任務,並且每個活動都與下一個按鈕相關聯。現在我希望當我點擊第六個活動中的完成按鈕時,應用程序將在後臺運行,並可以接收一些命令。我的應用名稱是JARVIS.
我將附上所有六項活動。如何在數據庫中保存錄音
任何幫助將深表感謝! :)
MainActivity
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button Next = (Button) findViewById(R.id.button1);
Next.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = new Intent(view.getContext(), DisplayMessageActivity.class);
startActivityForResult(myIntent, 0);
}
});
}
}
DisplayMessageActivity
public class DisplayMessageActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_display_message);
Button pre = (Button) findViewById(R.id.button2);
pre.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent intent = new Intent();
setResult(RESULT_OK, intent);
finish();
}
});
Button Next = (Button) findViewById(R.id.button3);
Next.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = new Intent(view.getContext(), ThirdActivity.class);
startActivityForResult(myIntent, 0);
}
});
}
}
ThirdActivity
public class ThirdActivity extends AppCompatActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.third_activity);
Button previous = (Button) findViewById(R.id.button4);
previous.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent intent = new Intent();
setResult(RESULT_OK, intent);
finish();
}
});
Button next = (Button) findViewById(R.id.button5);
next.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = new Intent(view.getContext(), FourthActivity.class);
startActivityForResult(myIntent, 0);
}
});
}
}
FourthActivity
public class FourthActivity extends AppCompatActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fourth_activity);
Button previous = (Button) findViewById(R.id.button6);
previous.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent intent = new Intent();
setResult(RESULT_OK, intent);
finish();
}
});
Button next = (Button) findViewById(R.id.button7);
next.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = new Intent(view.getContext(), FifthActivity.class);
startActivityForResult(myIntent, 0);
}
});
}
}
FifthActivity
public class FifthActivity extends AppCompatActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fifth_activity);
Button previous = (Button) findViewById(R.id.button8);
previous.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent intent = new Intent();
setResult(RESULT_OK, intent);
finish();
}
});
Button next = (Button) findViewById(R.id.button9);
next.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = new Intent(view.getContext(), SixthActivity.class);
startActivityForResult(myIntent, 0);
}
});
}
}
SixthActivity
public class SixthActivity extends AppCompatActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sixth_activity);
Button previous = (Button) findViewById(R.id.button10);
previous.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent intent = new Intent();
setResult(RESULT_OK, intent);
finish();
}
});
}
}
這不是[mcve]。這些代碼都沒有任何事情要做,真的,你的要求也是。 –