Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to assign a string value associated with an image to a textwidget when image is clicked
    primarykey
    data
    text
    <pre><code> package com.me.trial; import android.app.Activity; import android.os.Bundle; import android.view.View.OnClickListener; import android.widget.ImageView; public class TrialActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ImageView img = (ImageView)findViewById(R.id.imageView1); img.setClickable(true); OnClickListener l; } private void hasBeenClicked(&lt;method invoked when the user has clicked&gt;){ } } &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" &gt; &lt;LinearLayout android:id="@+id/linearLayout1" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" &gt; &lt;RelativeLayout android:id="@+id/relativeLayout1" android:layout_width="match_parent" android:layout_height="wrap_content" &gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginLeft="56dp" android:text="Large Text" android:textAppearance="?android:attr/textAppearanceLarge" /&gt; &lt;EditText android:id="@+id/editText1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/textView1" android:layout_alignRight="@+id/textView1" android:layout_below="@+id/textView1" android:layout_marginTop="64dp" &gt; &lt;requestFocus /&gt; &lt;/EditText&gt; &lt;ImageView android:id="@+id/imageView1" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:scaleType="fitEnd" android:tag="Employee name" android:src="@drawable/img18" /&gt; &lt;/RelativeLayout&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; </code></pre> <p>I need the application to pass some string value associated to it to be passed into the text as soon as the user clicks on the image.How do i use the click Listeners in android to achieve the following task. It is not necessary to fill in the code snippet that i have given.Any new ideas regarding the design are most welcome.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload