How to handle long click in multi image viewHow to align views at the bottom of the screen?How to prevent a dialog from closing when a button is clickedHow to start new activity on button clickAllow multi-line in EditText view in Android?Android: Why does long click also trigger a normal click?How to handle button clicks using the XML onClick within Fragmentshow to implement a long click listener on a listviewHow to create RecyclerView with multiple view type?Handle on item long click on recycler viewAndroid custom image view shape
How to make all magic-casting innate, but still rare?
I have found ports on my Samsung smart tv running a display service. What can I do with it?
Is swap gate equivalent to just exchanging the wire of the two qubits?
How to use random to choose colors
Digital signature that is only verifiable by one specific person
Co-worker is now managing my team. Does this mean that I'm being demoted?
How to write a nice frame challenge?
How would Japanese people react to someone refusing to say “itadakimasu” for religious reasons?
Why swap space doesn't get filesystem check at boot time?
Print the new site header
1960s sci-fi anthology with a Viking fighting a U.S. army MP on the cover
Showing that a language is NP Complete (advice)
How can the US president give an order to a civilian?
In a Fish that is not a Fish
What is the precise meaning of "подсел на мак"?
Should I email my professor to clear up a (possibly very irrelevant) awkward misunderstanding?
Expand command in an argument before the main command
How to make a villain when your PCs are villains?
Leaving job close to major deadlines
Is a sequel allowed to start before the end of the first book?
Why do you need to heat the pan before heating the olive oil?
Justifying Affordable Bespoke Spaceships
What is "dot" sign in •NO?
How to avoid offending original culture when making conculture inspired from original
How to handle long click in multi image view
How to align views at the bottom of the screen?How to prevent a dialog from closing when a button is clickedHow to start new activity on button clickAllow multi-line in EditText view in Android?Android: Why does long click also trigger a normal click?How to handle button clicks using the XML onClick within Fragmentshow to implement a long click listener on a listviewHow to create RecyclerView with multiple view type?Handle on item long click on recycler viewAndroid custom image view shape
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have 8-numbers of ImageView in my layout and I had set the LongClickListner to all of the ImageView. If the user long click on the image (any image), the image will be saved in the gallery. But my problem here is when the user long click on 8th Image, the 1st or others (1 of them) will saved in the gallery. What I want is when the user long click on 8th image, the 8th image will saved not the others.
@Override
public boolean onContextItemSelected(MenuItem item)
switch (item.getItemId())
case R.id.saveImage:
if(img1.isLongClickable() )
BitmapDrawable bitmapDrawable = (BitmapDrawable)img1.getDrawable();
Bitmap bitmap = bitmapDrawable.getBitmap();
Random random = new Random();
int x = random.nextInt(1000000);
saveImageUtils.insertImage(getActivity().getContentResolver(),bitmap,String.valueOf(x));
//SaveImage(bitmap);
Toast.makeText(getContext(), "Image Saved to Device", Toast.LENGTH_SHORT).show();
break;
else if(img2.isLongClickable())
BitmapDrawable bitmapDrawable = (BitmapDrawable)img2.getDrawable();
Bitmap bitmap = bitmapDrawable.getBitmap();
Random random = new Random();
int x = random.nextInt(1000000);
saveImageUtils.insertImage(getActivity().getContentResolver(),bitmap,String.valueOf(x));
//SaveImage(bitmap);
Toast.makeText(getContext(), "Image Saved to Device", Toast.LENGTH_SHORT).show();
break;
else if(img3.isLongClickable())
BitmapDrawable bitmapDrawable = (BitmapDrawable)img3.getDrawable();
Bitmap bitmap = bitmapDrawable.getBitmap();
Random random = new Random();
int x = random.nextInt(1000000);
saveImageUtils.insertImage(getActivity().getContentResolver(),bitmap,String.valueOf(x));
//SaveImage(bitmap);
Toast.makeText(getContext(), "Image Saved to Device", Toast.LENGTH_SHORT).show();
break;
else if(img4.isLongClickable())
BitmapDrawable bitmapDrawable = (BitmapDrawable)img4.getDrawable();
Bitmap bitmap = bitmapDrawable.getBitmap();
Random random = new Random();
int x = random.nextInt(1000000);
saveImageUtils.insertImage(getActivity().getContentResolver(),bitmap,String.valueOf(x));
//SaveImage(bitmap);
Toast.makeText(getContext(), "Image Saved to Device", Toast.LENGTH_SHORT).show();
break;
else if(img5.isLongClickable())
BitmapDrawable bitmapDrawable = (BitmapDrawable)img5.getDrawable();
Bitmap bitmap = bitmapDrawable.getBitmap();
Random random = new Random();
int x = random.nextInt(1000000);
saveImageUtils.insertImage(getActivity().getContentResolver(),bitmap,String.valueOf(x));
//SaveImage(bitmap);
Toast.makeText(getContext(), "Image Saved to Device", Toast.LENGTH_SHORT).show();
break;
else if(img6.isLongClickable())
BitmapDrawable bitmapDrawable = (BitmapDrawable)img6.getDrawable();
Bitmap bitmap = bitmapDrawable.getBitmap();
Random random = new Random();
int x = random.nextInt(1000000);
saveImageUtils.insertImage(getActivity().getContentResolver(),bitmap,String.valueOf(x));
//SaveImage(bitmap);
Toast.makeText(getContext(), "Image Saved to Device", Toast.LENGTH_SHORT).show();
break;
else if(img7.isLongClickable())
BitmapDrawable bitmapDrawable = (BitmapDrawable)img7.getDrawable();
Bitmap bitmap = bitmapDrawable.getBitmap();
Random random = new Random();
int x = random.nextInt(1000000);
saveImageUtils.insertImage(getActivity().getContentResolver(),bitmap,String.valueOf(x));
//SaveImage(bitmap);
Toast.makeText(getContext(), "Image Saved to Device", Toast.LENGTH_SHORT).show();
break;
else if(img8.isLongClickable())
BitmapDrawable bitmapDrawable = (BitmapDrawable)img8.getDrawable();
Bitmap bitmap = bitmapDrawable.getBitmap();
Random random = new Random();
int x = random.nextInt(1000000);
saveImageUtils.insertImage(getActivity().getContentResolver(),bitmap,String.valueOf(x));
//SaveImage(bitmap);
Toast.makeText(getContext(), "Image Saved to Device", Toast.LENGTH_SHORT).show();
break;
return super.onContextItemSelected(item);
add a comment |
I have 8-numbers of ImageView in my layout and I had set the LongClickListner to all of the ImageView. If the user long click on the image (any image), the image will be saved in the gallery. But my problem here is when the user long click on 8th Image, the 1st or others (1 of them) will saved in the gallery. What I want is when the user long click on 8th image, the 8th image will saved not the others.
@Override
public boolean onContextItemSelected(MenuItem item)
switch (item.getItemId())
case R.id.saveImage:
if(img1.isLongClickable() )
BitmapDrawable bitmapDrawable = (BitmapDrawable)img1.getDrawable();
Bitmap bitmap = bitmapDrawable.getBitmap();
Random random = new Random();
int x = random.nextInt(1000000);
saveImageUtils.insertImage(getActivity().getContentResolver(),bitmap,String.valueOf(x));
//SaveImage(bitmap);
Toast.makeText(getContext(), "Image Saved to Device", Toast.LENGTH_SHORT).show();
break;
else if(img2.isLongClickable())
BitmapDrawable bitmapDrawable = (BitmapDrawable)img2.getDrawable();
Bitmap bitmap = bitmapDrawable.getBitmap();
Random random = new Random();
int x = random.nextInt(1000000);
saveImageUtils.insertImage(getActivity().getContentResolver(),bitmap,String.valueOf(x));
//SaveImage(bitmap);
Toast.makeText(getContext(), "Image Saved to Device", Toast.LENGTH_SHORT).show();
break;
else if(img3.isLongClickable())
BitmapDrawable bitmapDrawable = (BitmapDrawable)img3.getDrawable();
Bitmap bitmap = bitmapDrawable.getBitmap();
Random random = new Random();
int x = random.nextInt(1000000);
saveImageUtils.insertImage(getActivity().getContentResolver(),bitmap,String.valueOf(x));
//SaveImage(bitmap);
Toast.makeText(getContext(), "Image Saved to Device", Toast.LENGTH_SHORT).show();
break;
else if(img4.isLongClickable())
BitmapDrawable bitmapDrawable = (BitmapDrawable)img4.getDrawable();
Bitmap bitmap = bitmapDrawable.getBitmap();
Random random = new Random();
int x = random.nextInt(1000000);
saveImageUtils.insertImage(getActivity().getContentResolver(),bitmap,String.valueOf(x));
//SaveImage(bitmap);
Toast.makeText(getContext(), "Image Saved to Device", Toast.LENGTH_SHORT).show();
break;
else if(img5.isLongClickable())
BitmapDrawable bitmapDrawable = (BitmapDrawable)img5.getDrawable();
Bitmap bitmap = bitmapDrawable.getBitmap();
Random random = new Random();
int x = random.nextInt(1000000);
saveImageUtils.insertImage(getActivity().getContentResolver(),bitmap,String.valueOf(x));
//SaveImage(bitmap);
Toast.makeText(getContext(), "Image Saved to Device", Toast.LENGTH_SHORT).show();
break;
else if(img6.isLongClickable())
BitmapDrawable bitmapDrawable = (BitmapDrawable)img6.getDrawable();
Bitmap bitmap = bitmapDrawable.getBitmap();
Random random = new Random();
int x = random.nextInt(1000000);
saveImageUtils.insertImage(getActivity().getContentResolver(),bitmap,String.valueOf(x));
//SaveImage(bitmap);
Toast.makeText(getContext(), "Image Saved to Device", Toast.LENGTH_SHORT).show();
break;
else if(img7.isLongClickable())
BitmapDrawable bitmapDrawable = (BitmapDrawable)img7.getDrawable();
Bitmap bitmap = bitmapDrawable.getBitmap();
Random random = new Random();
int x = random.nextInt(1000000);
saveImageUtils.insertImage(getActivity().getContentResolver(),bitmap,String.valueOf(x));
//SaveImage(bitmap);
Toast.makeText(getContext(), "Image Saved to Device", Toast.LENGTH_SHORT).show();
break;
else if(img8.isLongClickable())
BitmapDrawable bitmapDrawable = (BitmapDrawable)img8.getDrawable();
Bitmap bitmap = bitmapDrawable.getBitmap();
Random random = new Random();
int x = random.nextInt(1000000);
saveImageUtils.insertImage(getActivity().getContentResolver(),bitmap,String.valueOf(x));
//SaveImage(bitmap);
Toast.makeText(getContext(), "Image Saved to Device", Toast.LENGTH_SHORT).show();
break;
return super.onContextItemSelected(item);
1
Show full code snippet. Can't understand the existing one.
– bhagyawant biradar
Mar 25 at 4:58
add a comment |
I have 8-numbers of ImageView in my layout and I had set the LongClickListner to all of the ImageView. If the user long click on the image (any image), the image will be saved in the gallery. But my problem here is when the user long click on 8th Image, the 1st or others (1 of them) will saved in the gallery. What I want is when the user long click on 8th image, the 8th image will saved not the others.
@Override
public boolean onContextItemSelected(MenuItem item)
switch (item.getItemId())
case R.id.saveImage:
if(img1.isLongClickable() )
BitmapDrawable bitmapDrawable = (BitmapDrawable)img1.getDrawable();
Bitmap bitmap = bitmapDrawable.getBitmap();
Random random = new Random();
int x = random.nextInt(1000000);
saveImageUtils.insertImage(getActivity().getContentResolver(),bitmap,String.valueOf(x));
//SaveImage(bitmap);
Toast.makeText(getContext(), "Image Saved to Device", Toast.LENGTH_SHORT).show();
break;
else if(img2.isLongClickable())
BitmapDrawable bitmapDrawable = (BitmapDrawable)img2.getDrawable();
Bitmap bitmap = bitmapDrawable.getBitmap();
Random random = new Random();
int x = random.nextInt(1000000);
saveImageUtils.insertImage(getActivity().getContentResolver(),bitmap,String.valueOf(x));
//SaveImage(bitmap);
Toast.makeText(getContext(), "Image Saved to Device", Toast.LENGTH_SHORT).show();
break;
else if(img3.isLongClickable())
BitmapDrawable bitmapDrawable = (BitmapDrawable)img3.getDrawable();
Bitmap bitmap = bitmapDrawable.getBitmap();
Random random = new Random();
int x = random.nextInt(1000000);
saveImageUtils.insertImage(getActivity().getContentResolver(),bitmap,String.valueOf(x));
//SaveImage(bitmap);
Toast.makeText(getContext(), "Image Saved to Device", Toast.LENGTH_SHORT).show();
break;
else if(img4.isLongClickable())
BitmapDrawable bitmapDrawable = (BitmapDrawable)img4.getDrawable();
Bitmap bitmap = bitmapDrawable.getBitmap();
Random random = new Random();
int x = random.nextInt(1000000);
saveImageUtils.insertImage(getActivity().getContentResolver(),bitmap,String.valueOf(x));
//SaveImage(bitmap);
Toast.makeText(getContext(), "Image Saved to Device", Toast.LENGTH_SHORT).show();
break;
else if(img5.isLongClickable())
BitmapDrawable bitmapDrawable = (BitmapDrawable)img5.getDrawable();
Bitmap bitmap = bitmapDrawable.getBitmap();
Random random = new Random();
int x = random.nextInt(1000000);
saveImageUtils.insertImage(getActivity().getContentResolver(),bitmap,String.valueOf(x));
//SaveImage(bitmap);
Toast.makeText(getContext(), "Image Saved to Device", Toast.LENGTH_SHORT).show();
break;
else if(img6.isLongClickable())
BitmapDrawable bitmapDrawable = (BitmapDrawable)img6.getDrawable();
Bitmap bitmap = bitmapDrawable.getBitmap();
Random random = new Random();
int x = random.nextInt(1000000);
saveImageUtils.insertImage(getActivity().getContentResolver(),bitmap,String.valueOf(x));
//SaveImage(bitmap);
Toast.makeText(getContext(), "Image Saved to Device", Toast.LENGTH_SHORT).show();
break;
else if(img7.isLongClickable())
BitmapDrawable bitmapDrawable = (BitmapDrawable)img7.getDrawable();
Bitmap bitmap = bitmapDrawable.getBitmap();
Random random = new Random();
int x = random.nextInt(1000000);
saveImageUtils.insertImage(getActivity().getContentResolver(),bitmap,String.valueOf(x));
//SaveImage(bitmap);
Toast.makeText(getContext(), "Image Saved to Device", Toast.LENGTH_SHORT).show();
break;
else if(img8.isLongClickable())
BitmapDrawable bitmapDrawable = (BitmapDrawable)img8.getDrawable();
Bitmap bitmap = bitmapDrawable.getBitmap();
Random random = new Random();
int x = random.nextInt(1000000);
saveImageUtils.insertImage(getActivity().getContentResolver(),bitmap,String.valueOf(x));
//SaveImage(bitmap);
Toast.makeText(getContext(), "Image Saved to Device", Toast.LENGTH_SHORT).show();
break;
return super.onContextItemSelected(item);
I have 8-numbers of ImageView in my layout and I had set the LongClickListner to all of the ImageView. If the user long click on the image (any image), the image will be saved in the gallery. But my problem here is when the user long click on 8th Image, the 1st or others (1 of them) will saved in the gallery. What I want is when the user long click on 8th image, the 8th image will saved not the others.
@Override
public boolean onContextItemSelected(MenuItem item)
switch (item.getItemId())
case R.id.saveImage:
if(img1.isLongClickable() )
BitmapDrawable bitmapDrawable = (BitmapDrawable)img1.getDrawable();
Bitmap bitmap = bitmapDrawable.getBitmap();
Random random = new Random();
int x = random.nextInt(1000000);
saveImageUtils.insertImage(getActivity().getContentResolver(),bitmap,String.valueOf(x));
//SaveImage(bitmap);
Toast.makeText(getContext(), "Image Saved to Device", Toast.LENGTH_SHORT).show();
break;
else if(img2.isLongClickable())
BitmapDrawable bitmapDrawable = (BitmapDrawable)img2.getDrawable();
Bitmap bitmap = bitmapDrawable.getBitmap();
Random random = new Random();
int x = random.nextInt(1000000);
saveImageUtils.insertImage(getActivity().getContentResolver(),bitmap,String.valueOf(x));
//SaveImage(bitmap);
Toast.makeText(getContext(), "Image Saved to Device", Toast.LENGTH_SHORT).show();
break;
else if(img3.isLongClickable())
BitmapDrawable bitmapDrawable = (BitmapDrawable)img3.getDrawable();
Bitmap bitmap = bitmapDrawable.getBitmap();
Random random = new Random();
int x = random.nextInt(1000000);
saveImageUtils.insertImage(getActivity().getContentResolver(),bitmap,String.valueOf(x));
//SaveImage(bitmap);
Toast.makeText(getContext(), "Image Saved to Device", Toast.LENGTH_SHORT).show();
break;
else if(img4.isLongClickable())
BitmapDrawable bitmapDrawable = (BitmapDrawable)img4.getDrawable();
Bitmap bitmap = bitmapDrawable.getBitmap();
Random random = new Random();
int x = random.nextInt(1000000);
saveImageUtils.insertImage(getActivity().getContentResolver(),bitmap,String.valueOf(x));
//SaveImage(bitmap);
Toast.makeText(getContext(), "Image Saved to Device", Toast.LENGTH_SHORT).show();
break;
else if(img5.isLongClickable())
BitmapDrawable bitmapDrawable = (BitmapDrawable)img5.getDrawable();
Bitmap bitmap = bitmapDrawable.getBitmap();
Random random = new Random();
int x = random.nextInt(1000000);
saveImageUtils.insertImage(getActivity().getContentResolver(),bitmap,String.valueOf(x));
//SaveImage(bitmap);
Toast.makeText(getContext(), "Image Saved to Device", Toast.LENGTH_SHORT).show();
break;
else if(img6.isLongClickable())
BitmapDrawable bitmapDrawable = (BitmapDrawable)img6.getDrawable();
Bitmap bitmap = bitmapDrawable.getBitmap();
Random random = new Random();
int x = random.nextInt(1000000);
saveImageUtils.insertImage(getActivity().getContentResolver(),bitmap,String.valueOf(x));
//SaveImage(bitmap);
Toast.makeText(getContext(), "Image Saved to Device", Toast.LENGTH_SHORT).show();
break;
else if(img7.isLongClickable())
BitmapDrawable bitmapDrawable = (BitmapDrawable)img7.getDrawable();
Bitmap bitmap = bitmapDrawable.getBitmap();
Random random = new Random();
int x = random.nextInt(1000000);
saveImageUtils.insertImage(getActivity().getContentResolver(),bitmap,String.valueOf(x));
//SaveImage(bitmap);
Toast.makeText(getContext(), "Image Saved to Device", Toast.LENGTH_SHORT).show();
break;
else if(img8.isLongClickable())
BitmapDrawable bitmapDrawable = (BitmapDrawable)img8.getDrawable();
Bitmap bitmap = bitmapDrawable.getBitmap();
Random random = new Random();
int x = random.nextInt(1000000);
saveImageUtils.insertImage(getActivity().getContentResolver(),bitmap,String.valueOf(x));
//SaveImage(bitmap);
Toast.makeText(getContext(), "Image Saved to Device", Toast.LENGTH_SHORT).show();
break;
return super.onContextItemSelected(item);
asked Mar 25 at 4:49
David AdamDavid Adam
6211
6211
1
Show full code snippet. Can't understand the existing one.
– bhagyawant biradar
Mar 25 at 4:58
add a comment |
1
Show full code snippet. Can't understand the existing one.
– bhagyawant biradar
Mar 25 at 4:58
1
1
Show full code snippet. Can't understand the existing one.
– bhagyawant biradar
Mar 25 at 4:58
Show full code snippet. Can't understand the existing one.
– bhagyawant biradar
Mar 25 at 4:58
add a comment |
1 Answer
1
active
oldest
votes
What you presented above is like this:
- Apparently your ImageView's have
OnLongClickListeners assigned - User is clicking toolbar's menu item
R.id.saveImageand you're trying to save image based onisLongClickableindication
If true, the above is wrong because isLongClickable is basically just indication that given control has OnLongClickListener assigned.
What you should be doing: either do your saving inside every respective OnLongClickListener(and its onLongClick will give you the view, that is, ImageView) OR if you need to do the saving only upon R.id.saveImage click, then in OnLongClickListener you should somehow tell your app that given ImageView was long clicked, and then upon R.id.saveImage click, iterate through recorded list of ImageView long clicks and perform the saving.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55331417%2fhow-to-handle-long-click-in-multi-image-view%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
What you presented above is like this:
- Apparently your ImageView's have
OnLongClickListeners assigned - User is clicking toolbar's menu item
R.id.saveImageand you're trying to save image based onisLongClickableindication
If true, the above is wrong because isLongClickable is basically just indication that given control has OnLongClickListener assigned.
What you should be doing: either do your saving inside every respective OnLongClickListener(and its onLongClick will give you the view, that is, ImageView) OR if you need to do the saving only upon R.id.saveImage click, then in OnLongClickListener you should somehow tell your app that given ImageView was long clicked, and then upon R.id.saveImage click, iterate through recorded list of ImageView long clicks and perform the saving.
add a comment |
What you presented above is like this:
- Apparently your ImageView's have
OnLongClickListeners assigned - User is clicking toolbar's menu item
R.id.saveImageand you're trying to save image based onisLongClickableindication
If true, the above is wrong because isLongClickable is basically just indication that given control has OnLongClickListener assigned.
What you should be doing: either do your saving inside every respective OnLongClickListener(and its onLongClick will give you the view, that is, ImageView) OR if you need to do the saving only upon R.id.saveImage click, then in OnLongClickListener you should somehow tell your app that given ImageView was long clicked, and then upon R.id.saveImage click, iterate through recorded list of ImageView long clicks and perform the saving.
add a comment |
What you presented above is like this:
- Apparently your ImageView's have
OnLongClickListeners assigned - User is clicking toolbar's menu item
R.id.saveImageand you're trying to save image based onisLongClickableindication
If true, the above is wrong because isLongClickable is basically just indication that given control has OnLongClickListener assigned.
What you should be doing: either do your saving inside every respective OnLongClickListener(and its onLongClick will give you the view, that is, ImageView) OR if you need to do the saving only upon R.id.saveImage click, then in OnLongClickListener you should somehow tell your app that given ImageView was long clicked, and then upon R.id.saveImage click, iterate through recorded list of ImageView long clicks and perform the saving.
What you presented above is like this:
- Apparently your ImageView's have
OnLongClickListeners assigned - User is clicking toolbar's menu item
R.id.saveImageand you're trying to save image based onisLongClickableindication
If true, the above is wrong because isLongClickable is basically just indication that given control has OnLongClickListener assigned.
What you should be doing: either do your saving inside every respective OnLongClickListener(and its onLongClick will give you the view, that is, ImageView) OR if you need to do the saving only upon R.id.saveImage click, then in OnLongClickListener you should somehow tell your app that given ImageView was long clicked, and then upon R.id.saveImage click, iterate through recorded list of ImageView long clicks and perform the saving.
answered Mar 25 at 5:05
rorror
601611
601611
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55331417%2fhow-to-handle-long-click-in-multi-image-view%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Show full code snippet. Can't understand the existing one.
– bhagyawant biradar
Mar 25 at 4:58