Click here to Skip to main content
15,899,937 members
Home / Discussions / Android
   

Android

 
QuestionRe: get image from server Pin
David Crow1-Aug-14 4:18
David Crow1-Aug-14 4:18 
QuestionHelp Android GridView Pin
ozanadiaa21-Jul-14 2:24
ozanadiaa21-Jul-14 2:24 
AnswerRe: Help Android GridView Pin
Kornfeld Eliyahu Peter21-Jul-14 2:53
professionalKornfeld Eliyahu Peter21-Jul-14 2:53 
AdminAndroid Tutorial Contest - $10K in Prizes (runs through to October 2014) Pin
Kevin Priddle16-Jul-14 10:49
professionalKevin Priddle16-Jul-14 10:49 
Questionandroid Pin
rish@879515-Jul-14 0:09
rish@879515-Jul-14 0:09 
AnswerRe: android Pin
Richard MacCutchan15-Jul-14 3:45
mveRichard MacCutchan15-Jul-14 3:45 
AnswerRe: android Pin
Anuj Mody16-Jul-14 20:17
Anuj Mody16-Jul-14 20:17 
QuestionAdapter selecting issue Pin
Arvind644611-Jul-14 1:21
Arvind644611-Jul-14 1:21 
C#
i<code>have a ListView which extends BaseAdapter. I have a array list. The ListView inflates and populates correctly. I am using the flipper view to change the layout to another but the problem is when i clicked on the first item it rotate but the item at third or sixth row will also rotate list view how can i fix it i only want the image is change of selected item</code> 

ArrayList<product_data> al=new ArrayList<product_data>();
class product_data
{
    String post_title;
    String newprice;
    String oldprice;
    String image;
    String id;
    product_data(String post_title,String newprice,String oldprice,String image,String id)
    {
        this.post_title=post_title;
        this.newprice=newprice;
        this.oldprice=oldprice;
        this.image=image;
        this.id=id;

    }
to add data in arraylist

try {
                JSONObject parentObject = new JSONObject(json.toString());
                JSONObject userDetails = parentObject.getJSONObject("response"); 
                JSONArray jarray=userDetails.getJSONArray("products_data");
                   for(int i=0;i<jarray.length();i++)
                   {
                       System.out.println("From the Dataaaa");
                       JSONObject c = jarray.getJSONObject(i);
                       String details=c.getString("details");
                       String image=c.getString("image");
                       String catagory=c.getString("catagory");
                       String new_price=c.getString("new_price");
                       String title=c.getString("title");
                       String id1=c.getString("id");
                       System.out.println("from ther first image"+image);
                       System.out.println("from the sdafdfadf"+details);

                       al.add(new product_data(title, new_price, new_price, image,


Adapter class

class MyAdapter extends BaseAdapter
{

    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return al.size();
    }

    @Override
    public Object getItem(int position) {
        // TODO Auto-generated method stub
        return al.get(position);
    }

    @Override
    public long getItemId(int position) {
        // TODO Auto-generated method stub
        return position;
    }

    @Override
    public View getView(int position, View singleView, ViewGroup parent) {
        // TODO Auto-generated method stub
        final int ok=position;

        if(singleView==null)
        {
            LayoutInflater inflater = LayoutInflater.from(parent.getContext());
            singleView = inflater.inflate(R.layout.product_ist_layout,parent,false);
            System.out.println("from the if"+position);
            viewAnimator = (ViewAnimator)singleView.findViewById(R.id.viewFlipper);
             rootLayout = (View)singleView.findViewById(R.id.main_activity_root);
             cardFace = (View)singleView.findViewById(R.id.main_activity_card_face);
             cardBack = (View) singleView.findViewById(R.id.main_activity_card_back);
        }

            System.out.println("from the else");


        System.out.println("Position in else"+position);
        product_data a=al.get(position);
        TextView tv1=(TextView)singleView.findViewById(R.id.textView2);
        TextView tv2=(TextView)singleView.findViewById(R.id.textView3);
        TextView tv3=(TextView)singleView.findViewById(R.id.textView1);

            /**
             * Bind a click listener to initiate the flip transitions
             */
            viewAnimator.setOnClickListener(new OnClickListener() { 
                @Override
                public void onClick(View v) { 
                    // This is all you need to do to 3D flip

                    AnimationFactory.flipTransition(viewAnimator, FlipDirection.LEFT_RIGHT);
                }

            });



            cardFace.setOnClickListener(new OnClickListener() {

                @Override
                public void onClick(View v) {
                    // TODO Auto-generated method stub
                    System.out.println("positon"+ok);
                    AnimationFactory.flipTransition(viewAnimator, FlipDirection.LEFT_RIGHT);

                }
            });


         cardBack.setOnClickListener(new OnClickListener() {

                @Override
                public void onClick(View arg0) {
                    // TODO Auto-generated method stub
                    AnimationFactory.flipTransition(viewAnimator, FlipDirection.LEFT_RIGHT);
                }
            });

        imgview1=(ImageView)singleView.findViewById(R.id.imageView4);
         imgview1.setTag(position);
        imgview1.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                int position1=(Integer)v.getTag();
                  System.out.println(position1);
                  String id=al.get(position1).id;
                  System.out.println("id from the list"+id);
                Intent in=new Intent(product_list_Activity.this,rating_dialog.class);
                in.putExtra("id",id);
                startActivity(in);

            }
        });
    ImageView   imgview2=(ImageView)singleView.findViewById(R.id.imageView5);
         imgview2.setTag(position);
        imgview2.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                int position1=(Integer)v.getTag();
                  System.out.println(position1);
                  String id=al.get(position1).id;
                  System.out.println("id from the list"+id);
                Intent in=new Intent(product_list_Activity.this,product_review.class);
                in.putExtra("id",id);
                startActivity(in);

            }
        });

        tv3.setTag(position);
        tv3.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub

                int position1=(Integer)v.getTag();
                System.out.println("from the review "+position1);
                String id=al.get(position1).id;
                globalvariables.product_id=id;
                Intent in=new Intent(getApplicationContext(),review_product_tabbar.class);
                startActivity(in);

            }
        });
        tv1.setText(a.post_title);
        tv2.setText("$"+a.oldprice);
        tv1.setTypeface(tf);
        tv2.setTypeface(tf);
        tv3.setTypeface(tf);
        int loader = R.drawable.ic_launcher;
        ImageView image = (ImageView)singleView. findViewById(R.id.imageView1);

        imgLoader.DisplayImage(a.image, loader, image);
        Animation anim = new Rotate3dAnimation(90.0f, 0.0f, 100.0f, false, singleView);
        anim.setDuration(1000l);
        singleView.startAnimation(anim);


        return singleView;
    }
}
}

