Date post: | 26-Oct-2014 |
Category: |
Documents |
Upload: | mailzybotech |
View: | 24 times |
Download: | 0 times |
Android Application Development Training Tutorial
For more info visit
http://www.zybotech.in
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
Main.xml
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ScrollView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scrollbars="vertical">
<LinearLayout
android:layout_width="fill_parent"
android:orientation="vertical"
android:layout_height="fill_parent">
<TextView
android:id="@+id/TextViewTitle"
android:text="Enter FeedBack Details to Send to the Developer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10pt">
</TextView>
<EditText
android:id="@+id/EditTextName"
android:layout_height="wrap_content"
android:text="Your NAME"
android:hint="" A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
android:inputType="textPersonName"
android:layout_width="fill_parent">
</EditText>
<EditText
android:id="@+id/EditTextEmail"
android:layout_height="wrap_content"
android:text="Your EMAIL ID"
android:hint=""
android:inputType="textEmailAddress"
android:layout_width="fill_parent">
</EditText>
<Spinner
android:id="@+id/SpinnerFeedbackType"
android:layout_height="wrap_content"
android:prompt="@string/feedbacktype1"
android:layout_width="fill_parent"
android:entries="@array/feedbacktypelist">
</Spinner>
<EditText
android:id="@+id/EditTextFeedbackBody"
android:layout_height="wrap_content"
android:text="Please Enter Your FeedBack"
android:lines="5"
android:layout_width="fill_parent">
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
</EditText>
<CheckBox
android:id="@+id/CheckBoxResponse"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="Would you like an email response?">
</CheckBox>
<Button
android:id="@+id/ButtonSendFeedback"
android:layout_height="wrap_content"
android:text="Send FeedBack"
android:onClick="sendFeedback"
android:layout_width="fill_parent">
</Button>
</LinearLayout>
</ScrollView>
Outs.xml
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ScrollView01"
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical">
<LinearLayout
android:layout_width="fill_parent"
android:orientation="vertical"
android:layout_height="fill_parent">
<TextView
android:id="@+id/application"
android:text="Sending FeedBack"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="10pt">
</TextView>
<EditText
android:id="@+id/names"
android:layout_height="wrap_content"
android:text=""
android:hint=""
android:inputType="textPersonName"
android:layout_width="fill_parent">
</EditText>
<EditText
android:id="@+id/emails"
android:layout_height="wrap_content" A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
android:text=""
android:hint=""
android:inputType="textEmailAddress"
android:layout_width="fill_parent">
</EditText>
<EditText
android:id="@+id/feedbacks"
android:layout_height="wrap_content"
android:text=""
android:lines="5"
android:layout_width="fill_parent">
</EditText>
<Button
android:id="@+id/send"
android:layout_height="wrap_content"
android:text="Send"
android:onClick="Send"
android:layout_width="fill_parent">
</Button>
<Button
android:id="@+id/saveas"
android:layout_height="wrap_content"
android:text="Save as Draft"
android:onClick="SaveasDraft"
android:layout_width="fill_parent"> A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
</Button>
<Button
android:id="@+id/discard"
android:layout_height="wrap_content"
android:text="Discard"
android:onClick="Discards"
android:layout_width="fill_parent">
</Button>
</LinearLayout>
</ScrollView>
Form Creation.java
package org.aceware.form;
import org.aceware.form.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
public class FormCreation extends Activity {
/** Called when the activity is first created. */
EditText name;
EditText email;
//Spinner spinner;
EditText feedbackbody;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView textviewtitle = ( TextView) findViewById(R.id.TextViewTitle);
name = (EditText) findViewById(R.id.EditTextName);
name.setOnTouchListener(new OnTouchListener()
{
@Override
public boolean onTouch(View arg0, MotionEvent arg1) {
name.setText("");
return false;
}
});A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
String name1 = name.getText().toString();
email = (EditText) findViewById(R.id.EditTextEmail);
email.setOnTouchListener(new OnTouchListener()
{
@Override
public boolean onTouch(View arg0, MotionEvent arg1) {
email.setText("");
return false;
}
});
// spinner=(Spinner) findViewById(R.id.SpinnerFeedbackType);
feedbackbody=(EditText) findViewById(R.id.EditTextFeedbackBody);
feedbackbody.setOnTouchListener(new OnTouchListener()
{
@Override
public boolean onTouch(View arg0, MotionEvent arg1) {
feedbackbody.setText("");
return false;
}
});
// CheckBox response=(CheckBox)findViewById(R.id.EditTextFeedbackBody);
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
Button sendfeedback=(Button) findViewById(R.id.ButtonSendFeedback);
final Intent intent=new Intent(this,outputs.class);
sendfeedback.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{ Bundle bundle=new Bundle();
bundle.putString("NAME",name.getText().toString());
bundle.putString("EMAIL",email.getText().toString());
bundle.putString("FEED",feedbackbody.getText().toString());
intent.putExtras(bundle);
startActivity(intent);
}
});
}}
Outputs.java
package org.aceware.form;
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class outputs extends Activity{
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.output);
Bundle bundle=getIntent().getExtras();
EditText outname=(EditText)findViewById(R.id.names);
outname.setCursorVisible(false);
EditText outemail=(EditText)findViewById(R.id.emails);
outemail.setCursorVisible(false);
EditText outfeedbackss=(EditText)findViewById(R.id.feedbacks);
outfeedbackss.setCursorVisible(false);
Button send=(Button)findViewById(R.id.send);
Button saveas=(Button)findViewById(R.id.saveas);
Button discard=(Button)findViewById(R.id.discard);
String name=bundle.getString("NAME");
String emaill=bundle.getString("EMAIL");
String feed=bundle.getString("FEED");
outname.setText(name);
outemail.setText(emaill);A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
outfeedbackss.setText(feed);
send.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v) {
Toast.makeText(getBaseContext(),
"Sending FeedBack",
Toast.LENGTH_SHORT).show();
}});
saveas.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v) {
Toast.makeText(getBaseContext(),
"Save As Draft",
Toast.LENGTH_SHORT).show();
}});
discard.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v) {
Toast.makeText(getBaseContext(),
"Discard",
Toast.LENGTH_SHORT).show();
}});
}}
Values/arrays
<?xml version="1.0" encoding="utf-8"?>A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
<resources>
<string-array name="feedbacktypelist">
<item>@string/feedbacktype1</item>
<item>@string/feedbacktype2</item>
<item>@string/feedbacktype3</item>
<item>@string/feedbacktype4</item>
</string-array>
</resources>
Values/strings
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="feedbacktype1">Praise</string>
<string name="feedbacktype2">Gripe</string>
<string name="feedbacktype3">Suggestion</string>
<string name="feedbacktype4">Bug</string>
</resources>
androidManifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
package="org.aceware.form"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="form">
<activity android:name=".FormCreation"
android:label="forms">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".outputs"
android:label="forms">
</activity>
</application>
<uses-sdk android:minSdkVersion="8" />
</manifest>
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi