ImageView fullscreen in Activity - android

I have a GridView populated with images. When I click on a GridView item it should open a new Activity and show an image in full screen, but it doesn't happen.
I'm using the Glide library. I've tried to debug, but I didn't find the problem.
Any ideas?
Gallery.java
gridViewGallery.setOnItemClickListener(new AdapterView.OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
Intent intent = new Intent(AdvertisementGallery.this,FullScreenImage.class);
intent.putExtra("image",i);
startActivity(intent);
}
});
FullScreenImage.java
viewPager.clearFocus();
imageItems = Constants.items;
bitmap = getIntent().getExtras().getInt("image");
// ImagePageAdapter imagePageAdapter = new ImagePageAdapter(this,imageItems);
imagePageAdapter = new ImageAdapter(this,imageItems);
viewPager.setAdapter(imagePageAdapter);
viewPager.setCurrentItem(bitmap,false);
class ImageAdapter extends PagerAdapter {
public Context context;
public ArrayList data = new ArrayList();
public ImageAdapter(Context context, ArrayList data){
this.context = context;
this.data = data;
}
#Override
public int getCount() {
return this.data.size();
}
#Override
public int getItemPosition(Object object) {
int position = data.indexOf(object);
return POSITION_NONE ;
}
#Override
public boolean isViewFromObject(View view, Object object)
{
return view == ((LinearLayout) object);
}
#Override
public Object instantiateItem(ViewGroup container, int position) {
View row = null;
if (row == null) {
LayoutInflater inflater = ((Activity) context).getLayoutInflater();
row = inflater.inflate(R.layout.image_pager_item_list_layout, container, false);
// holder.imageTitle = (TextView) row.findViewById(R.id.text);
image = (TouchImageView) row.findViewById(R.id.imgDisplay);
row.setTag(image);
} else {
image = (ImageView) row.getTag();
}
ImageItem item = (ImageItem) data.get(position);
Glide.with(getApplicationContext())
.load(item.getImage())
.into(image);
container.addView(row);
return row;
}
#Override
public void destroyItem(ViewGroup container, int position, Object object) {
((ViewPager) container).removeView((LinearLayout) object);
}
}

First of all, you are passing the position of the image. you need to pass the item. instead of position. you need to do following changes in the following way.
in Gallery.java
gridViewGallery.setOnItemClickListener(new AdapterView.OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
ImageItem item = (ImageItem) data.get(position)
Intent intent = new Intent(AdvertisementGallery.this,FullScreenImage.class);
//intent.putExtra("image",i);
intent.putExtra("imagePosition",i);
startActivity(intent);
}
});
Now, Retrieve your image in FullScreenImage.java by following way.
imageItems = Constants.items;
int position=getIntent().getExtras().getInt("imagePosition");
ImageItem item = imageItems.get(position);
bitmap = item.getImage();
To set in your ViewPager you can follow this code:
imagePageAdapter = new ImageAdapter(this,imageItems);
viewPager.setAdapter(imagePageAdapter);
viewPager.setCurrentItem(position, true);
And for the issue of
some time image display and some time is not display in viewpager.
Try to add following line .placeholder (new ColorDrawable (Color.WHITE)). so the code looks like :
Glide.with(getApplicationContext())
.load(item.getImage())
.placeholder (new ColorDrawable (Color.WHITE))
.into(image);
And, If you are getting issue only in release mode apk then try this solution

Check how to send an image from one activity to another activity via intent. In your code,what you are sending is not an image that is a position. How did you get the position in the bitmap? this is not the way. sorry for my english.
check this link
first, convert the image into bitmap then pass bitmap to other activity and receive it.

Related

select image from gridview and display it full screen

