Note that there are some explanatory texts on larger screens.

plurals
  1. POText on image at the point of touch
    primarykey
    data
    text
    <p>I need to apply some text on the X,Y coordinates of the image where a touch event is occurred. Its just like the Image Tagging on facebook. So every time a touch is occurred, user can put some text in txtview at the touch point.</p> <p>What I've done so far is that I am loading image from gallery and showing it on image viewer.</p> <pre><code>public class LoadImg extends Activity { private static int RESULT_LOAD_IMAGE = 1; int x,y; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); x=0;y=0; String picturePath = PreferenceManager.getDefaultSharedPreferences(this).getString("picturePath", ""); if(!picturePath.equals("")) { ImageView imageView = (ImageView) findViewById(R.id.imageView1); imageView.setImageBitmap(BitmapFactory.decodeFile(picturePath)); } Button buttonLoadImage = (Button) findViewById(R.id.button1); buttonLoadImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { Intent i = new Intent( Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(i, RESULT_LOAD_IMAGE); } }); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == RESULT_LOAD_IMAGE &amp;&amp; resultCode == RESULT_OK &amp;&amp; null != data) { Uri selectedImage = data.getData(); String[] filePathColumn = { MediaStore.Images.Media.DATA }; Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); String picturePath = cursor.getString(columnIndex); PreferenceManager.getDefaultSharedPreferences(this).edit().putString("picturePath", picturePath).commit(); cursor.close(); ImageView imageView = (ImageView) findViewById(R.id.imageView1); imageView.setImageBitmap(BitmapFactory.decodeFile(picturePath)); } } </code></pre> <p>Also implementing OnTouchListener, I am trying this code but not working. Any help .</p> <pre><code>public boolean onTouch(View v, MotionEvent event) { // TODO Auto-generated method stub x=(int) event.getX(); y=(int) event.getY(); imageshow(); return true; } private void imageshow() { // TODO Auto-generated method stub if(x!=0 &amp;&amp; y!=0) { TextView tv=new TextView(this); LinearLayout.LayoutParams trparams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); tv.setLayoutParams(trparams); tv.layout(x, y, 0, 0); } } </code></pre> <p>Something like <a href="http://www.thinglink.com/scene/465473253519917057" rel="nofollow">this</a></p>
    singulars
    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