Re: [android-beginners] Re: Loading images in android

2010-07-28 Thread Kostya Vasilyev
The code below replaces the activity's content view (the root of view hierarchy) with a new LinearLayout. If you want to keep your existing layout around, do this: 1 - declare a LinearLayout placeholder in your layout xml file, give it an ID. 2 - instead of creating a new LinearLayout, get

Re: [android-beginners] Re: Loading images in android

2010-07-28 Thread Justin Anderson
And I would probably do a little reading to better understand the Android platform... http://developer.android.com/guide/index.html http://developer.android.com/resources/faq/commontasks.html http://developer.android.com/resources/faq/framework.html Read everything above... it will help you solve

[android-beginners] Re: Loading images in android

2010-07-27 Thread ethan
Justin Thanks for the reply. What i am trying to do is following: Based on code logic, i am trying to print on the screen There are 4 flowers. However instead of using the word flowers, i want to put icon of flowers in its place. The icon is stored as a jpeg in my res/drawable folder. The number

Re: [android-beginners] Re: Loading images in android

2010-07-27 Thread Justin Anderson
Unless I am misunderstanding, you would only need one ImageView... You said you want to replace the word flowers with an image, right? Not the number 4? If that is really what you would want to do then you would only need one ImageView...

[android-beginners] Re: Loading images in android

2010-07-27 Thread ethan
You are correct. Instead of displaying the number 4, or 3 or 2 or 1, i want to display 4 flowers, or 3 flowers, or 2 flowers... so you are saying that i can achieve that with one imageview ? On Jul 27, 9:18 am, Justin Anderson janderson@gmail.com wrote: Unless I am misunderstanding, you

Re: [android-beginners] Re: Loading images in android

2010-07-27 Thread Justin Anderson
No... displaying the number of flowers is NOT the same as replacing the word flower with an image, which is what you originally described. To display 4 flower images you would need 4 ImageViews. To display 3 flower images you would need 3 ImageViews.

[android-beginners] Re: Loading images in android

2010-07-27 Thread ethan
Ok. So in this case, is there a way to dynamically create imageviews from the code (not xml) based on number of images to display ? Or should i just statically create 4 imageviews and only populate them based on the number of flowers i want to display ? On Jul 27, 10:52 am, Justin Anderson

Re: [android-beginners] Re: Loading images in android

2010-07-27 Thread Kostya Vasilyev
You could use one image view and several different images with varying number of flowers. Or create the required number of image views from code, all using the same image. Or declare four image views in your layout and manage their visibility from code. -- Kostya Vasilyev --

[android-beginners] Re: Loading images in android

2010-07-27 Thread ethan
This is the code that i used : LinearLayout mLinearLayout; mLinearLayout = new LinearLayout(this); ImageView i = new ImageView(this); i.setImageResource(R.drawable.cow_icon); i.setAdjustViewBounds(true); // set the ImageView bounds to match the Drawable's dimensions