reduce the size of the image programmatically image from gridview [closed]
How ca we compare data from web service with data in local folder and replace the data coming from web service with our data in local folder.
Also tell me how to programatically reduce the size of the image that is displayed from gridview into Edit Text.
Size of image can be set in grid view. Is it possible to set the size of image displayed in Edit Text that is received from grid view selected image.
Please guide me in this issue. Any sample working example shall be very useful for me to understand and work accordingly.
For the second question : I think you can use Bitmap.createScaledBitmap where we can re-size the Bitmap image.
Can you elaborate the first question.. what kind of data are you comparing..??
Paresh is right. You should put these are 2 different questions.However for first question you can go ahead like this:
String link = "YOUR URL";(WEBSERVICE)
URL text= new URL(link);
InputStream isText = text.openStream();
byte[] bytes=new byte[isText.available()];
isText.read(bytes);
String s = new String(bytes);
System.out.println(s);
//CHECK WHAT IS THE VALUE RETURNED BY YOUR WEBSERVICE...IF IT IS A STRING AS IN THIS EXAMPLE "AVAILABLE" THEN PUT THAT CONDITION FOR COMPARING
if(s.equals("unavailable"))// THIS MAY VARY
{
//put the path of your local folder to access it
//YOUR COMPARE CONDITION
}
else
{
// else condition
}
2) For second question, If you are using Imageview, you can change the content in the XML file as
android:layout_height="XXdip" android:layout_width = "XXdip" android:layout_marginLeft="XXdip" android:layout_marginRight = "xxdip"
I personally do not prefer hardcoding using px(pixels), If you can post your code, we can help you better.
精彩评论