Tuesday, February 24, 2015

Java Tutorial For Beginners 35 - HashSet in Java











1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
package lesson1;
import java.util.*;

public class MyClass {

 public static void main(String[] args) {
   HashSet<String> name = new  HashSet<String>();
   name.add("Mark");
   name.add("tom");
   name.add("jack");
   name.add("july");
   name.add("patrik");
   
   Iterator<String> itr = name.iterator();
   
   while(itr.hasNext())
    System.out.println(itr.next());
 }
    
}


























Java - The HashSet Class

Java Collections Framework Tutorial

Set and HashSet : HashSet

Java Collections - Set

Searches related to java tutorial hashset

java hashset element

java collections tutorial

java iterate hashset

hashset java collections

hashset remove

hashset example in java

java set hashset

java print hashset

HashSet examples



Learning Java in simple and easy steps : A beginner's tutorial containing complete knowledge of Java Syntax Object Oriented Language, Methods, Overriding, Inheritance, Polymorphism, Interfaces, Packages, Collections, Networking, Multithreading, Generics, Multimedia, Serialization, GUI





Extra Tags: Java, Tutorials, Learning, Beginners, Basics, Object Oriented Language, Methods, Overriding, Inheritance, Polymorphism, Interfaces, Packages, Collections, Networking, Multithreading, Generics, Multimedia, Serialization, GUI,Learn,Java,Tutorial,Interactive,Free,java programming, Books,,java programming, Books,

Saturday, February 21, 2015

Android Tutorial for Beginners 6 # Android Activity Lifecycle State chan...





































Android Activity Lifecycle State change  Example  http://programmingknowledgeblog.blogspot.de/2015/01/android-activity-cycle-state-changes.html







Managing the Activity Lifecycle

Starting an Activity | Android Developers

Searches related to android activity lifecycle

android activity lifecycle pdf

android activity lifecycle onactivityresult

android activity lifecycle onnewintent

android activity lifecycle orientation change

android activity lifecycle example

android activity lifecycle interview questions

android activity lifecycle listener

android activity lifecycle back button









Extra Tags : Android,  programming, tutorial, beginners , develop, ,mobile phone, Environment Setup, Application Components, Activity Lifecycle, Service Lifecycle, Application Architecture, Publishing Application, Debugging  Applications, Hadnling Events, Layouts, User Interface Controls, Styles and Themes,  Handling Rotation, data storage, managing media, Send Email, Send SMS, Phone Calls


Android Tutorial for Beginners 4 # Basic Overview of an Android App











































How to Write a 'Hello World!' app for Android

Hello Android - The Hello World Application

How to run Hello World Android app

Android App Development: Hello World

Create Your First Hello World Android Application

Lecture  Getting Started with Android

Searches related to android hello world app

android hello world app not working

android hello world app download

android hello world app crashes

how to create a hello world app for android

writing hello world for android

android apk hello world

hello world android application in eclipse

first android app in eclipse

Searches related to android studio first app

android first app error

Build a Simple Android App Course

Searches related to Basic Overview of an Android App

android app review

android app review sites

android app review sites list

android app review time

android app review service

android app review source

android app review exchange

android app review forum





Extra Tags : Android,  programming, tutorial, beginners , develop, ,mobile phone, Environment Setup, Application Components, Activity Lifecycle, Service Lifecycle, Application Architecture, Publishing Application, Debugging  Applications, Hadnling Events, Layouts, User Interface Controls, Styles and Themes,  Handling Rotation, data storage, managing media, Send Email, Send SMS, Phone Calls

Android Tutorial for Beginners 3 # Building Your First Android App (Hell...





































How to Write a 'Hello World!' app for Android

Hello Android - The Hello World Application

How to run Hello World Android app

Android App Development: Hello World

Create Your First Hello World Android Application

Lecture  Getting Started with Android

Searches related to android hello world app

android hello world app not working

android hello world app download

android hello world app crashes

how to create a hello world app for android

writing hello world for android

android apk hello world

hello world android application in eclipse

first android app in eclipse

Searches related to android studio first app

android first app error

android first app in eclipse

android first app not working

android first app video

android first app r cannot be resolved

android first app example

android first app guide

android studio vs eclipse

Creating an Android Project

Android Tutorial for Beginners 2 # How to install Android Studio





































Installing the Android SDK | Android Developers

Download Android Studio and SDK Tools | Android

How to Install Android Studio on Windows 7 - YouTube

