How to display thumbnails of a video?

I am trying to show the value of my arraylist in my tablayout. now I have successfully passed two values โ€‹โ€‹in my two tables that it works. I have three tabhost 2tab hosts working fine. so I'm trying to show my saved path. how to show my saved value of thumb nail video path? I try to show, but I get an error

error:

The type of the expression must be an array type but it resolved to ArrayList<String> 

line:

 imgVw.setImageBitmap(getImage(tabview.videoList[position])); 

full source code:

 public class video extends Activity { //set constants for MediaStore to query, and show videos //flag for which one is used for images selection private Gallery _gallery; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.mavideo); //set GridView for gallery _gallery = (Gallery) findViewById(R.id.videoGrdVw); //set gallery adapter setGalleryAdapter(); } private void setGalleryAdapter() { _gallery.setAdapter(new VideoGalleryAdapter(this)); } // private class VideoGalleryAdapter extends BaseAdapter {private Context mContext; public VideoGalleryAdapter(Context c) { mContext = c; } public int getCount() { return tabview.videoList.size(); } public Object getItem(int position) { return position; } public long getItemId(int position) { return position; } public View getView(int position, View convertView, ViewGroup parent) { ImageView imgVw= new ImageView(mContext);; try { if(convertView!=null) { imgVw= (ImageView) convertView; } imgVw.setImageBitmap(getImage(tabview.videoList[position])); imgVw.setLayoutParams(new Gallery.LayoutParams(96, 96)); imgVw.setPadding(8, 8, 8, 8); } catch(Exception ex) { System.out.println("StartActivity:getView()-135: ex " + ex.getClass() +", "+ ex.getMessage()); } return imgVw; } // Create the thumbnail on the fly private Bitmap getImage(int id) { Bitmap thumb = MediaStore.Video.Thumbnails.getThumbnail( getContentResolver(), id, MediaStore.Video.Thumbnails.MICRO_KIND, null); return thumb; } } } 

Note: parxmlactivity.java is my main class here, I pass my value using the code below:

 sdcardImages.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView parent, View v, int position, long id) { Intent intent = new Intent(ParxmlActivity.this, tabview.class); intent.putExtra("spec",model_List.get(position).spec); intent.putStringArrayListExtra("imageList", model_List.get(position).imageList); intent.putStringArrayListExtra("videoList", model_List.get(position).videoList); startActivity(intent); } }); 

and I get this passed value in the lower code in the tabview.java class file:

  tab_intent=tabview.this.getIntent().getExtras(); spec=tab_intent.getString("spec"); imageList = tab_intent.getStringArrayList("imageList"); videoList = tab_intent.getStringArrayList("videoList"); 
+4
source share

Source: https://habr.com/ru/post/1396187/


All Articles