QuestionCollaborative downloading application Pin
Member 109362359-Jul-14 16:24
Member 109362359-Jul-14 16:24 
AnswerRe: Collaborative downloading application Pin
Richard MacCutchan9-Jul-14 23:48
mveRichard MacCutchan9-Jul-14 23:48 
QuestionWeb service Android connection Pin
ozanadiaa8-Jul-14 21:16
ozanadiaa8-Jul-14 21:16 
QuestionHow do I detect Rouge AP with Android Phone? Pin
김철섭7-Jul-14 15:25
김철섭7-Jul-14 15:25 
Questionlock android apps with my lock screen Pin
Member 99656145-Jul-14 21:47
Member 99656145-Jul-14 21:47 
AnswerRe: lock android apps with my lock screen Pin
borad pankit17-Jul-14 21:13
borad pankit17-Jul-14 21:13 
Questionuse web service android HELP Pin
ozanadiaa4-Jul-14 3:59
ozanadiaa4-Jul-14 3:59 
AnswerRe: use web service android HELP Pin
Richard MacCutchan4-Jul-14 5:58
mveRichard MacCutchan4-Jul-14 5:58 
GeneralHow can i show the button at the last item of the horizontal listview Pin
Arvind64461-Jul-14 5:19
Arvind64461-Jul-14 5:19 
QuestionRe: How can i show the button at the last item of the horizontal listview Pin
David Crow9-Jul-14 10:14
David Crow9-Jul-14 10:14 
QuestionAugmented reality Android app Pin
Med Abdrabah28-Jun-14 2:25
Med Abdrabah28-Jun-14 2:25 
AnswerRe: Augmented reality Android app Pin
JAGDEEP SINGH7-Jul-14 23:05
JAGDEEP SINGH7-Jul-14 23:05 
QuestionMatching two audio files in android Pin
Najia.greenfin24-Jun-14 19:32
Najia.greenfin24-Jun-14 19:32 
AnswerRe: Matching two audio files in android Pin
DaveyM6925-Jun-14 5:21
professionalDaveyM6925-Jun-14 5:21 
QuestionReject call code Pin
Anthony Joseph H17-Jun-14 3:43
Anthony Joseph H17-Jun-14 3:43 
AnswerRe: Reject call code Pin
David Crow9-Jul-14 10:19
David Crow9-Jul-14 10:19 
QuestionAndroid Development Pin
Dini Ngewu17-Jun-14 0:54
Dini Ngewu17-Jun-14 0:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.