开发者

reduce the size of the image programmatically image from gridview [closed]

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 curre开发者_运维技巧nt form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