Installing Android Studio

Android Studio installation on Windows 7 fails, no JDK found

Setting up a Windows, Linux or Mac OS X Android Studio

Getting Started with Android Studio

Searches related to how to install android studio

how to install android studio in ubuntu

how to install android studio on windows 8

how to install android studio on windows 7

how to install android studio plugin

how to install android studio on mac

how to install android studio in linux mint





Extra Tags : Android,  programming, tutorial, beginners , develop, ,mobile phone, Environment Setup, Application Components, Activity Lifecycle, Service Lifecycle, Application Architecture, Publishing Application, Debugging  Applications, Hadnling Events, Layouts, User Interface Controls, Styles and Themes,  Handling Rotation, data storage, managing media, Send Email, Send SMS, Phone Calls

Android Tutorial for Beginners 1 # Introduction and Installing and Conf...









































Building Your First App

Android tutorial

Searches related to android tutorial for beginners

android tutorial for beginners pdf

android tutorial for beginners roseindia

android programing tutorial

android tutorial for beginners pdf free download

android development tutorial

android video tutorial for beginners

android tutorial for beginners eclipse

android tutorial for beginners ppt





Extra Tags : Android,  programming, tutorial, beginners , develop, ,mobile phone, Environment Setup, Application Components, Activity Lifecycle, Service Lifecycle, Application Architecture, Publishing Application, Debugging  Applications, Hadnling Events, Layouts, User Interface Controls, Styles and Themes,  Handling Rotation, data storage, managing media, Send Email, Send SMS, Phone Calls

Android Tutorial for Beginners 20 # Android WebView Example









MainActivity.java








1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package com.example.programmingknowledge.webviewexample;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.EditText;


public class MainActivity extends ActionBarActivity {
    private static Button button_sbm;
    private static EditText url_text;
    private static WebView browser;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        openUrl();
    }

    public void openUrl() {
        button_sbm =(Button)findViewById(R.id.button);
        url_text =(EditText)findViewById(R.id.editText);
        browser = (WebView)findViewById(R.id.webView);

        button_sbm.setOnClickListener(
                new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                     String url = url_text.getText().toString();
                        browser.getSettings().setLoadsImagesAutomatically(true);
                        browser.getSettings().setJavaScriptEnabled(true);
                        browser.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
                        browser.loadUrl(url);
                    }
                }
        );
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.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);
    }
}




ACTIVITY_MAIN.XML







1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"
    android:id="@+id/my_layout">

    <Button
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Opne Url"
        android:id="@+id/button"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true" />

    <EditText
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/editText"
        android:layout_below="@+id/button"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:text="https://www.google.com" />

    <WebView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:id="@+id/webView"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true"
        android:layout_below="@+id/editText"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true" />
</RelativeLayout>










1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.programmingknowledge.webviewexample" >
    <uses-permission android:name="android.permission.INTERNET" />
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>
















Getting Started: WebView-based Applications for Web
Building Web Apps in WebView
Android Web Application with Webview
Android WebView Tutorial
Android Web Apps Using Android WebView
android webview tutorial
android webview zoom
android webview local html
android webview javascript
android webview loaddata
android webview xml
android webview enable javascript
android webview alternative



Extra Tags : Android,  programming, tutorial, beginners , develop, ,mobile phone, Environment Setup, Application Components, Activity Lifecycle, Service Lifecycle, Application Architecture, Publishing Application, Debugging  Applications, Hadnling Events, Layouts, User Interface Controls, Styles and Themes,  Handling Rotation, data storage, managing media, Send Email, Send SMS, Phone Calls

Android Tutorial for Beginners 19 # Android SeekBar Example







MainActivity.java





1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package com.example.programmingknowledge.seekbarapp;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.Toast;


