Note that there are some explanatory texts on larger screens.

plurals
  1. POWant to include voice recognition to open my grid view icon in my android app?
    primarykey
    data
    text
    <p>I made a grid view in my app now I want to include voice recognition in it so that: when user will say "home" then home icon will open:</p> <p>I'm beginner in android development so plz give me a detailed answer:</p> <p>I made a voice.java class and uses Recognizer intent , ACTION_RECOGNIZER_SPEECH and also onactivityResult() method from a tutorial I i cant able to link it with my icons.</p> <pre><code>import java.util.ArrayList; import android.app.Activity; import android.content.Intent; //import android.content.ClipData.Item; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.GridView; public class MainActivity extends Activity { GridView gridview; ArrayList&lt;Item&gt; gridArray = new ArrayList&lt;Item&gt;(); CustomGridViewAdapter customGridAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Bitmap homeIcon = BitmapFactory.decodeResource(this.getResources(), R.drawable.home); Bitmap facultyIcon = BitmapFactory.decodeResource(this.getResources(), R.drawable.faculty); Bitmap courcesIcon = BitmapFactory.decodeResource(this.getResources(), R.drawable.cources); Bitmap admissionIcon = BitmapFactory.decodeResource(this.getResources(), R.drawable.admission); Bitmap newsIcon = BitmapFactory.decodeResource(this.getResources(), R.drawable.news); Bitmap acheivmentsIcon = BitmapFactory.decodeResource(this.getResources(), R.drawable.award); Bitmap cornerIcon = BitmapFactory.decodeResource(this.getResources(), R.drawable.corner); Bitmap amenitiesIcon = BitmapFactory.decodeResource(this.getResources(), R.drawable.amenities); Bitmap societiesIcon = BitmapFactory.decodeResource(this.getResources(), R.drawable.socities); Bitmap timeIcon = BitmapFactory.decodeResource(this.getResources(), R.drawable.time_table); Bitmap eventsIcon = BitmapFactory.decodeResource(this.getResources(), R.drawable.events); Bitmap contactIcon = BitmapFactory.decodeResource(this.getResources(), R.drawable.contact); gridArray.add(new Item(homeIcon, "Home","http://bit.ly.com/")); gridArray.add(new Item(courcesIcon, "Courses","http://bit.ly.com/courses.html")); gridArray.add(new Item(facultyIcon, "Faculty","http://bit.ly.com/faculty.html")); gridArray.add(new Item(admissionIcon, "Admission","http://bit.ly.com/admission.html")); gridArray.add(new Item(newsIcon, "News","http://bit.ly.com/news.html")); gridArray.add(new Item(acheivmentsIcon, "Acheivments","http://bit.ly.com/achievement.html")); gridArray.add(new Item(cornerIcon, "Student Corner","http://bit.ly.com/student-corner.html")); gridArray.add(new Item(amenitiesIcon, "Amenities","https://www.google.co.in/")); gridArray.add(new Item(societiesIcon, "Societies","http://bit.ly.com/socities.html")); gridArray.add(new Item(timeIcon, "Time Table","http://bit.ly.com/time-tables.html")); gridArray.add(new Item(eventsIcon, "Events","https://www.google.co.in/")); gridArray.add(new Item(contactIcon, "Contact Us","http://bit.ly.com/directories.html")); gridview = (GridView) findViewById(R.id.gridView); customGridAdapter = new CustomGridViewAdapter(this, R.layout.row_grid, gridArray); gridview.setAdapter(customGridAdapter); gridview.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3) { String url=gridArray.get(arg2).getWebUrl(); Intent intent = new Intent("com.//package name.SECONDACTIVITY"); intent.putExtra("url", url); startActivity(intent); } }); } } </code></pre> <p>}</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload