imageview

Android OutOfMemory Issue [closed]

孤街浪徒 提交于 2019-12-02 09:37:34
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . i face outofmemory issue in my app and after some search, I found out this code //decodes image and scales it to reduce memory consumption private Bitmap decodeFile(File f){ try { //Decode image size

Getting Bitmap from TextLayout in onCreate

懵懂的女人 提交于 2019-12-02 09:37:20
I am able to convert a Layout with a TextView into a Bitmap , as long as the event that happens after onCreate() . But when I try during on create, it does not work. Is there a way to get this to work? I have tried using inflate() in various ways with no joy. There are various answered questions including this one that address the technique that I'm successfully using in my code. But the success does not include employing the technique from onCreate() . public class MainActivity extends AppCompatActivity { private static final String TAG = MainActivity.class.getSimpleName(); private

Android load image into imageview efficiently

允我心安 提交于 2019-12-02 09:34:59
问题 I have next problem: To avoid OutOfMemoryError i'm loading my big images into ImageViews using Picasso in such way: public static RequestCreator picasso(final Context context, final int resourceId) { return Picasso.with(context) .load(resourceId) .fit() .centerCrop() .noFade(); } And in activity or fragment, i'm loading image into ImageView final ImageView backgroundImage = (ImageView) root.findViewById(R.id.background_image); Util.picasso(getActivity(),R.drawable.background_soulmap) .into

Change ImageView after few seconds

回眸只為那壹抹淺笑 提交于 2019-12-02 09:28:45
I'm trying to implement a simple activity that will let user to insert a password. I've a gridview with the 9 images to use and 4 imageviews that will be the selected images (on clicking on item on gridview, the corresponding image will be filled with the selected one). Now the problem: I want that the 4 imageviews acts similar to password fields: for 1 seconds appears the selected item and then another image... I tried using asyncthread but I got and error: Only the original thread that created a view hierarchy can touch its views Here my code: @Override protected String doInBackground

how to detect when a ImageView is in collision with another ImageView?

爷,独闯天下 提交于 2019-12-02 09:23:49
Im developing a test game with some imageviews on the screen. with the finger, i am moving another imageview. I want to detect when the imageview moved by the finger has touched another imageview. ¿Wich is the best way to achieve it? I can't find info about it on google... Thanks I'll answer the general question - find out when two views overlap : private boolean viewsOverlap(View v1, View v2) { int[] v1_coords = new int[2]; v1.getLocationOnScreen(v1_coords); int v1_w = v1.getWidth(); int v1_h = v1.getHeight(); Rect v1_rect = new Rect(v1_coords[0], v1_coords[1], v1_coords[0] + v1_w, v1_coords

How to generate random image using image view in swift

断了今生、忘了曾经 提交于 2019-12-02 08:17:16
I just followed treehouse course and create my first Fun Fact app.In that they generate a random array quotes. Needed: I have placed image view using storyboard.Already when pressing one button random array quotes will generate.But i need when that same button pressed a random image should generate.I am new to swift .! This is factbook.swift struct FactBook { // stored in arry to show all quotes let factsArray = [ "You have to dream before your dreams can come true.", "To succeed in your mission, you must have single-minded devotion to your goal.", "You have to dream before your dreams can

Titanium ImageView wont display images?

无人久伴 提交于 2019-12-02 08:12:42
I created an image directory in my projects in the UI folder to place my images. So the full path is currently Resources/UI/Images. When i create an image view it wont display the images. I tried different options, even a web image but nothing works? var self = Ti.UI.createView({ backgroundColor:'white' }); var imgv = Titanium.UI.createImageView({url:"http://upload.wikimedia.org/wikipedia/commons/thumb/1/1a/Volkswagen_Logo.png/600px-Volkswagen_Logo.png"}); self.add(imgv); var imgv = Titanium.UI.createImageView({url:"../images/sb02.jpg"}); self.add(imgv); var imgv = Titanium.UI.createImageView(

Android loading images efficient (out of memory) [duplicate]

旧巷老猫 提交于 2019-12-02 07:46:31
This question already has an answer here: Bitmap recycle with largeHeap enabled 5 answers I just startet writing an app for Android. I have 3 activitys that use the same xml layout, an grid view. They also use all the same adapter to show an imageview and an textview in each grid item. When you select an object in the first activity, you get to the second and then to the third. First I used the normal method "imageView.setImageResource(drawableid)". It wasn't really a problem, but when I put more images into the gridview, I got the outofmemory error. So I search for a solution. I tried the

Animate ImageView from alpha 0 to 1

笑着哭i 提交于 2019-12-02 07:38:32
I have an imageView that I want to start as invisible. After a certain button is clicked, I want to animate the Image into view and then I want it to remain at alpha 1. How do I do that? So far no luck. If I set the alpha to 0 in xml, then I never see the image. If I don't set alpha in xml then the image is always visible, and when the button is clicked it animates from 0 to 1 alpha. Here is my animation code. AlphaAnimation animation1 = new AlphaAnimation(0.0f, 1.0f); animation1.setDuration(1000); animation1.setStartOffset(5000); animation1.setFillAfter(true); tokenBtn.startAnimation

Get android's id resource from a string

百般思念 提交于 2019-12-02 07:25:06
In my Kotlin app I have some ImageViews (in activity_main.xml ): imageView_0 , imageView_1 , imageView_2 and imageView_3 . How can I access the view in a loop from 0 to 3? This won't work: val imageView: ImageView = findViewById<ImageView>("R.id.imageView_" + index) as ImageView Peter Haddad for(i in 1..3){ val id: int=getResources().getIdentifier("imageview_"+i, "id", getPackageName()) imageview[i]=findViewById(id) as ImageView } If you have in the xml , imageview_1 , imageview_2 , imageview_3 Another option allowing to declare your array with not-nullable ImageView s: val imageViews : Array