I am new to android.I want to insert a pictue (which is in c: drive) using image view control. pls give some idea related to it.
this covers that in detail. let us know if you have specific questions.
http://developer.android.com/guide/topics/graphics/2d-graphics.html#drawables-from-images
Displaying an image in an ImageView is quite simple. Check out this family of files from API Demos:
ImageView1.java
image_view_1.xml
ImageView1.java is quite simple: it just loads the xml layout file. You can change the #drawable/... references in image_view_1.xml to point to your own resources and see the effects you get with different styles of ImageView.
I recommend exploring the API Demos code, as it covers a large portion of the Android framework and will give you an idea about what is possible.
Related
I'm trying to make an application which has kind a meme generator, I'm wondering,
if I place an image on the screen and I put a textView in there, is there any way to download that image with the text placed on it?
You can use below gitHub library for generating memes
lucas-meme-generator
Best to use in android-studio but also compitible with eclipse/ant or Intellij/maven if you'd like, but some files/directory hierarchies might be slightly different
I have used Picasso in my Android Application which has many images. Its working and looking good. I am trying to make UI more of simple and user friendly. I have placeholder for my imageviews before actual image loads. But its white color. I want to placeholder image depending on main color of image like pinterest.
Pinterest placeholder images before main image loads. Following screenshot:
And after image loads it shows proper image based on main background color shown for placeholder:
Is it possible to achieve in Picasso library provided by Square or whats the way to achieve.
Please help.
Bit late but for other readers that want to accomplish a similar thing, I'll just leave this here. I don't know how Pinterest did/does it, probably developed their own implementation. But Google updated the v7 support library with 'Palette' which is a new API which allows you to extract prominent colours from images when provided with an Image Bitmap.
Edit: Something I just realised that this probably doesn't help for placeholders since you need an image to actually get colours from! So my best guess is that Pinterest does the colour extraction from the server and includes the colour in the (presumably) JSON response that is sent to the client.
I haven't used it much myself but it works quite well from what I've seen/read. You can read up more about it at these two places:
Developer Docs
Tutorial/Explanation (Willow Tree Apps)
You can only do that by saving the prominent color from the image while saving it in your database & then retrieving it for later use.
https://pypi.org/project/extcolors/ is a very easy to use python library that extracts the colors for you given an image.
Or you could you https://github.com/woltapp/blurhash a library that'll give you this.
Both ways, you'll have to first save the BlurHash or The color as a metadata in your database, and then when the user requests the data, you'll send either of those and display them till the data is fully downloaded.
I am using the standard code stated in the example of the library of https://code.google.com/p/svg-android/wiki/Tutorial, here is my OnCreate method :
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test);
ImageView imageView = (ImageView)findViewById(R.id.imageViewTest);
// Set the background color to white
imageView.setBackgroundColor(Color.GRAY);
// Parse the SVG file from the resource
SVG svg = SVGParser.getSVGFromResource(getResources(), R.drawable.android);
//Get a drawable from the parsed SVG and set it as the drawable for the ImageView
imageView.setImageDrawable(svg.createPictureDrawable());
}
I am not able to add the layout code here, so sharing it in this doc: https://docs.google.com/document/d/1fbi3B_hAYUh_C2IwPfInvZ-BG2bgsa4pZoJKj8NBT9o/edit?usp=sharing
It does not give any error but it also does not display the image.
I was earlier getting doubts that the image is incorrect, then I used the one in the same example.
Yet it is not displaying the image nor giving any error.
Please suggest how to debug further.
On newer devices have hardware rendering turned on by default so you need to explicitly turn on software rendering.
use this after your code:
imageView.setLayerType(View.LAYER_TYPE_SOFTWARE,null);
Your problem is almost certainly hardware acceleration. You may need to set the View LayerType to software mode.
See Having issue on Real Device using vector image in android. SVG-android
If that doesn't fix it, then it may be an issue with svg-android, which can have trouble rendering correctly anything other than simple SVGs. You might have better luck with my library AndroidSVG.
The best practice for SVG on Android is going to be to use a tool to convert your SVG to PNG at the size(s) you're interested in. Existing SVG support for Android is not comprehensive of what you're likely to find in an SVG file, and even if it were, the support is not built into the OS so using them directly is out of source .
If the library you're working with can process the SVGs you have well, you can make it work for every icon but not through the standard Android API; you'll need to create a custom view. Around months ago I used the library you linked and at that time it had trouble with many SVGs I had created in Inkscape or downloaded from various places. Perhaps its support has improved since then, but I recommend testing it with the exact SVGs you plan to use before you write a lot of custom code for it.
I have made an Android IM Application, and I'm trying to add some stickers and smileys to it, but after lots of searching, seems there is no training about it and where to Start.
I imagine it's a pain or PNG that is added to the TextView right? Can someone please put me in the right way? Even if I just know What "type" are they (png, paint, canvas, etc...), I could make my own way.
Maybe make java add an image view with the image in your drawable folder. Don't know how this would work but try somthing.
I am trying to create an application which has a map image in it.
I want to add some areas (or buttons) to it so that when you click them the bubbles with information will appear.
I am new in android programming so asking to explain a bit how to implement it?
Also i need an image to be re-sizable just like a real map.
So should i attach the buttons to specific places on image and how to do so that the buttons will be connected to it when i re-size an image?
Which image type is better to use for this purpose? I heard that SVG would be better but i couldn't even add svg image to an application.
I appreciate any helpful advice.
For your problem you can use this:
http://catchthecows.com/?p=113
I need something similar, but the click on the image should change the content of that part as well.
When I find or implement the final solution I can post it here.