I'm using ion library (from this link) to display image and videos from phone in gridview. I just need to get the image on clicking it in gridview and display the image in another activity. Normally I would've used Integer[position] and getItem() to display the image in full screen. But how to do that here when I'm using Ion library?
public class MainActivity extends Activity {
private MyAdapter mAdapter;
private GridView view;
// Adapter to populate and imageview from an url contained in the array adapter
public class MyAdapter extends ArrayAdapter<String> {
public MyAdapter(Context context) {
super(context, 0);
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
// see if we need to load more to get 40, otherwise populate the adapter
if (position > getCount() - 4)
loadMore();
if (convertView == null)
convertView = getLayoutInflater().inflate(R.layout.image, null);
// find the image view
final ImageView iv = (ImageView) convertView.findViewById(R.id.image);
// select the image view
Ion.with(iv)
.centerCrop()
.placeholder(R.drawable.placeholder)
.error(R.drawable.error)
.load(getItem(position));
return convertView;
}
}
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Ion.getDefault(this).configure().setLogging("ion-sample", Log.DEBUG);
setContentView(R.layout.activity_main);
int cols = getResources().getDisplayMetrics().widthPixels / getResources().getDisplayMetrics().densityDpi * 2;
view = (GridView) findViewById(R.id.results);
view.setNumColumns(cols);
mAdapter = new MyAdapter(this);
view.setAdapter(mAdapter);
loadMore();
view.setOnItemClickListener(new OnItemClickListener(){
#Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// TODO Auto-generated method stub
Toast.makeText(MainActivity.this, mAdapter.getItem(position), Toast.LENGTH_SHORT).show();
// HERE I WANT TO GIVE THE INTENT TO DISPLAY IMAGE IN FULL SCREEN
}
});
}
Cursor mediaCursor;
public void loadMore() {
if (mediaCursor == null) {
mediaCursor = getContentResolver().query(MediaStore.Files.getContentUri("external"), null, null, null, null);
}
int loaded = 0;
while (mediaCursor.moveToNext() && loaded < 10) {
// get the media type. ion can show images for both regular images AND video.
int mediaType = mediaCursor.getInt(mediaCursor.getColumnIndex(MediaStore.Files.FileColumns.MEDIA_TYPE));
if (mediaType != MediaStore.Files.FileColumns.MEDIA_TYPE_IMAGE
&& mediaType != MediaStore.Files.FileColumns.MEDIA_TYPE_VIDEO) {
continue;
}
loaded++;
String uri = mediaCursor.getString(mediaCursor.getColumnIndex(MediaStore.Files.FileColumns.DATA));
File file = new File(uri);
// turn this into a file uri if necessary/possible
if (file.exists())
mAdapter.add(file.toURI().toString());
else
mAdapter.add(uri);
}
}
}
view.setOnItemClickListener(new OnItemClickListener(){
#Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// TODO Auto-generated method stub
Toast.makeText(MainActivity.this, mAdapter.getItem(position), Toast.LENGTH_SHORT).show();
// HERE I WANT TO GIVE THE INTENT TO DISPLAY IMAGE IN FULL SCREEN
Intent i = new Intent(MainActivity.this, FullScreenViewActivity.class);
i.putExtra("fullimagepath", mAdapter.get(position));
MainActivity.this.startActivity(i);
}
FullScreenViewActivity
public class FullScreenViewActivity extends Activity {
ImageView fullImage;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Ion.getDefault(this).configure().setLogging("ion-sample", Log.DEBUG);
setContentView(R.layout.activity_main);
String s = getIntent().getStringExtra("fullimagepath");
fullImage = (ImageView) findViewById(R.id.fullimage);
Ion.with(fullImage)
.centerCrop()
.placeholder(R.drawable.placeholder)
.error(R.drawable.error)
.load(s);
}}
In your adapter in the getView() method set your convert view's tag the image url. After that in
view.setOnItemClickListener(new OnItemClickListener(){
#Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// TODO Auto-generated method stub
Toast.makeText(MainActivity.this, mAdapter.getItem(position), Toast.LENGTH_SHORT).show();
Intent intent = new Intent(thisclass, toClass);
intent.putExtra(view.getTag()); // pass the url to other activity
startActivity(intent);
}
});
In the other activity get url from string extra and load the image from url.
Your activity should implements AdapterView.OnItemClickListener.
Add item click listener on the grid view
view.setOnItemClickListener(this);
Get selected image from grid view and open it on full screen on another activity:
#Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
String imageUrl = (String) parent.getItemAtPosition(position);
Intent intent = new Intent(MainActivity.this, FullScreenImageActivity.class);
intent.putExtra("IMAGE_URL", imageUrl);
startActivity(intent);
}
In FullScreenImageActivity:
String imageUrl = getIntent().getStringExtra("IMAGE_URL");
// Load image

Android Java: Unable to selectively highlight rows in a ListView via onScroll listener

