Académique Documents
Professionnel Documents
Culture Documents
//list_Data.xml
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name:"
android:textColor="#111" />
<ImageView
android:id="@+id/imageView"
android:layout_width="120dp"
android:layout_height="90dp"
android:padding="4dp" />
//item_data
this.description = description;
this.sell_price = sell_price;
this.image_url = image_url;
public String getImage() {
return image_url;
//listActivity
JSONArray array=response.getJSONArray("data");
JSONObject ob=array.getJSONObject(i);
item_data listData=new
item_data(ob.getString("description")
,ob.getString("sell_price"),ob.getString("img_path"));
//activity_detail_view.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".DetailView">
<LinearLayout
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:id="@+id/full_image"
android:layout_width="300dp"
android:layout_height="300dp" />
<TextView
android:id="@+id/name_txt"
android:layout_gravity="center"
android:textSize="35dp"
android:textColor="#000"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</RelativeLayout>
//myadapter
private List<item_data>list_data;
if (listData.getImage().isEmpty()) {
holder.imageView.setImageResource(R.drawable.ic_launcher_background);
} else{
Picasso.get()
.load(urlString + listData.getImage())
.into(holder.imageView);
holder.txtdescription.setText(listData.getDescription());
holder.txtsell_price.setText(listData.getSell_price());
holder.txtdescription.setOnClickListener(new View.OnClickListener() {
@Override
intent.putExtra("name",listData.getDescription());
intent.putExtra("imageurl",urlString + listData.getImage());
mContext.startActivity(intent);
});
ImageView imageView;
super(itemView);
txtdescription=(TextView)itemView.findViewById(R.id.txt_description);
txtsell_price=(TextView)itemView.findViewById(R.id.txt_sell_price);
imageView = (ImageView)itemView.findViewById(R.id.imageView);
//detailView
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail_view);
nametxt=(TextView)findViewById(R.id.name_txt);
fullimg=(ImageView)findViewById(R.id.full_image);
Intent i=getIntent();
String name=i.getStringExtra("name");
String imageurl=i.getStringExtra("imageurl");
nametxt.setText(name);
Picasso.get()
.load(imageurl)
.into(fullimg);
Log.i("url","test"+imageurl);