Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: Firing intents from a view
    primarykey
    data
    text
    <p>I have an activity with a custom view which extends <code>EditText</code> in it. Usually when someone longclicks an EditView a <code>menu pops up</code> asking the user to choose input method. </p> <p>I have <em>overridden</em> the <code>onLongClick</code> to <strong>make this menu NOT appear</strong>, since I use my own methods of input. However, i want a <code>ListActivity</code> to start when user longclicks the <code>EditText</code> (or rather again my view which extends EditText). <strong>But it seems a view cannot fire intents, only activities, am i right?</strong></p> <p>Fine, so i try to capture the longclick from the activity that spawned my EditText-like view. But inside my EditText-like view i already consume the longclick, either in the overridden <code>onLongClick()</code> by setting it true to avoid the <em>"Please choose input method"</em> menu to appear, or if returning false, then that very menu appears and consumes my longclick. In neither of the cases the intent fires...</p> <p>In short: <strong>A user longclicks an EditText, and i want a custom ListActivity to start. How do i accomplish this?</strong></p> <p><strong>EDIT:</strong> So i found <code>startActivity</code> in the <code>Context object</code>. But i will have the user pick an item from a list. That item would then appear in the <code>EditText</code>, so i thought i had to use <code>startActivityForResult</code>, which incidentally does not appear in the <code>Context object</code> :(</p> <p><strong>EDIT 2:</strong> How do i get a result back from an activity started with <code>startActivity</code>?</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