<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Форум Александра Климова — Hello Kitty - Создаем первое приложение для Android]]></title>
	<link rel="self" href="http://forum.alexanderklimov.ru/extern.php?action=feed&amp;tid=5&amp;type=atom" />
	<updated>2021-04-21T12:07:44Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.alexanderklimov.ru/viewtopic.php?id=5</id>
		<entry>
			<title type="html"><![CDATA[Re: Hello Kitty - Создаем первое приложение для Android]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=1189#p1189" />
			<content type="html"><![CDATA[<p>К новому слову apply нужно привыкнуть. Поэтому не все его используют</p>]]></content>
			<author>
				<name><![CDATA[alexander.klimoff]]></name>
				<uri>http://forum.alexanderklimov.ru/profile.php?id=2</uri>
			</author>
			<updated>2021-04-21T12:07:44Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=1189#p1189</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Hello Kitty - Создаем первое приложение для Android]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=1188#p1188" />
			<content type="html"><![CDATA[<p>Ни у кого не вижу чтоб юзали apply {}, ведь так в коде гараздо меньше повторений</p><p>package com.alexeyyuditsky.helloworld</p><p>import androidx.appcompat.app.AppCompatActivity<br />import android.os.Bundle<br />import com.alexeyyuditsky.helloworld.databinding.ActivityMainBinding</p><p>class MainActivity : AppCompatActivity() {</p><p>&nbsp; &nbsp; private lateinit var binding: ActivityMainBinding</p><p>&nbsp; &nbsp; override fun onCreate(savedInstanceState: Bundle?) {<br />&nbsp; &nbsp; &nbsp; &nbsp; super.onCreate(savedInstanceState)<br />&nbsp; &nbsp; &nbsp; &nbsp; binding = ActivityMainBinding.inflate(layoutInflater)<br />&nbsp; &nbsp; &nbsp; &nbsp; setContentView(binding.root)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; binding.apply {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; imageButton.setOnClickListener {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (editText.text.isEmpty()) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textView.text = &quot;Hello Kitty&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } else {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textView.text = &quot;Привет ${editText.text}&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; }<br />}</p>]]></content>
			<author>
				<name><![CDATA[AlexeyYuditsky]]></name>
				<uri>http://forum.alexanderklimov.ru/profile.php?id=2174</uri>
			</author>
			<updated>2021-04-21T05:37:53Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=1188#p1188</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Hello Kitty - Создаем первое приложение для Android]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=1187#p1187" />
			<content type="html"><![CDATA[<p>package ru.alexanderklimov.hellokot</p><p>import android.os.Bundle<br />import androidx.appcompat.app.AppCompatActivity<br />import ru.alexanderklimov.hellokot.databinding.ActivityMainBinding</p><br /><p>class MainActivity : AppCompatActivity() {<br />&nbsp; &nbsp; private lateinit var binding: ActivityMainBinding</p><p>&nbsp; &nbsp; override fun onCreate(savedInstanceState: Bundle?) {<br />&nbsp; &nbsp; &nbsp; &nbsp; super.onCreate(savedInstanceState)<br />&nbsp; &nbsp; &nbsp; &nbsp; binding = ActivityMainBinding.inflate(layoutInflater)<br />&nbsp; &nbsp; &nbsp; &nbsp; val view = binding.root<br />&nbsp; &nbsp; &nbsp; &nbsp; setContentView(view)</p><p>&nbsp; &nbsp; &nbsp; &nbsp; binding.imageButton.setOnClickListener{<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (binding.editText.text.isEmpty()) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; binding.textView.setText(&quot;Hello Kitty&quot;)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } else {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; binding.textView.setText(&quot;Привет, &quot; + binding.editText.text)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; }<br />}</p>]]></content>
			<author>
				<name><![CDATA[starletovod]]></name>
				<uri>http://forum.alexanderklimov.ru/profile.php?id=2080</uri>
			</author>
			<updated>2020-11-17T12:26:44Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=1187#p1187</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Hello Kitty - Создаем первое приложение для Android]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=1186#p1186" />
			<content type="html"><![CDATA[<p>Насколько я понял, в новой версии студии 4.1 этот способ признали устаревшим. Поэтому вам надо не добавлять эту строчку, а писать код по другому. К сожалению, я не могу угнаться за всеми изменениями и вносить исправления в статьи.</p>]]></content>
			<author>
				<name><![CDATA[alexander.klimoff]]></name>
				<uri>http://forum.alexanderklimov.ru/profile.php?id=2</uri>
			</author>
			<updated>2020-11-16T06:10:21Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=1186#p1186</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Hello Kitty - Создаем первое приложение для Android]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=1185#p1185" />
			<content type="html"><![CDATA[<p>У меня Android Studio выдавал <span style="color: #FF0000">Unresolved reference: button</span> <br />button - это id моей кнопки</p><p>В статье прочитал:</p><div class="quotebox"><blockquote><p>Давайте разбираться. В build.gradle есть строчка <strong>apply plugin: &#039;kotlin-android-extensions&#039;</strong>, позволяющая автоматически получать доступ к компоненту через его идентификатор в ресурсах.</p></blockquote></div><br /><p>Я нашел это место, у меня было вот так:</p><div class="quotebox"><blockquote><p>plugins {<br />&nbsp; &nbsp; id &#039;com.android.application&#039;<br />&nbsp; &nbsp; id &#039;kotlin-android&#039;<br />}</p></blockquote></div><p>Т.е. без нужной строчки, я добавил ее:</p><div class="quotebox"><blockquote><p>plugins {<br />&nbsp; &nbsp; id &#039;com.android.application&#039;<br />&nbsp; &nbsp; id &#039;kotlin-android&#039;<br />&nbsp; &nbsp; id &#039;kotlin-android-extensions&#039;<br />}</p></blockquote></div><p>Потом сделал &quot;Sync now&quot; - и все заработало)</p>]]></content>
			<author>
				<name><![CDATA[bibip]]></name>
				<uri>http://forum.alexanderklimov.ru/profile.php?id=2079</uri>
			</author>
			<updated>2020-11-15T17:11:07Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=1185#p1185</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Hello Kitty - Создаем первое приложение для Android]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=1169#p1169" />
			<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>2019-12-16T06:04:17Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=1169#p1169</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Hello Kitty - Создаем первое приложение для Android]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=1168#p1168" />
			<content type="html"><![CDATA[<p>Добрый вечер! <br />Александр, спасибо за урок, все получилось, кроме одной вещи. Выводится картинка, а вместе с ней текст &quot;TextView&quot;, при нажатии на котенка текст меняется на &quot;Hello kitty!&quot;. Подскажите, пожалуйста, как сделать так, чтобы выводилась только картинка, а уже при нажатии на нее появлялся текст?</p>]]></content>
			<author>
				<name><![CDATA[levebrains]]></name>
				<uri>http://forum.alexanderklimov.ru/profile.php?id=2001</uri>
			</author>
			<updated>2019-12-15T14:11:21Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=1168#p1168</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Hello Kitty - Создаем первое приложение для Android]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=1135#p1135" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>alexander.klimoff wrote:</cite><blockquote><p>...Вы видимо запускали телефон или эмулятор с ранней версией.</p></blockquote></div><p>У меня аппарат zero f highscreen 4&#039;&#039; Android 4.2. Виртуальный avd предварительно я настроил также. В общем, продолжаем изучать! <img src="http://forum.alexanderklimov.ru/img/smilies/smile.png" width="15" height="15" alt="smile" /> Спасибо.</p>]]></content>
			<author>
				<name><![CDATA[MonoLife]]></name>
				<uri>http://forum.alexanderklimov.ru/profile.php?id=1786</uri>
			</author>
			<updated>2018-11-19T11:47:41Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=1135#p1135</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Hello Kitty - Создаем первое приложение для Android]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=1134#p1134" />
			<content type="html"><![CDATA[<p>По следам ваших сообщений. В важных свойствах scrCompat есть. v24 - картинка будет отображаться в устройствах с API 24 и выше. Вы видимо запускали телефон или эмулятор с ранней версией.</p>]]></content>
			<author>
				<name><![CDATA[alexander.klimoff]]></name>
				<uri>http://forum.alexanderklimov.ru/profile.php?id=2</uri>
			</author>
			<updated>2018-11-19T11:10:42Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=1134#p1134</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Hello Kitty - Создаем первое приложение для Android]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=1133#p1133" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>alexander.klimoff wrote:</cite><blockquote><p>Выделяем элемент ImageButton на форме и в панели свойств откроем только важные свойства, выбираем свойство srcCompat...</p></blockquote></div><p>Хм.. в важных свойствах srcCompat не нашел. Возможно в посследней версии АС его убрали.. В &quot;подробных&quot; - srcCompat есть. При вводе в это поле атрибутов картинки создается строка tools:srcCompat=...<br />В главных свойствах есть 2 строки с src (одна под другой). При заполнении их или одной из них аргументами с картинкой, приложение не запускается <img src="http://forum.alexanderklimov.ru/img/smilies/sad.png" width="15" height="15" alt="sad" /> Ошибок в логе при этом не наблюдаю.<br />---<br />Это какой-то глюк IDE. Удалил заново создал кнопку. Появились поля srcCompat. Тем не менее, приложение не запускается<br /></p><div class="codebox"><pre><code>&lt;ImageButton
        android:id=&quot;@+id/imageButton&quot;
        android:layout_width=&quot;wrap_content&quot;
        android:layout_height=&quot;wrap_content&quot;
        android:layout_marginStart=&quot;8dp&quot;
        android:layout_marginTop=&quot;8dp&quot;
        android:layout_marginEnd=&quot;8dp&quot;
        android:layout_marginBottom=&quot;8dp&quot;
        app:layout_constraintBottom_toBottomOf=&quot;parent&quot;
        app:layout_constraintEnd_toEndOf=&quot;parent&quot;
        app:layout_constraintStart_toStartOf=&quot;parent&quot;
        app:layout_constraintTop_toTopOf=&quot;parent&quot;
        app:layout_constraintVertical_bias=&quot;0.292&quot;
        app:srcCompat=&quot;@drawable/pinkhellokitty&quot; /&gt;</code></pre></div><p>---<br />Взял картинку app:srcCompat=&quot;@mipmap/ic_launcher&quot; всё заработало. С Вашей картинкой не хочет. Вопрос: в панели файлов drawable/ отображается как pinkhellokitty.jpg (v24) Что такое v24?<br />---<br />Решено! Оказывается, при вставке изображения предлагается 2 вида: drawable и drawable24. Снова скопировал картинку в просто-drawable и все Ок!</p>]]></content>
			<author>
				<name><![CDATA[MonoLife]]></name>
				<uri>http://forum.alexanderklimov.ru/profile.php?id=1786</uri>
			</author>
			<updated>2018-11-19T01:52:13Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=1133#p1133</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Hello Kitty - Создаем первое приложение для Android]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=1132#p1132" />
			<content type="html"><![CDATA[<p>В статье всё есть. Просто делайте по шагам и тогда всё получится. Атрибут app:srcCompat, а не android:srcCompat. Прописывать вручную пока не нужно, всё можно сделать через окно свойств. Просто вы не там прописываете. android:src раньше точно работал, но возможно сейчас этот способ запретили, я не проверял (завтра проверю, по идее должно работать).</p>]]></content>
			<author>
				<name><![CDATA[alexander.klimoff]]></name>
				<uri>http://forum.alexanderklimov.ru/profile.php?id=2</uri>
			</author>
			<updated>2018-11-18T14:09:17Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=1132#p1132</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Hello Kitty - Создаем первое приложение для Android]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=1131#p1131" />
			<content type="html"><![CDATA[<p>При добавлении строки android:src=&quot;@drawable/pinkhellokitty&quot; приложение не запускается: ни на эмуляторе ни на устройстве (андроид 4.2)</p>]]></content>
			<author>
				<name><![CDATA[MonoLife]]></name>
				<uri>http://forum.alexanderklimov.ru/profile.php?id=1786</uri>
			</author>
			<updated>2018-11-18T13:06:05Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=1131#p1131</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Hello Kitty - Создаем первое приложение для Android]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=1130#p1130" />
			<content type="html"><![CDATA[<p><em>Вы не указали атрибут android:srcCompat.</em><br />ну.. во-первых в уроке об этом ничего нет, во-вторых, после добавления в строки в <br />&lt;ImageButton<br />&nbsp; &nbsp; &nbsp; &nbsp; android:srcCompat=&quot;@drawable/pinkhellokitty&quot; ...<br />компиляция не происходит куча ошибок <img src="http://forum.alexanderklimov.ru/img/smilies/sad.png" width="15" height="15" alt="sad" /> <br />..Android resource linking failed<br />Output:&nbsp; ../Android/AndroidStudioProjects/HelloWord/app/src/main/res/layout/activity_main.xml:10: error: attribute android:srcCompat not found.<br />error: failed linking file resources...<br />Если можете подсказать быстрое решение, буду признателен. Пока поковыряюсь сам. Спасибо.<br />ps: я добавил строку android:srcCompat.. в xml вручную</p>]]></content>
			<author>
				<name><![CDATA[MonoLife]]></name>
				<uri>http://forum.alexanderklimov.ru/profile.php?id=1786</uri>
			</author>
			<updated>2018-11-18T12:46:16Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=1130#p1130</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Hello Kitty - Создаем первое приложение для Android]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=1129#p1129" />
			<content type="html"><![CDATA[<p>Вы не указали атрибут android:srcCompat. У вас только атрибут tools:srcCompat, который предназначен для режима дизайна.</p>]]></content>
			<author>
				<name><![CDATA[alexander.klimoff]]></name>
				<uri>http://forum.alexanderklimov.ru/profile.php?id=2</uri>
			</author>
			<updated>2018-11-18T06:57:43Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=1129#p1129</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Hello Kitty - Создаем первое приложение для Android]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=1128#p1128" />
			<content type="html"><![CDATA[<p>Уважаемый автор! <br />Не могу понять причину, почему не отображается картинка в real time. В дизайне нормально.<br />&lt;ImageButton<br />&nbsp; &nbsp; &nbsp; &nbsp; android:id=&quot;@+id/imageButton&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; android:layout_width=&quot;130dp&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; android:layout_height=&quot;159dp&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginStart=&quot;8dp&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginTop=&quot;8dp&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginEnd=&quot;6dp&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginBottom=&quot;8dp&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; android:contentDescription=&quot;TODO&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; android:onClick=&quot;onClick&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintBottom_toTopOf=&quot;@+id/textView&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintEnd_toEndOf=&quot;parent&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintHorizontal_bias=&quot;0.5&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintStart_toStartOf=&quot;parent&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintTop_toTopOf=&quot;parent&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintVertical_bias=&quot;0.25&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; tools:contentDescription=&quot;@string/app_name&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; tools:srcCompat=&quot;@drawable/pinkhellokitty&quot; /&gt;</p>]]></content>
			<author>
				<name><![CDATA[MonoLife]]></name>
				<uri>http://forum.alexanderklimov.ru/profile.php?id=1786</uri>
			</author>
			<updated>2018-11-18T06:23:00Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=1128#p1128</id>
		</entry>
</feed>
