android : how to specify the path of image in source code - android

I want to display some text and image in webview. FOr this i am using a template html string.
Within this template i want to replace the {image} with the path for an image in drawable folder
i tried
str = str.replace("{image}","res/drawable-hdpi/about.png" )
but the image is not coming.
Is this the right way to give path.
Or what is the right solution
Thanks a lot for your time and help

Related

Add image name(text) on image which i am getting from camera or gallery?

I want to add image name (text) on image which I am getting from camera or gallery?, I have tried some solution like by Canvas or Using XML file, but I want more feasible solution
Here is the one of best watermark library which help you do your task
https://github.com/huangyz0918/AndroidWM
They also provide different mechanisam to add watermark on your image.
Simply take relative layout in XML and add Textview and ImageView .
Now get the Image name from below code
you can use the substring method to get the name of the file from the path string.
String path=":/storage/sdcard0/DCIM/Camera/1414240995236.jpg";
// it contains your image path...I'm using a temp string...
String filename=path.substring(path.lastIndexOf("/")+1);

Thumbnail in Text Files with WebView

I have a files's list in my Android app and I want put them a preview image, an icon (thumbnail).
I have got this purpose for image and video files, but not for text files.
In this last case, I know there is a Google Docs function that it creates an image from a text file that it can be used like thumbnail:
http://docs.google.com/viewer?url=MY_LINK&a=bi&pagenumber=1&w=300
Here, you can put the text file url, the number page and the width for thumbnail.
This method works well, but I don't know like obtaining the image created with this url, for saving in a Bitmap and put it in the icon ImageView.
Thanks for your attention.

How to set imageview.toImage() as html image src in webview?

any idea to set imageview.toImage() as img src in html of a webview.
let suppose I have an imageview (having some image in it).okay imageview.toimage() is treated as an image object in titanium. now what i need is i want to set
webview.html='<html><img src="here i want to put obove imageview.toimage()"></html>';
I tried many way anyone have experience of it please guide me.
regards:ali
save it to a file and assigne the file's url path OR base64Encode the image and provide that as the value for the src parameter
you might try to convert the image into a base64 blob text and use it as css background image data :
background-image:url('data:image/png;base64,'+Ti.Utils.base64encode(imageview.toImage()).getText()+'\');

How to drag an image in html file displayed using webview in android?

I have an Android WebView loaded with a html file(actually stored in some folder under sdcard) that is having one/two/three image(s). Is it possible to drag-drop any one of those images?
If its possible, below are my doubts
When i drag an image from (x1,y1) place and drop it in another (x2,y2)place, How can i change the original source file code as the image place is changed ?
When i open the same html file in next time (using default html viewer or my app), i should see the image in (x2, y2) place. Isn't it possible ?
I tried this drag ImageView inside a WebView. But it is just adding an imageview to webview. (So, when i run the same app next time, i don't see the image in the place where i dropped it in first run.) But i need to drag an image presented in source html file. So After every drag-drop, Do i need to render the webview content and create a new html file to see the image in dropped location?
Is it possible to read the android-webview content? (like we read the web page content in java).
Can anyone clear my doubts and suggest me a better way if iam going/thinking wrong?
I don't think it possible (without using some not trivial tricks) to implement the drag and drop as you wish. for the other point's you raised - if the file is on your sd - why not just parse the html file and get the pictures positions and source link and use it to implement the drag and drop on your own? after all- the html file is an xml file which contains attributes which defines positions/links/images/text

android background image problem

I am trying to set an image as background. I edit the xml layout file. But when i put the image on the drawable folder, it gives an error on the project name. What is the problem? Is it related to size of image? How much is the biggest size for image that android can run?
Probably your image name is incorrect , resource items cant have numbers , special characters ( _ is fine ) & upper case characters.
Image Size never give Errors, Format of the size will give the error.. Check the valid format..
If you upload the bigsize image , it display only small portion from Display.getWidth to Display.GetHeight position.

Categories

Resources