How to make Informative android application in android studio - Geekyrishi

Post Top Ad

How to make Informative android application in android studio

How to make Informative android application in android studio

Share This


How to make Informative android application in android studio

This Android application gives list of o.s programs

screenshots,

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 Screen Recording,

 

source code for MainActivity.java, 

package com.blogspot.androidfission.osprograms;

import android.animation.Animator;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;



public class MainActivity extends AppCompatActivity {

    public Button gett;
    ImageView comp;
    Animation frombottom,fromtop;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        gett=(Button)findViewById(R.id.gett);

        comp=(ImageView)findViewById(R.id.comp);

        frombottom= AnimationUtils.loadAnimation(this,R.anim.frombottom);
        fromtop= AnimationUtils.loadAnimation(this,R.anim.fromtop);

        gett.setAnimation(frombottom);
        comp.setAnimation(fromtop);

        gett.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent toy= new Intent(MainActivity.this,Main2Activity.class);
                startActivity(toy);
            }
        });
    }
}



Code for MainActivity2.java

package com.blogspot.androidfission.osprograms;

import android.app.ListActivity;
import android.content.ClipData;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
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;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;


public class Main2Activity extends AppCompatActivity
        implements NavigationView.OnNavigationItemSelectedListener {

    Button btnShare;
    Intent shareIntent;
    ListView listView;

    String shareBody = "This app is Great";



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




        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);
        getSupportActionBar().setTitle("O.S Programs");

        ArrayAdapter<String> mAdapter = new ArrayAdapter<String>(Main2Activity.this,
                android.R.layout.simple_list_item_1,
                getResources().getStringArray(R.array.countries));

        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                Intent intent = new Intent(Main2Activity.this, Main3Activity.class);
                intent.putExtra("CountryName", listView.getItemAtPosition(i).toString());
                startActivity(intent);
            }
        });
        listView.setAdapter(mAdapter);
    }


    @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.main2, 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 (item.getItemId() == R.id.action_pin){

        }


            return true;


       // return super.onOptionsItemSelected(item);
    }

    @SuppressWarnings("StatementWithEmptyBody")
    @Override
    public boolean onNavigationItemSelected(MenuItem item) {
        btnShare = (Button) findViewById(R.id.nav_share);
        // Handle navigation view item clicks here.

        int id = item.getItemId();

        if (id == R.id.blog) {
            // Handle the camera action
           Intent browser = new Intent(Intent.ACTION_VIEW, Uri.parse("http://androidfission.blogspot.in/"));
            startActivity(browser);
        } else if (id == R.id.twitter) {
            Intent browser = new Intent(Intent.ACTION_VIEW, Uri.parse("https://twitter.com/androidFission"));
            startActivity(browser);

        } else if (id == R.id.youtube) {
            Intent browser = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.youtube.com/channel/UC9VN7pi-BZgl7vmj_pt15uQ/videos"));
            startActivity(browser);
        } else if (id == R.id.about_author) {
            Intent browser = new Intent(Intent.ACTION_VIEW, Uri.parse("https://plus.google.com/107689617782690025575"));
            startActivity(browser);

        } else if (id == R.id.nav_share) {
            btnShare.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    shareIntent = new Intent(android.content.Intent.ACTION_SEND);
                    shareIntent.setType("text/pain");
                    shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,"My App");
                    shareIntent.putExtra(Intent.EXTRA_TEXT,"shareBody");
                    startActivity(Intent.createChooser(shareIntent,"Share via"));
                }
            });


        } else if (id == R.id.nav_send) {

        }

        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        drawer.closeDrawer(GravityCompat.START);
        return true;
    }
}
 

Code for MainActivity3.java

 package com.blogspot.androidfission.osprograms;


import android.os.Bundle;

import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;

import android.widget.TextView;

public class Main3Activity extends AppCompatActivity {

   public TextView textView2;
    Toolbar mToolbar;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main3);

        mToolbar = (Toolbar) findViewById(R.id.toolbar1);


        textView2=(TextView) findViewById(R.id.textView2);
        Bundle bundle = getIntent().getExtras();
        if (bundle != null) {
            mToolbar.setTitle(bundle.getString("CountryName"));
            if (mToolbar.getTitle().toString().equalsIgnoreCase("Shell Programming")) {

                textView2.setText(R.string.ass1);
            } else if (mToolbar.getTitle().toString().equalsIgnoreCase("Dynamic Expansion of array")) {
                textView2.setText(R.string.ass2);
            } else if (mToolbar.getTitle().toString().equalsIgnoreCase("Print all array elements")) {
                textView2.setText(R.string.ass3);
            } else if (mToolbar.getTitle().toString().equalsIgnoreCase("Calculation of factorial")) {
                textView2.setText(R.string.ass4);
            } else if (mToolbar.getTitle().toString().equalsIgnoreCase("Adding element to array")) {
                textView2.setText(R.string.ass5);
            } else if (mToolbar.getTitle().toString().equalsIgnoreCase("Calculate Even and Odd no")) {
                textView2.setText(R.string.ass7);
            } else if (mToolbar.getTitle().toString().equalsIgnoreCase("Scan network subnet")) {
                textView2.setText(R.string.ass8);
            } else if (mToolbar.getTitle().toString().equalsIgnoreCase("Notify when server is down script")) {
                textView2.setText(R.string.ass9);
            } else if (mToolbar.getTitle().toString().equalsIgnoreCase("Create a monitoring log")) {
                textView2.setText(R.string.ass10);
            }



        }
    }


}

 enjoy Developing ;)

 

6 comments:

  1. This blog will teach you how to build an Android app using the Android Studio development. Clear explanation with great source code.

    Build your Android Apps based on current trends from Way2Smile, Trusted Android App Development Company in Chennai.

    ReplyDelete
  2. Simple guidance for those who need to make Informative android application in android studio. Nice presentation, Will follow your blog for the further posts.

    Vicky from Devolve (Trusted Mobile App Development Company in Calgary).

    ReplyDelete

Post Bottom Ad