I am using a custom Listview containing Images and Buttons.
my listview.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/layout">
<ListView android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="0dp"
/>
</LinearLayout>
I am dealing with 3 LinearLayouts here.
my button_view.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"
android:id="@+id/parent"
>
<LinearLayout
android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/child1"
<ImageView
android:id="@+id/image"
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/image"
/>
<TextView
android:id="@+id/listarray"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:id="@+id/child2">
<ImageButton
android:id="@+id/one"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/one"
/>
<ImageButton
android:id="@+id/two"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/two"
/>
<ImageButton
android:id="@+id/three"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
adapter code
tweetArray containing my list.
ArrayAdapter<String> arrayAdapter =new ArrayAdapter<String>(this,R.layout.button_view, R.id.listarray, tweetArray);
ListView listView = (ListView) findViewById(android.R.id.list);
listView.setAdapter(arrayAdapter);
Issue : My problem is that how can i get id of ImageView
.
Tried : I have tried to get in simple way as
ImageView user_picture = (ImageView) findViewById(R.id.image);
Picasso.with(getApplicationContext()).load("http://www.w3schools.com/css/trolltunga.jpg).into(user_picture);
But this is showing error : Target must not be null.
Do you have any Idea...?