<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Форум Александра Климова — Шаблон Navigation Drawer Activity]]></title>
	<link rel="self" href="http://forum.alexanderklimov.ru/extern.php?action=feed&amp;tid=22&amp;type=atom" />
	<updated>2019-11-06T18:47:57Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.alexanderklimov.ru/viewtopic.php?id=22</id>
		<entry>
			<title type="html"><![CDATA[Re: Шаблон Navigation Drawer Activity]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=1165#p1165" />
			<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-11-06T18:47:57Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=1165#p1165</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Шаблон Navigation Drawer Activity]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=1078#p1078" />
			<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>2018-03-26T17:26:24Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=1078#p1078</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Шаблон Navigation Drawer Activity]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=1077#p1077" />
			<content type="html"><![CDATA[<p>&quot;падает при выборе каких-то пунктов, кроме тех на которые назначены фрагменты&quot; вроде специально уточнил каких. Прошу прощения, если непонятно написал. Я имел в виду все пункты в меню NavigationDrawer, кроме тех, на которые по уроку мы назначили фрагменты (первые два пункта).&nbsp; Если в коде MainActivity в обработчике нажатия на пункты, аналогично на каждый пункт в условиях добавить те же фрагменты, что и на первые 2 пункта, то все работает, а когда там пусто вылетает.</p>]]></content>
			<author>
				<name><![CDATA[megapixxxell]]></name>
				<uri>http://forum.alexanderklimov.ru/profile.php?id=1429</uri>
			</author>
			<updated>2018-03-26T09:13:37Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=1077#p1077</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Шаблон Navigation Drawer Activity]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=1076#p1076" />
			<content type="html"><![CDATA[<p>Мне нравится ваша формулировка - &quot;падает при выборе каких-то пунктов&quot;. Я отвечу в таком же духе - &quot;надо переписать какие-то строчки кода и будет вам счастье&quot;</p>]]></content>
			<author>
				<name><![CDATA[alexander.klimoff]]></name>
				<uri>http://forum.alexanderklimov.ru/profile.php?id=2</uri>
			</author>
			<updated>2018-03-26T05:14:31Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=1076#p1076</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Шаблон Navigation Drawer Activity]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=1075#p1075" />
			<content type="html"><![CDATA[<p>При тесте на реальном и виртуальном устройстве, падает при выборе каких-то пунктов, кроме тех на которые назначены фрагменты,а&nbsp; во вкладке RUN снизу где logcat и тд много красного текста <br /><span style="color: #FF0000">E/AndroidRuntime: FATAL EXCEPTION: main<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Process: com.example.megap.navigatiodrawer, PID: 15116<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; java.lang.NullPointerException: Attempt to invoke virtual method &#039;java.lang.Class java.lang.Object.getClass()&#039; on a null object reference<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; at android.support.v4.app.BackStackRecord.doAddOp(BackStackRecord.java:394)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; at android.support.v4.app.BackStackRecord.replace(BackStackRecord.java:441)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; at android.support.v4.app.BackStackRecord.replace(BackStackRecord.java:432)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; at com.example.megap.navigatiodrawer.MainActivity.onNavigationItemSelected(MainActivity.java:114)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; at android.support.design.widget.NavigationView$1.onMenuItemSelected(NavigationView.java:154)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; at android.support.v7.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:822)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; at android.support.v7.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:171)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; at android.support.v7.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:973)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; at android.support.design.internal.NavigationMenuPresenter$1.onClick(NavigationMenuPresenter.java:342)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; at android.view.View.performClick(View.java:5647)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; at android.view.View$PerformClick.run(View.java:22462)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; at android.os.Handler.handleCallback(Handler.java:754)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; at android.os.Handler.dispatchMessage(Handler.java:95)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; at android.os.Looper.loop(Looper.java:163)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; at android.app.ActivityThread.main(ActivityThread.java:6205)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; at java.lang.reflect.Method.invoke(Native Method)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)<br />Application terminated.</span></p>]]></content>
			<author>
				<name><![CDATA[megapixxxell]]></name>
				<uri>http://forum.alexanderklimov.ru/profile.php?id=1429</uri>
			</author>
			<updated>2018-03-25T07:59:31Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=1075#p1075</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Шаблон Navigation Drawer Activity]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=1060#p1060" />
			<content type="html"><![CDATA[<p>Вам пишут про ошибку в XML, а вы приводите код Java.</p>]]></content>
			<author>
				<name><![CDATA[alexander.klimoff]]></name>
				<uri>http://forum.alexanderklimov.ru/profile.php?id=2</uri>
			</author>
			<updated>2018-02-19T20:34:07Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=1060#p1060</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Шаблон Navigation Drawer Activity]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=1059#p1059" />
			<content type="html"><![CDATA[<p>Доброго времени суток. Подскажите, в чем может быть проблема? При запуске приложения выдает ошибку java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.serdechenko.etouchtest/com.example.serdechenko.etouchtest.MainActivity}: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class android.support.design.widget.NavigationView<br /> at<br />Что это за нулевая строка кода? <br />MainActivity: <br /></p><div class="codebox"><pre><code>package com.example.serdechenko.etouchtest;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;

public class MainActivity extends AppCompatActivity
        implements NavigationView.OnNavigationItemSelectedListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);



        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
                this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
        drawer.addDrawerListener(toggle);
        toggle.syncState();
        drawer.openDrawer(GravityCompat.START);
        NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
        navigationView.setNavigationItemSelectedListener(this);
    }


    @Override
    public void onBackPressed() {
        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        if (drawer.isDrawerOpen(GravityCompat.START)) {
            drawer.closeDrawer(GravityCompat.START);
        } else {
            super.onBackPressed();
        }
    }



    @SuppressWarnings(&quot;StatementWithEmptyBody&quot;)
    @Override
    public boolean onNavigationItemSelected(@NonNull MenuItem item) {
        // Handle navigation view item clicks here.
        int id = item.getItemId();

        if (id == R.id.nav_downolad) {

        } else if (id == R.id.nav_manage){
            Intent intent = new Intent(MainActivity.this, ManagerActivity.class);
            startActivity(intent);
    }
        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        drawer.closeDrawer(GravityCompat.START);
        return true;
    }


}</code></pre></div><p>В коде ничего не менял, только удалил ненужные элементы ( меню в правом верхнем углу и FloatingActionButton)</p>]]></content>
			<author>
				<name><![CDATA[kykara4a]]></name>
				<uri>http://forum.alexanderklimov.ru/profile.php?id=1548</uri>
			</author>
			<updated>2018-02-19T18:46:40Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=1059#p1059</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Шаблон Navigation Drawer Activity]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=1000#p1000" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>xwhiskasx wrote:</cite><blockquote><p>Здравствуйте, после переписывания (несколько раз <img src="http://forum.alexanderklimov.ru/img/smilies/smile.png" width="15" height="15" alt="smile" /> примера из задания, возникает ошибка в&nbsp; коде<br />В строке <br />fragmentManager.beginTransaction().replace(R.id.container,fragment).commit();</p><br /><p>Мол второй аргумент неправильный, начал искать ответ на stackoverflow и вот что выяснил</p><br /><p>Menu_Fragment is not inheriting from android.support.v4.app.Fragment. Presumably, it is inheriting from android.app.Fragment.</p><p>There are two fragment implementations: the native one (e.g., android.app.Fragment) and the backport (e.g., android.support.v4.app.Fragment). You need to be consistent. Your activity is a FragmentActivity, which is part of the backport, so you need your fragments to inherit from android.support.v4.app.Fragment.</p><br /><p>Но ошибку самостоятельно исправить так и не смог. Пробовал импортировать import android.support.v4.app.Fragment;<br />этот класс, но ошибка всеравно осталась, подскажите, что делать?</p></blockquote></div><p>Была такая же проблема, вроде решилась заменой&nbsp; &quot;import android.app.Fragment;&quot; на &quot;import android.support.v4.app.Fragment;&quot;</p>]]></content>
			<author>
				<name><![CDATA[paulv2007]]></name>
				<uri>http://forum.alexanderklimov.ru/profile.php?id=1558</uri>
			</author>
			<updated>2017-12-05T21:43:05Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=1000#p1000</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Шаблон Navigation Drawer Activity]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=915#p915" />
			<content type="html"><![CDATA[<p>Поддерживаю вопрос пред идущий. Подскажите как исправить &quot;съезд шапки&quot; в версиях начиная с 5-ой?</p>]]></content>
			<author>
				<name><![CDATA[iulskiy]]></name>
				<uri>http://forum.alexanderklimov.ru/profile.php?id=1471</uri>
			</author>
			<updated>2017-09-12T18:45:15Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=915#p915</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Шаблон Navigation Drawer Activity]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=721#p721" />
			<content type="html"><![CDATA[<p>Добрый день! Кто-нибудь может подсказать, на 6 и 7 андроиде если делать стрелку видимой, вместо гамбургера, при открытии панели, шапка съезжает вверх. Какие стили нужно использовать, что-то у меня не получается всё по местам расставить. Спасибо.</p>]]></content>
			<author>
				<name><![CDATA[igimux]]></name>
				<uri>http://forum.alexanderklimov.ru/profile.php?id=1444</uri>
			</author>
			<updated>2017-03-23T08:38:50Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=721#p721</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Шаблон Navigation Drawer Activity]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=684#p684" />
			<content type="html"><![CDATA[<p>Здравствуйте, после переписывания (несколько раз <img src="http://forum.alexanderklimov.ru/img/smilies/smile.png" width="15" height="15" alt="smile" /> примера из задания, возникает ошибка в&nbsp; коде<br />В строке <br />fragmentManager.beginTransaction().replace(R.id.container,fragment).commit();</p><br /><p>Мол второй аргумент неправильный, начал искать ответ на stackoverflow и вот что выяснил</p><br /><p>Menu_Fragment is not inheriting from android.support.v4.app.Fragment. Presumably, it is inheriting from android.app.Fragment.</p><p>There are two fragment implementations: the native one (e.g., android.app.Fragment) and the backport (e.g., android.support.v4.app.Fragment). You need to be consistent. Your activity is a FragmentActivity, which is part of the backport, so you need your fragments to inherit from android.support.v4.app.Fragment.</p><br /><p>Но ошибку самостоятельно исправить так и не смог. Пробовал импортировать import android.support.v4.app.Fragment;<br />этот класс, но ошибка всеравно осталась, подскажите, что делать?</p>]]></content>
			<author>
				<name><![CDATA[xwhiskasx]]></name>
				<uri>http://forum.alexanderklimov.ru/profile.php?id=1415</uri>
			</author>
			<updated>2017-01-18T09:13:48Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=684#p684</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Шаблон Navigation Drawer Activity]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=662#p662" />
			<content type="html"><![CDATA[<p>Подскажите пожалуйста, как сделать, чтобы Фрагмент 1 Вашего примера отображался в контейнере, при запуске приложения, спасибо.</p>]]></content>
			<author>
				<name><![CDATA[Антон]]></name>
				<uri>http://forum.alexanderklimov.ru/profile.php?id=1409</uri>
			</author>
			<updated>2016-12-11T14:23:05Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=662#p662</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Шаблон Navigation Drawer Activity]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=661#p661" />
			<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-12-08T09:43:16Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=661#p661</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Шаблон Navigation Drawer Activity]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=660#p660" />
			<content type="html"><![CDATA[<p>Добрый день. Отличная статья! Понравилась реализация &quot;превращения значка гамбургера в стрелку в явном виде&quot;. На 4 м андроиде работает прекрасно, а на 6 м и 7 м шапка съезжает вверх <span class="postimg"><img src="http://hostingkartinok.com/show-image.php?id=c9bc4e94a3f341193c3107ac19e84abf" alt="PunBB bbcode test" /></span></p>]]></content>
			<author>
				<name><![CDATA[anddever]]></name>
				<uri>http://forum.alexanderklimov.ru/profile.php?id=1407</uri>
			</author>
			<updated>2016-12-08T07:56:58Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=660#p660</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Шаблон Navigation Drawer Activity]]></title>
			<link rel="alternate" href="http://forum.alexanderklimov.ru/viewtopic.php?pid=624#p624" />
			<content type="html"><![CDATA[<p>Добрый день.</p><p>На сайте Александра Климова подробно показано, как создать создать боковую навигационную панель используя NavigationView. </p><p>Также есть статья, посвященная вкладкам TabHost и TabWidget (<a href="http://developer.alexanderklimov.ru/android/views/tabhost-tabwidget.php">http://developer.alexanderklimov.ru/and … widget.php</a>).</p><p>Пожалуйста, подскажите, можно ли вкладки разместить на боковой навигационной панели? </p><p>Хотелось бы размещать там, конечно, не меню, которое идет в шаблоне, а например, результаты поиска, перечень ссылок из базы данных, да и много другого, к чему удобно дать пользователю быстрый доступ через боковую выдвижную панель. </p><p>Если у кого нибудь получилось &quot;не стандартно&quot; использовать боковую выдвижную панель, включив в нее вкладки, пожалуйста, поделитесь.</p>]]></content>
			<author>
				<name><![CDATA[agnostic]]></name>
				<uri>http://forum.alexanderklimov.ru/profile.php?id=1388</uri>
			</author>
			<updated>2016-10-10T17:02:52Z</updated>
			<id>http://forum.alexanderklimov.ru/viewtopic.php?pid=624#p624</id>
		</entry>
</feed>
