Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can you help me implement this in my adapter ? #76

Open
TheAnimatrix opened this issue May 21, 2014 · 1 comment
Open

Can you help me implement this in my adapter ? #76

TheAnimatrix opened this issue May 21, 2014 · 1 comment

Comments

@TheAnimatrix
Copy link

my adapter is unlike the one you showed in your example , and i cant find a way to implement it = adapter code (just help me implement it with two buttons like yours)
forget the id's currently , i didnt identify the id's as you said too and help me with the xml too

public class ListViewAdapter extends BaseAdapter {

// Declare Variables
Context context;
LayoutInflater inflater;
ArrayList<HashMap<String, String>> data;

HashMap<String, String> resultp = new HashMap<String, String>();

public ListViewAdapter(Context context,
        ArrayList<HashMap<String, String>> arraylist) {
    this.context = context;
    data = arraylist;

}

@Override
public int getCount() {
    return data.size();
}

@Override
public Object getItem(int position) {
    return null;
}

@Override
public long getItemId(int position) {
    return 0;
}

public View getView(final int position, View convertView, ViewGroup parent) {
    // Declare Variables


    inflater = (LayoutInflater) context
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    View v = inflater.inflate(R.layout.custom, parent, false);
    // Get the position
    resultp = data.get(position);

    TextView t1 = (TextView) v.findViewById(R.id.title);
    TextView t2 = (TextView) v.findViewById(R.id.artist);
    TextView t3 = (TextView) v.findViewById(R.id.textView1);
    TextView t4 = (TextView) v.findViewById(R.id.duration);
    ImageView lblThumb = (ImageView) v.findViewById(R.id.thumbie);

    t1.setText(resultp.get(MainActivity.TITLE));
    t2.setText(resultp.get(MainActivity.BRAND));
    t3.setText(resultp.get(MainActivity.USE));
    t4.setText(resultp.get(MainActivity.COST) + "$");

    String a = resultp.get(MainActivity.URL);

    try {

        //UrlImageViewHelper.setUrlDrawable(lblThumb, a, R.drawable.loader);


        Picasso.with(context)
        .load(a)
        .placeholder(R.drawable.loader)
        .into(lblThumb);

    } catch (Exception e) {
        Log.d("error", "lol");
    }

    return v;
}

}

XML :-

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/list_selector"
android:padding="5sp"

android:orientation="vertical" >

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"

    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="8"
        android:orientation="horizontal" >

        <LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/image_bg"
    android:orientation="vertical" >

        <ImageView
            android:id="@+id/thumbie"
            android:layout_width="138dp"
            android:layout_height="138dp"
            android:src="@drawable/image_bg" />

        </LinearLayout>

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent" >

            <TextView
                android:id="@+id/title"
                android:textColor="#000000"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_marginLeft="10sp"
                android:layout_alignParentTop="true"
                android:text="Large Text"
                android:textAppearance="?android:attr/textAppearanceLarge" />

            <TextView
                android:id="@+id/textView1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_below="@+id/artist"
                android:layout_marginLeft="10sp"
                android:text="TextView"
                android:textAppearance="?android:attr/textAppearanceMedium" />

            <TextView
                android:textColor="#FF0000"
                android:id="@+id/duration"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:layout_alignParentRight="true"
                android:text="TextView" />

            <ImageView
                android:id="@+id/imageView1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:layout_centerVertical="true"
                android:src="@drawable/arrow" />

            <TextView
                android:id="@+id/artist"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@+id/title"
                android:layout_below="@+id/title"
                android:text="TextView"
                android:textAppearance="?android:attr/textAppearanceMedium" />

        </RelativeLayout>

    </LinearLayout>
</LinearLayout>
@deepakcipl
Copy link

ANy update on this please??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants