List of usage examples for android.widget TextView setOnCreateContextMenuListener
public void setOnCreateContextMenuListener(OnCreateContextMenuListener l)
From source file:com.abid_mujtaba.fetchheaders.AccountsActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.accounts);//from w w w. jav a2 s.c o m ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); LinearLayout accountList = (LinearLayout) findViewById(R.id.account_list); LayoutInflater li = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); for (int ii = 0; ii < Account.numberOfAccounts(); ii++) { TextView tv = (TextView) li.inflate(R.layout.account_setting_name, null); tv.setText(Account.get(ii).name()); tv.setId(ii); // Store the account_id as the view id tv.setOnCreateContextMenuListener(onCreateContextMenuListener); tv.setOnTouchListener(onTouchListener); tv.setOnClickListener(listener); accountList.addView(tv); } }