<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Форум Александра Климова — Клавиатура и аппаратные кнопки]]></title>
	<link rel="self" href="http://forum.alexanderklimov.ru/extern.php?action=feed&amp;tid=21&amp;type=atom" />
	<updated>2017-10-08T12:03:34Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.alexanderklimov.ru/viewtopic.php?id=21</id>
		<entry>
			<title type="html"><![CDATA[Re: Клавиатура и аппаратные кнопки]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=928#p928" />
			<content type="html"><![CDATA[<p>Здравствуйте!<br />Сильно не пинайте, только пробую создать программу для Андроид.<br />Прочитав данную статью пытаюсь использовать обработчик OnKeyListener элемента EditText.<br />В общем собрал конструкцию c событием ACTION_UP:</p><p>editText.setOnKeyListener(new View.OnKeyListener()<br />&nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp;public boolean onKey(View v, int keyCode, KeyEvent event)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp;if(event.getAction() == KeyEvent.ACTION_UP)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp;//какие-то действия<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return true;}<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return false;}<br />&nbsp; &nbsp; &nbsp; &nbsp; });</p><p>На эмуляторе работает как нужно, по событию действия выполняются по каждому введенному знаку с экранной клавиатуры в EditText.<br />Но когда собираю apk, устанавливаю на телефон то программа работает не правильно, при вводе в EditText ничего не происходит, как будто события нет, чтобы код выполнился необходимо нажать &quot;Далее&quot; (или &quot;Готово&quot;).</p><p>Эмулируется андроид 6.0, на телефоне тоже 6.0.</p><p>Почему может такое происходить?</p>]]></content>
			<author>
				<name><![CDATA[mkey2]]></name>
				<uri>http://forum.alexanderklimov.ru/profile.php?id=1505</uri>
			</author>
			<updated>2017-10-08T12:03:34Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=928#p928</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Клавиатура и аппаратные кнопки]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=653#p653" />
			<content type="html"><![CDATA[<p>Подскажите как обработать &quot;убирание&quot; клавиатуры кнопкой &quot;назад&quot;.</p>]]></content>
			<author>
				<name><![CDATA[manatin]]></name>
				<uri>http://forum.alexanderklimov.ru/profile.php?id=1401</uri>
			</author>
			<updated>2016-11-25T05:34:54Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=653#p653</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Клавиатура и аппаратные кнопки]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=474#p474" />
			<content type="html"><![CDATA[<p>Если не убрать блок:<br />@Override<br />public boolean onKeyDown(int keyCode, KeyEvent event) {<br />&nbsp; &nbsp; // Обработайте нажатие, верните true, если обработка выполнена<br />&nbsp; &nbsp; return false;<br />}</p><p>@Override<br />public boolean onKeyUp(int keyCode, KeyEvent event) {<br />&nbsp; &nbsp; // Обработайте отпускание клавиши, верните true, если обработка выполнена<br />&nbsp; return false;<br />}</p><p>Кнопка назад работать не будет. Глупая ошибка с моей стороны конечно, но я час не мог понять почему не работает.</p>]]></content>
			<author>
				<name><![CDATA[Ant118]]></name>
				<uri>http://forum.alexanderklimov.ru/profile.php?id=875</uri>
			</author>
			<updated>2016-03-31T18:27:02Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=474#p474</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Клавиатура и аппаратные кнопки]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=453#p453" />
			<content type="html"><![CDATA[<p>Это старый код от Эклипса, который импортировал немного по-другому.</p>]]></content>
			<author>
				<name><![CDATA[alexander.klimoff]]></name>
				<uri>http://forum.alexanderklimov.ru/profile.php?id=2</uri>
			</author>
			<updated>2016-03-20T18:57:13Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=453#p453</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Клавиатура и аппаратные кнопки]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=450#p450" />
			<content type="html"><![CDATA[<p>Поправочка к &quot;Кнопка Back: Вы уверены, что хотите выйти из программы?&quot;<br />У меня приведенный код не сработал, в том смысле, что не скомпилировался. Чтобы все заработало, пришлось вместо <br />quitDialog.setPositiveButton(&quot;Таки да!&quot;, new OnClickListener() {<br />поставить<br /> quitDialog.setPositiveButton(&quot;Таки да!&quot;, new DialogInterface.OnClickListener() {<br />И аналогично несколькими строчками ниже</p>]]></content>
			<author>
				<name><![CDATA[sxakludanto]]></name>
				<uri>http://forum.alexanderklimov.ru/profile.php?id=1174</uri>
			</author>
			<updated>2016-03-20T11:58:33Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=450#p450</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Клавиатура и аппаратные кнопки]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=331#p331" />
			<content type="html"><![CDATA[<p>Лично у меня не сработали методы описанные в статье чтобы спрятать клавиатуру. Поиск в интернете показал еще вариант, который у меня работает: в onCreate() добавляется getWindow().setSoftInputMode() :</p><p>protected void onCreate(Bundle savedInstanceState) {<br />&nbsp; &nbsp; &nbsp; &nbsp; super.onCreate(savedInstanceState);<br />&nbsp; &nbsp; &nbsp; &nbsp; setContentView(R.layout.activity_main);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);<br />}</p>]]></content>
			<author>
				<name><![CDATA[pirotehnik]]></name>
				<uri>http://forum.alexanderklimov.ru/profile.php?id=731</uri>
			</author>
			<updated>2016-01-22T20:47:56Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=331#p331</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Клавиатура и аппаратные кнопки]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=252#p252" />
			<content type="html"><![CDATA[<p>Привет. Спасибо. А есть инфа как кнопками управлять если приложение свернуто и процесс живет?</p>]]></content>
			<author>
				<name><![CDATA[ewg]]></name>
				<uri>http://forum.alexanderklimov.ru/profile.php?id=700</uri>
			</author>
			<updated>2015-12-15T22:04:41Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=252#p252</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Клавиатура и аппаратные кнопки]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=174#p174" />
			<content type="html"><![CDATA[<p>Обсуждаем статью <a href="http://developer.alexanderklimov.ru/android/keyboard.php">Клавиатура и аппаратные кнопки</a></p>]]></content>
			<author>
				<name><![CDATA[alexander.klimoff]]></name>
				<uri>http://forum.alexanderklimov.ru/profile.php?id=2</uri>
			</author>
			<updated>2015-10-19T07:27:55Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=174#p174</id>
		</entry>
</feed>
