CREATE A ANDROID APP
ACCEPT NAME AND PRINT HII + NAME
FRIST OPEN eclipse
FILE TAB
OPEN NEW PROJECT AND SELECT ANDROID APPLICATION PROJECT
THEN APPLICATION NAME
THEN NEXT
THEN NEXT ---------> You CHANGE ICON THEN BROWSERS IMAGE
THEN NEXT -----> AND FINISH
THEN OPEN
FOLDER RES --->
THEN OPEN LAYOUT FOLDER
AND OPEN activty_main.xaml
and
and open values folder and select string.xaml file and
code
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">greation</string>
<string name="hello_world">Hello world!</string>
<string name="menu_settings">Settings</string>
<string name="accept">plz enter name</string>
<string name="show">show</string>
<string name="a"> hello i am niit student</string>
</resources>
AND activity_main in code
<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"
tools:context=".MainActivity" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="98dp"
android:layout_marginTop="112dp"
android:onClick="showresult"
android:text="@string/show" />
<EditText
android:id="@+id/accept"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/button1"
android:layout_alignParentTop="true"
android:layout_marginTop="26dp"
android:ems="10" />
<EditText
android:id="@+id/result"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/button1"
android:layout_centerVertical="true"
android:ems="10" >
<requestFocus />
</EditText>
</RelativeLayout>
AND open src folder and open Mainactivity.java
and code
package com.example.greation;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
public void showresult(View v)
{
EditText et = (EditText)findViewById(R.id.accept);
String s = et.getText().toString();
TextView obj = (TextView)findViewById(R.id.result);
obj.setText("hello"+s);
}
}
plz Download FOLDER
download app
ACCEPT NAME AND PRINT HII + NAME
FRIST OPEN eclipse
FILE TAB
OPEN NEW PROJECT AND SELECT ANDROID APPLICATION PROJECT
THEN APPLICATION NAME
THEN NEXT
THEN NEXT ---------> You CHANGE ICON THEN BROWSERS IMAGE
THEN NEXT -----> AND FINISH
THEN OPEN
FOLDER RES --->
THEN OPEN LAYOUT FOLDER
AND OPEN activty_main.xaml
and
and open values folder and select string.xaml file and
code
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">greation</string>
<string name="hello_world">Hello world!</string>
<string name="menu_settings">Settings</string>
<string name="accept">plz enter name</string>
<string name="show">show</string>
<string name="a"> hello i am niit student</string>
</resources>
AND activity_main in code
<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"
tools:context=".MainActivity" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="98dp"
android:layout_marginTop="112dp"
android:onClick="showresult"
android:text="@string/show" />
<EditText
android:id="@+id/accept"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/button1"
android:layout_alignParentTop="true"
android:layout_marginTop="26dp"
android:ems="10" />
<EditText
android:id="@+id/result"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/button1"
android:layout_centerVertical="true"
android:ems="10" >
<requestFocus />
</EditText>
</RelativeLayout>
AND open src folder and open Mainactivity.java
and code
package com.example.greation;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
public void showresult(View v)
{
EditText et = (EditText)findViewById(R.id.accept);
String s = et.getText().toString();
TextView obj = (TextView)findViewById(R.id.result);
obj.setText("hello"+s);
}
}
download app
No comments:
Post a Comment