public class MainActivity extends ActionBarActivity {
    private static SeekBar seek_bar;
    private static TextView text_view;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        seebbarr( );
    }

    public void seebbarr( ){
        seek_bar = (SeekBar)findViewById(R.id.seekBar);
        text_view =(TextView)findViewById(R.id.textView);
        text_view.setText("Covered : " + seek_bar.getProgress() + " / " +seek_bar.getMax());

        seek_bar.setOnSeekBarChangeListener(
                new SeekBar.OnSeekBarChangeListener() {

                    int progress_value;
                    @Override
                    public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
                        progress_value = progress;
                        text_view.setText("Covered : " + progress + " / " +seek_bar.getMax());
                        Toast.makeText(MainActivity.this,"SeekBar in progress",Toast.LENGTH_LONG).show();
                    }

                    @Override
                    public void onStartTrackingTouch(SeekBar seekBar) {
                        Toast.makeText(MainActivity.this,"SeekBar in StartTracking",Toast.LENGTH_LONG).show();
                    }

                    @Override
                    public void onStopTrackingTouch(SeekBar seekBar) {
                        text_view.setText("Covered : " + progress_value + " / " +seek_bar.getMax());
                        Toast.makeText(MainActivity.this,"SeekBar in StopTracking",Toast.LENGTH_LONG).show();
                    }
                }
        );

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.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);
    }
}








activity_main.xml





1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"
    android:id="@+id/theLayout">

    <SeekBar
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/seekBar"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_marginTop="51dp" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:text="Large Text"
        android:id="@+id/textView"
        android:layout_below="@+id/seekBar"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_marginTop="102dp" />
</RelativeLayout>












android - how to set the seek bar thumb with a layout
Searches related to seekbar
seekbar example
custom seekbar android
seekbar style
android seekbar example code
android custom seekbar example
android seekbar min value
android seekbar example xml
seekbar setprogress not working


Extra Tags : Android,  programming, tutorial, beginners , develop, ,mobile phone, Environment Setup, Application Components, Activity Lifecycle, Service Lifecycle, Application Architecture, Publishing Application, Debugging  Applications, Hadnling Events, Layouts, User Interface Controls, Styles and Themes,  Handling Rotation, data storage, managing media, Send Email, Send SMS, Phone Calls

Saturday, February 14, 2015

Android Tutorial for Beginners 18 # Android ListView with Adapter Example





MainActivity.java



1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package com.example.programmingknowledge.listviewapp;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;


public class MainActivity extends ActionBarActivity {
    private static ListView list_view;
    private static String[] NAMES= new String[] {"Tom",
                                                 "Mark","John","Jack","Patrik","Peter"};
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        listView();
    }

    public void listView() {
        list_view = (ListView)findViewById(R.id.listView);
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,R.layout.name_list,NAMES);
        list_view.setAdapter(adapter);
        list_view.setOnItemClickListener(
                new AdapterView.OnItemClickListener() {
                    @Override
                    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                        String value = (String)list_view.getItemAtPosition(position);
                        Toast.makeText(MainActivity.this,"Position : " + position + " Value : "+ value,
                                Toast.LENGTH_LONG).show();
                    }
                }
        );
    }
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.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);
    }
}


activity_main.xml

1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">

    <ListView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/listView"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_alignParentTop="true" />
</RelativeLayout>


name_list.xml


1
2
3
4
5
6
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent" android:layout_height="match_parent"
    android:padding="10dp"
    android:textSize="22sp" >
</TextView>












Searches related to android listview example
android custom listview example
android listview example with images
android dynamic listview example
android listview example with database
android listview example with button
android listview example arrayadapter
android listview example with custom adapter
android listview in fragment example


Extra Tags : Android,  programming, tutorial, beginners , develop, ,mobile phone, Environment Setup, Application Components, Activity Lifecycle, Service Lifecycle, Application Architecture, Publishing Application, Debugging  Applications, Hadnling Events, Layouts, User Interface Controls, Styles and Themes,  Handling Rotation, data storage, managing media, Send Email, Send SMS, Phone Calls

Wednesday, February 11, 2015

C++ Tutorial for Beginners 44 - C++ Vectors









1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <iostream>
#include <vector>
#include <algorithm>    // std::remove
using namespace std;

int main()
{
std::vector<int> my_vec;
my_vec.push_back(10);
my_vec.push_back(20);
my_vec.push_back(30);
my_vec.push_back(40);

cout << "vector size = "<< my_vec.size() << endl;

for (int i=0;i< my_vec.size();i++)
     cout << "vector " <<i <<"  "<< my_vec.at(i) << endl;

   ///my_vec.erase(my_vec.begin() + 3);
   /// my_vec.erase(std::remove(my_vec.begin(),my_vec.end(),30),my_vec.end());
   ///   my_vec.clear();
     cout << endl<< endl;
  //my_vec.resize();
  cout << "is vector empty = "<< my_vec.empty() << endl;

  for (int i=0;i< my_vec.size();i++)
     cout << "vector " <<i <<"  "<< my_vec.at(i) << endl;

return 0;
}




















