Button Btn; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Btn = (Button) findViewById(R.id.btn1); OnClickListener Btn = new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Select an application"); intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH); intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 1); startActivityForResult(intent, SystemData.VOICE_RECOGNITION_REQUEST_CODE); } }; } 

Stresses SystemData, why? How to fix?

  • Alt+Insert -> Import Class tried? - Saidolim
  • It proposes only to create a class .. - darkyver
  • You should not compile at all. You have two Btn variables and both are of different types and with a capital letter. And should be with different names and with a small letter. - Yuriy SPb ♦
  • And show the link to the example where you got this code from. Most likely it is not a class of this class, and it was merely given as an example for an example. - Yuriy SPb ♦

0