Firstly you have to know either your pc already installed jdk software or not. If not then click the link https://www.oracle.com/java/technologies/javase-jdk16-downloads.html and below the “Windows x64 Installer(if operating system is 64 bit)” or “Windows x32 Installer(if operating system is 32 bit)”
System Requirements
Microsoft Windows 7/8/10 (32-bit or 64-bit)
4 GB RAM minimum, 8 GB RAM recommended (plus 1 GB for the Android Emulator)
2 GB of available disk space minimum, 4 GB recommended (500 MB for IDE plus 1.5 GB for Android SDK and emulator system image)
1280 x 800 minimum screen resolution.
Then download and install Java SE Development Kit 16(jdk).
Now it is time for Install and Set up Android Studio in Windows
Link for Android studio download: https://developer.android.com/studio/
Follow every steps with the video tutorials.
For Android app development Android Studio is the official IDE. It is based on JetBrains IntelliJ IDEA software also provides many excellent features that enlarge productivity when building Android apps, such as:
Anyone can develop for all Android devices such kind of environment.
Modify to push code and resource into the running app without restarting the app.
A flexible Gradle-based build system with fast and feature-rich emulator.
GitHub and Code template to develop common app features and import sample code.
Extensive testing tools and frameworks along support C++ and NDK.
Built-in support for Google Cloud Platform, making it easy to integrate Google Cloud Messaging and App Engine, and many more.
Installation Guideline:
Step 1: Head over to this link to get the Android Studio executable or zip file.
Step 2:Click on the Download Android Studio Button. Click on the “I have read and agree with the above terms and conditions” checkbox followed by the download button.
Click on the Save file button in the appeared prompt box and the file will start downloading.
Step 3: After the downloading has finished, open the file from downloads and run it. It will prompt of the dialog box.
Click on next. In the next prompt, it’ll ask for a path for installation. Choose a path and hit next.
Step 4: It will start the installation, and once it is completed.
Click on next.
Step 5: Once “Finish” is clicked, it will ask whether the previous settings need to be imported [ That means, if the android studio had been installed earlier], or not. It is better to choose the ‘Don’t import Settings option’. Click the OK button.
Step 6: This will start the Android Studio. Meanwhile, it will be finding the available SDK components.
Step 7: After it has found the SDK components, it will redirect to the Welcome dialog box.
Click on Next.
Choose Standard and click on Next. Now choose the theme, whether the Light theme or the Dark one this is your choice. The light one is called the IntelliJ theme whereas the dark theme is called Darcula. Choose as required.
Click on the Nextbutton.
Step 8:Now it is time to download the SDK components.
Click on Finish. Components begin to download let it complete.
The Android Studio has been successfully configured. Now it’s time to launch and build apps. Click on the Finish button to launch it.
Step 9: Click on Start a new Android Studio project to build a new app.
Navigation drawers provide access to destinations and app functionality, switching tabs. Tabs can either be permanently on-screen or controlled by a navigation menu icon. Navigation drawers are consumed for, with five or more top-level targets, two or more levels of navigation hierarchy, Fast navigation between unrelated target.
Firstly create new project like
File -> new project -> Name it as like NavigationDraweerwithTabs -> select minimum SDK like 14 ->select Navigation Drawer Activity.
package com.example.nipu.navigationwithtabs;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
public class tabpagerAdapter extends FragmentStatePagerAdapter {
String[] tabarray = new String[]{"One","Two","Three","Four","Five","Six"};
Integer tabnumber = 6;
public tabpagerAdapter(FragmentManager fm) {
super(fm);
}
@Override
public CharSequence getPageTitle(int position) {
return tabarray[position];
}
@Override
public Fragment getItem(int position) {
switch (position)
{
case 0:
one one1 = new one();
return one1;
case 1:
two two2 = new two();
return two2;
case 2:
three three3 = new three();
return three3;
case 3:
four four4 = new four();
return four4;
case 4:
five five5 = new five();
return five5;
case 5:
six six6 = new six();
return six6;
}
return null;
}
@Override
public int getCount() {
return tabnumber;
}
}
Now goto,
MainActivity.java
Initialize TabLayout, Viewpager.
Create object tabpagerAdapter and set with viewpager
Set viewpager with TabLayout.
Here is code for,
MainActivity.java
package com.example.nipu.navigationwithtabs;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.view.View;
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);
TabLayout tabLayout =(TabLayout)findViewById(R.id.tabs);
ViewPager Pager =(ViewPager)findViewById(R.id.viewpager);
tabpagerAdapter Tabpageradapter = new tabpagerAdapter(getSupportFragmentManager());
Pager.setAdapter(Tabpageradapter);
tabLayout.setupWithViewPager(Pager);
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.setDrawerListener(toggle);
toggle.syncState();
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();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
if (id == R.id.nav_camera) {
// Handle the camera action
} else if (id == R.id.nav_gallery) {
} else if (id == R.id.nav_slideshow) {
} else if (id == R.id.nav_manage) {
} else if (id == R.id.nav_share) {
} else if (id == R.id.nav_send) {
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
}