I have another blocker as I study Android Development.
This time my problem is when I wanted to "selectively" highlight a row in a ListView populated by data from an adapter.
This ListView is actually within a dialog, and purpose is to show a list of friends, where user can multi-select and highlight it as he selects.
The selected values by the way, is stored in an ArrayList "arr_FriendsShare" so that the next time he opens the listview, rows will be highlighted (via onScrollListener) for those previously selected.
What is currently happening, only the "recently" or "last" clicked row/item is highlighted; and seems to be clearing all the previously highlighted rows.
I cannot understand why it is behaving that way, as row's value is successfully stored to/removed from arr_FriendsShare ArrayList, as I click on it.
Below is my listener codes, and thanks in advance for the usual help:
//Item click listener for Select Friends ListView
listview_SelectFriends.setOnItemClickListener(new OnItemClickListener()
{
#Override
public void onItemClick(AdapterView<?> adapter, View v, int position,
long arg3)
{
String friends_ListItemSelected = (String)adapter.getItemAtPosition(position);
if(!arr_FriendsShare.contains(friends_ListItemSelected)){
arr_FriendsShare.add(friends_ListItemSelected);
}
else{
removeItemFromArrayListString(Main.this, arr_FriendsShare, friends_ListItemSelected);
}
}
});
listview_SelectFriends.setOnScrollListener(new OnScrollListener() {
#Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
#Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
for (int i = firstVisibleItem; i < (visibleItemCount + firstVisibleItem); i++) {
String listViewItemText = view.getItemAtPosition(i).toString();
if(arr_FriendsShare.contains(listViewItemText)){
ColorDrawable cd = new ColorDrawable(getResources().getColor(R.color.red_light));
view.setSelector(cd);
}
else if(arr_FriendsShare.contains(listViewItemText)){
ColorDrawable cd = new ColorDrawable(Color.TRANSPARENT);
view.setSelector(cd);
}
}
}
});
Additional Code Block:
ArrayList<String> stringArray = new ArrayList<String>();
String jsonURL = <SOME URL HERE>;
stringArray = Global.getStringArrayFromJSON(Main.this, jsonURL, "friends", "FriendUsername");
LayoutInflater inflater = getLayoutInflater();
View convertView = (View) inflater.inflate(R.layout.friends_list_layout, null);
ListView listview_SelectFriends = (ListView) convertView.findViewById(R.id.layout_Friends);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, stringArray);
listview_SelectFriends.setAdapter(adapter);
Change
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, stringArray);
to
// Define this at class level as --> private FriendsAdapter adapter = null;
adapter = new FriendsAdapter(Main.this, stringArray);
add this method in your activity
private void setResetSelection(int index, boolean setSelection){
View v = listview_SelectFriends.getChildAt(index);
if(v != null){
TextView name = (TextView) v.findViewById(R.id.name);
if(setSelection)
name.setBackgroundResource(R.color.red);
else
name.setBackgroundResource(R.color.transparent);
}
}
and create a new class as
public class FriendsAdapter extends BaseAdapter {
private LayoutInflater mInflater;
private ArrayList<String> mFriends;
private ArrayList<String> mSelectedFriends = new ArrayList<String>();
public GoodPeopleAdapter(Context context, ArrayList<String> friends) {
mInflater = LayoutInflater.from(context);
mFriends= friends;
}
public void setSelectedFriends(ArrayList<String> selectedFriends){
mSelectedFriends = selectedFriends;
}
#Override
public int getCount() {
return mFriends.size();
}
#Override
public Object getItem(int position) {
return mFriends.get(position);
}
#Override
public long getItemId(int position) {
return position;
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
View view;
ViewHolder holder;
if(convertView == null) {
view = mInflater.inflate(R.layout.row_layout, parent, false);
holder = new ViewHolder();
holder.name = (TextView)view.findViewById(R.id.name);
view.setTag(holder);
} else {
view = convertView;
holder = (ViewHolder)view.getTag();
}
String name = mFriends.get(position);
holder.name.setText(name);
if(mSelectedFriends.contains(name))
holder.name.setBackgroundResource(R.color.red) // red is in color xml by default, change according to your choice
return view;
}
private class ViewHolder {
public TextView name;
}
}
Add following line at the end of method onItemClick
adapter.setSelectedFriends(arr_FriendsShare);
Add this in the if part of onItemClick
setResetSelection(position, true);
and this in else part
setResetSelection(position, false);
Also create a new xml layout with name row_layout with a textview with id name.

how to make a swipe between images from a grid view?

what do i have is many tabs between fragments .. each fragment has grid view and each time we press an image in the grid view it should be displayed full screen in a new activity .. and i want to add swipe functionality in this full screen image so the user can swipe left and right between other images in the grid view ... but i keep see an error on the full screen activity and log gave NULL POINTER EXCEPTION !!! please help ..
first of all here is the code for one of the fragments class :
public class KitchenBlinds extends Fragment {
public Integer[] mThumbIds = {
R.drawable.kit_1, R.drawable.kit_2,
R.drawable.kit_3, R.drawable.kit_4,
R.drawable.kit_5, R.drawable.kit_6,
R.drawable.kit_7, R.drawable.kit_8,
R.drawable.kit_9, R.drawable.kit_10,
R.drawable.kit_11, R.drawable.kit_12,
R.drawable.kit_13, R.drawable.kit_14,
R.drawable.kit_15
};
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.activity_kitchen_blinds, container, false);
GridView gridview = (GridView)view.findViewById(R.id.grid_view);
try{
// Instance of ImageAdapter Class
gridview.setAdapter(new ImageAdapter(getActivity(), mThumbIds));
} catch (OutOfMemoryError E) {
E.printStackTrace();
}
/**
* On Click event for Single Gridview Item
* */
gridview.setOnItemClickListener(new OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> parent, View v,
int position, long id) {
// Sending image id to FullScreenActivity
Intent i = new Intent(getActivity(), FullImageActivity2.class);
// passing array index
i.putExtra("id", mThumbIds[position]);
Log.d("ID", "" + mThumbIds[position]);
startActivity(i);
}
});
return view;
}
}
and then here is the code of the image adapter for the grid view class :
public class ImageAdapter extends BaseAdapter {
private Context mContext;
// Keep all Images in array
public Integer[] mThumbIds = {};
public ImageAdapter(Context c,Integer[] mThumbIds2){
mContext = c;
this.mThumbIds=mThumbIds2;
}
#Override
public int getCount() {
return mThumbIds.length;
}
#Override
public Object getItem(int position) {
return mThumbIds[position];
}
#Override
public long getItemId(int position) {
return position;
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
ImageView imageView = new ImageView(mContext);
imageView.setImageResource(mThumbIds[position]);
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView.setLayoutParams(new GridView.LayoutParams(100, 100));
imageView.setBackgroundResource(R.layout.edit_border);
imageView.setPadding(3, 3, 3, 3);
return imageView;
}
}
and here is the code for the Image Pager Adapter :
public class ImagePagerAdapter extends PagerAdapter{
private List<ImageView> images;
public ImagePagerAdapter(List<ImageView> images) {
this.images = images;
}
#Override
public Object instantiateItem(ViewGroup container, int position) {
ImageView imageView = images.get(position);
container.addView(imageView);
return imageView;
}
#Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView(images.get(position));
}
#Override
public int getCount() {
return images.size();
}
#Override
public boolean isViewFromObject(View view, Object o) {
// TODO Auto-generated method stub
return view == o;
}
}
and finally here is the code of the full screen activity that it crash on it each time i select the image :
public class FullImageActivity2 extends Activity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_full_image_activity2);
// Loop through the ids to create a list of full screen image views
ImageAdapter imageAdapter = new ImageAdapter(this);
List<ImageView> images = new ArrayList<ImageView>();
for (int i = 0; i < imageAdapter.getCount(); i++) {
ImageView imageView = new ImageView(this);
imageView.setImageResource(imageAdapter.mThumbIds[i]);
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
images.add(imageView);
}
// Finally create the adapter
ImagePagerAdapter imagePagerAdapter = new ImagePagerAdapter(images);
ViewPager viewPager = (ViewPager) findViewById(R.id.view_pager);
viewPager.setAdapter(imagePagerAdapter);
// Set the ViewPager to point to the selected image from the previous activity
// Selected image id
int position = getIntent().getExtras().getInt("id");
viewPager.setCurrentItem(position);
}
}
and i keep see an error on this line :
ImageAdapter imageAdapter = new ImageAdapter(this);
because i configure my constructor in the image adapter to take two parameter which work fine , but i don't know how to pass it here !!!
please help !! and thx in advance ...
well .. i fix the problem by sending the array in the kitchen blinds activity like this :
i.putExtra("array", mThumbIds);
then i receive it like this and add it to the constructor :
Intent i = getIntent();
Object[] s = (Object[]) getIntent().getSerializableExtra("array");
Integer[] newArray = Arrays.copyOf(s, s.length, Integer[].class);
and add it to the constructor :
ImageAdapter imageAdapter = new ImageAdapter(this, newArray);

