What is clip_model?
On Tue, Mar 1, 2011 at 12:32 AM, monty <[email protected]> wrote:
> Hi,
> Following is part of code from the Activity.Hope the code will be
> clear enough for you to understand.Please let me know how to resolve
> this issue.It would be really helpful.
>
> setContentView(R.layout.chapter_clips);
>
> //will have Gallery,WebView and TextView.The WebView and TextView
> data has to be changed when i scroll the Gallery,so i call the Webview
> and TextView in the getView() of the adapter.
>
>
> Gallery g = (Gallery) findViewById(R.id.gallery);
> g.setAdapter(new ImageAdapter(this));//calling the Adapter
> class
> g.setAnimationDuration(3000);
> g.setOnItemSelectedListener(this);
>
> public class ImageAdapter extends BaseAdapter {
> int mGalleryItemBackground;
>
> public ImageAdapter(Context c) {
> mContext = c;
>
> }
>
> public int getCount() {
>
> return mchaptermodel.clip_model.size();
> }
>
> public Object getItem(int position) {
> return position;
> }
>
> public long getItemId(int position) {
> return position;
> }
>
> public View getView(int position, View convertView,
> ViewGroup
> parent) {
>
> LayoutInflater
>
> lInflater=(LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
> convertView = lInflater.inflate(R.layout.item, null,
> false); //this "item" xml contains imageview to be displayed on
> Gallery
>
>
> clipimagename=mchaptermodel.clip_model.get(position).getClipimage(); /
> *Getting all data from parsed xml */
>
> cliptitle=mchaptermodel.clip_model.get(position).getClipTitle();//for
> textview
>
> cliptext=mchaptermodel.clip_model.get(position).getClipText();//for
> webview
>
>
> try {
>
> clipimagename=clipimagename.replaceAll(".png","");
> galleryimage=
> getResources().getIdentifier(clipimagename,"drawable",package_name);
>
> } catch (Exception e) {
> Log.i("Drawing Image...","" );
> }
>
> ImageView i=
> (ImageView)convertView.findViewById(R.id.imageview);
>
> i.setImageResource(galleryimage) ; //
> setting the image on Gallery
> i.setAdjustViewBounds(true);
> i.setScaleType(ScaleType.FIT_CENTER);
>
> /*The TextView and Webview defined below has to be changed when the
> Gallery is scrolled which is working fine but as i said i want the
> image in Gallery which comes in center its data should be displayed on
> TextView and Webview and not the corner item visible*/
>
> TextView tv1=(TextView)findViewById(R.id.title);
> tv1.setTextSize(16);
> tv1.setText(cliptitle);
> tv1.setTextColor(Color.BLACK);
>
> WebView chap_description = (WebView)
> findViewById(R.id.webview);
> chap_description.loadDataWithBaseURL("file:///
> android_asset/demonew.html",String.format(htmlContent,cliptext),"text/
> html", "utf8", "");
>
> return convertView;
> }
> }
>
> On Feb 28, 10:09 pm, Justin Anderson <[email protected]> wrote:
> > Well... what does your code look like?
> >
> > On Sun, Feb 27, 2011 at 10:32 PM, monty <[email protected]> wrote:
> > > Hi
> > > I am developing an application where i need to achieive coverflow
> > > animation using android Gallery.When i scroll the Gallery i need to
> > > display the data of the middle item in the Gallery in a TextView.
> > > But instead when i scroll and stop the Gallery ,the TextView prints
> > > the last item of Gallery visible on the device .and not the middle
> > > one.
> > > How do i acheive this?Do i need to write some logic or will it work
> > > with some APIs?i hope i am clear with the query.Could any1 giv a
> > > solution?
> >
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to
> [email protected]
> > > To unsubscribe from this group, send email to
> > > [email protected]
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en