我想覆盖 android 中的 RecognizerIntent 视图。为此,我尝试在 Android 中扩展 RecognizerIntent 类,如下所示:
package com.example.myapp;
import android.content.Context;
import android.speech.RecognizerIntent;
public class RecInt extends RecognizerIntent {
public RecInt(Context c) {
super(c);
//if I don't call super here, there is an error 'There is no default constructor available in RecognizerIntent'
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_recint);
}
}
但我得到了错误
RecognizerIntent() 在 android.speech.RecognizerIntent 中不公开,无法从外部包访问。
有什么办法我仍然可以扩展非公共课程吗?
我想这样做以便何时RecInt
开始
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
startActivityForResult(intent,100);
中的视图setContentView(R.layout.activity_recint)
显示,而不是RecognizerIntent
视图。