Not able to display the clicked image

i have few images that i am displaying in gridview. what i want is when i click that image it should be displayed in full screen. i have also put viewpager to have sliding functionality. the problem that i am having is when i click on an image the first image is displayed(not that one).
he is my main activity
public class Ppdtsample extends Activity {
GridView grid;
static int[] imageId = { R.drawable.ppdt1, R.drawable.ppdt2,
R.drawable.ppdt3, R.drawable.ppdt4, R.drawable.ppdt5,
R.drawable.ppdt6, R.drawable.ppdt7, };
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.ppdtsamples);
ImageAdapter adapter = new ImageAdapter(Ppdtsample.this, imageId);
grid=(GridView)findViewById(R.id.grid_view);
grid.setAdapter(adapter);
grid.setOnItemClickListener(new AdapterView.OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// TODO Auto-generated method stub
Intent i = new Intent(getApplicationContext(), FullImageActivity.class);
// passing array index
i.putExtra("id", position);
startActivity(i);
}
});
}
}
this is my activity to display in full screen with sliding functionality:
public class FullImageActivity extends Activity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.full_image);
// get intent data
Intent i = getIntent();
// Selected image id
int position = i.getExtras().getInt("id");
// passing array index
ViewPager viewPager = (ViewPager) findViewById(R.id.view_pager);
viewPager.setBackgroundResource(0);
SlideImage adapter = new SlideImage(this);
viewPager.setAdapter(adapter);
}
}
and this is my class for viewpager
public class SlideImage extends PagerAdapter {
Context context;
private int[] GalImages = { R.drawable.ppdt1, R.drawable.ppdt2,
R.drawable.ppdt3, R.drawable.ppdt4, R.drawable.ppdt5,
R.drawable.ppdt6, R.drawable.ppdt7, };
SlideImage(Context context) {
this.context = context;
}
#Override
public int getCount() {
return GalImages.length;
}
#Override
public boolean isViewFromObject(View view, Object object) {
return view == ((ImageView) object);
}
#Override
public Object instantiateItem(ViewGroup container, int position) {
ImageView imageView = new ImageView(context);
int padding = context.getResources().getDimensionPixelSize(R.dimen.activity_vertical_margin);
imageView.setPadding(padding, padding, padding, padding);
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
imageView.setImageResource(GalImages[position]);
((ViewPager) container).addView(imageView, 0);
return imageView;
}
#Override
public void destroyItem(ViewGroup container, int position, Object object) {
((ViewPager) container).removeView((ImageView) object);
}
}
it is displaying the first image and not the image i click because i am not able to pass the 'position' of the clicked image. it is taking the position from this method in SlideImage.class
Object instantiateItem(ViewGroup container, int position)
which is the first position. i want to pass the position from fullImageActivity.class to the position in this line
imageView.setImageResource(GalImages[position]);
which is on SlideshowActivity.
This may look complicated but i just want to pass the value of position from FullImageActivity.class to SlideImage.class. Please help me
Your Ppdtsample looks strange.Here I tried to modify your Ppdtsample class,which worked for me:
public class Ppdtsample extends Activity {
GridView grid;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.grid_layout);
grid = (GridView) findViewById(R.id.grid_view);
// Instance of SlideImage Class
gridView.setAdapter(new SlideImage(this));
gridView.setOnItemClickListener(new OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> parent, View v,
int position, long id) {
Intent i = new Intent(getApplicationContext(),FullImageActivity.class);
i.putExtra("id", position);
startActivity(i);
}
});
}
}
And the reason you can't pass the id is because you set the wrong adapter in Ppdtsample.It should be SlideImage in you code, not ImageAdapter.

how to display video thumbnails?

i am trying to show my arraylist value in my tablayout. now i am successfully passed two values in my two tabhost it's working. i have three tabhost 2tab host working fine. so i am trying show my stored path value video thumb. how to show my stored path value to video thumb nail? i am trying to show but i am getting error
error is:
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 this is my main class here i am passing my value using below code:
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 am getting this passed value in below code in 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");

Categories

Resources