vector::vector - C++ Reference

C++ Tutorial: A Beginner's Guide to std::vector

The STL Vector Class

Searches related to c++ vector

Sequence container (C++)

c++ vector initialization

c++ vector to array

c++ vector of pointers

c++ vector assign

c++ vector contains

c++ vector example

c++ vector of objects

c++ vector push_bac





C++ , STANDARD TEMPLATE LIBRARY (STL)

C++ STL ( Standard Template Library) Tutorial - Learning C++ in simple and easy steps : A beginner's tutorial containing complete knowledge of C++ Syntax Object Oriented Language, Methods, Overriding, Inheritance, Polymorphism, Interfaces, STL, Iterators, Algorithms, Exception Handling, Overloading,Templates, Namespaces and Signal Handling

Tuesday, February 10, 2015

Android Tutorial for Beginners 17 # Android ImageView example









1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package com.example.programmingknowledge.imageapp;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;


public class MainActivity extends ActionBarActivity {
    private static ImageView imgView;
    private static Button buttonSbm;

    private int current_image_index;
    int[] images = {R.drawable.and_image1,R.drawable.and_image2,R.drawable.and_image3};
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        buttonClick();
    }

    public  void buttonClick() {
        imgView = (ImageView)findViewById(R.id.imageView);
        buttonSbm =(Button)findViewById(R.id.button);
        buttonSbm.setOnClickListener(
                new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        current_image_index++;
                        current_image_index = current_image_index % images.length;
                        imgView.setImageResource(images[current_image_index]);
                        //imgView.setImageResource(R.drawable.and_image2);
                    }
                }
        );
    }
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.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);
    }
}










1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/imageView"
        android:src="@drawable/and_image1"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true"
        android:scaleType="fitCenter"
        android:layout_above="@+id/button" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Switch Image"
        android:id="@+id/button"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true" />
</RelativeLayout>
























Changing Images continously with button click Android

Change image using a single button in Android

Images & ImageButton: Android Programming

How to Set Image in a Image View on Click in Android Studio

Searches related to change image on button click android

android image button click effect

java - How to Increase the size of Image View in Android

How to increase images size in gallery view???

reduce or increase size of image in android

android image button with text

android image button transparent

android image button size

android image button remove background

android image button states

android image button no border

android image button scale







Extra Tags : Android,  programming, tutorial, beginners , develop, ,mobile phone, Environment Setup, Application Components, Activity Lifecycle, Service Lifecycle, Application Architecture, Publishing Application, Debugging  Applications, Hadnling Events, Layouts, User Interface Controls, Styles and Themes,  Handling Rotation, data storage, managing media, Send Email, Send SMS, Phone Calls

Thursday, February 5, 2015

Android Tutorial for Beginners 13 # How to Start New Activity On Button ...









1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package com.example.programmingknowledge.myfirstapp;

import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;


public class MainActivity extends ActionBarActivity {

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

        OnClickButtonClickListener();
    }
     public void OnClickButtonClickListener(){
         button_sbm = (Button)findViewById(R.id.button);
         button_sbm.setOnClickListener(
                 new View.OnClickListener() {
                     @Override
                     public void onClick(View v) {
                         Intent i = new Intent("com.example.programmingknowledge.myfirstapp.MainActivity2");
                         startActivity(i);
                     }
                 }
         );
     }







    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.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);
    }
}








1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"
    android:id="@+id/my_text">

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Open Second Activity "
        android:id="@+id/button"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="183dp" />
</RelativeLayout>










1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.example.programmingknowledge.myfirstapp;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

public class MainActivity2 extends ActionBarActivity {

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


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_main_activity2, 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);
    }
}






1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin"
    tools:context="com.example.programmingknowledge.myfirstapp.MainActivity2">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:text="Second Activity"
        android:id="@+id/textView2"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="127dp" />
</RelativeLayout>













Start a New Activity in an Android App
How to Open New Activity on Click Button
How to open a second activity on click of button in android app
android - Start another activity by clicking a button
Searches related to android start new activity
android start new activity intent
android start new activity and finish current
android start new activity without intent
android start new activity kill current
android start new activity from menu
android start new activity with parameter
android start new activity item click listview
android start new activity from fragment
Searches related to android second new activity
android start second activity
how to create second activity in android
how to create second activity in android eclipse
android second monitor
android second 500 ribuan
android second gmail account
android second screen api
android second hand mobile price