When I'm trying to transfer data between activities, I can't get my message and the app keeps crashing,
It show me 'app keeps stopping'
Code in MainActivity.java
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class MainActivity extends AppCompatActivity {
Intent outIntent;
EditText edtPhone;
EditText edtMessage;
Button btnNext;
String tempText="";
public static final String PHONE = "PHONE";
public static final String MESSAGE = "MESSAGE";
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btnNext = (Button) findViewById(R.id.btnNext);
btnNext.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View V) {
outIntent = new Intent(MainActivity.this, ActivityTwo.class);
edtPhone = (EditText) findViewById(R.id.edtPhone);
edtMessage = (EditText) findViewById(R.id.edtMessage);
tempText = edtPhone.getText().toString();
outIntent.putExtra(PHONE,tempText);
tempText = edtMessage.getText().toString();
outIntent.putExtra(MESSAGE,tempText);
startActivity(outIntent);
}
});
}
public void closeMethod(View view) {
finish();
}
}
ActivityTwo.java
package com.example.fir;
import android.content.Intent;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import android.widget.TextView;
public class ActivityTwo extends AppCompatActivity {
Intent incomingIntent;
TextView txtPhone;
TextView txtMessage;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_two);
incomingIntent = getIntent();
txtPhone = (TextView) findViewById(R.id.txtPhone);
txtMessage = (TextView) findViewById(R.id.txtMessage);
txtPhone.setText(incomingIntent.getStringExtra(MainActivity.PHONE));
txtMessage.setText(incomingIntent.getStringExtra(MainActivity.MESSAGE));
}
}
Activitymain.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginTop="32dp"
android:text="Phone" />
<EditText
android:id="#+id/editTextPhone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="0dp"
android:layout_marginTop="60dp"
android:ems="10"
android:hint="Phone"
android:inputType="phone"
android:minHeight="48dp" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginTop="124dp"
android:text="Message" />
<EditText
android:id="#+id/editTextTextPersonName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_centerHorizontal="true"
android:layout_marginStart="0dp"
android:layout_marginTop="156dp"
android:layout_marginEnd="3dp"
android:ems="10"
android:hint="Message"
android:inputType=""
android:minHeight="48dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginTop="224dp"
android:orientation="horizontal">
<Button
android:id="#+id/btnNext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Next" />
<Button
android:id="#+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="closeMethod"
android:text="CLose" />
</LinearLayout>
</RelativeLayout>
Activitytwo.xml
////
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginTop="32dp"
android:text="Phone" />
<EditText
android:id="#+id/editTextPhone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="0dp"
android:layout_marginTop="60dp"
android:ems="10"
android:hint="Phone"
android:inputType="phone"
android:minHeight="48dp" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginTop="124dp"
android:text="Message" />
<EditText
android:id="#+id/editTextTextPersonName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_centerHorizontal="true"
android:layout_marginStart="0dp"
android:layout_marginTop="156dp"
android:layout_marginEnd="3dp"
android:ems="10"
android:hint="Message"
android:inputType=""
android:minHeight="48dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginTop="224dp"
android:orientation="horizontal">
<Button
android:id="#+id/btnNext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Next" />
<Button
android:id="#+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="closeMethod"
android:text="CLose" />
</LinearLayout>
</RelativeLayout>
The issue is when I don't put any value into the firstEditText or secondEditText or both of them and click on any button then the app crashes and a pop up shows "myapp keeps stopping".
I cannot get the text and am unsure of why the app keeps crashing.
you have defined your Edit texts in the first activity with id's named
edtPhone
edtMessage
but there was no edtPhone or edtMessage in your xml.
this issue also repeats in your second activity
you have defined txtPhone and txtMessage
but again there are no such ids in your second activity XML.
keep in mind that these might not be the whole problem as you didn't post any log for the errors. but if there were anything else, ask and we'll help you
Whenever I click the sign in button in my app, it just crashes and shows an error. Here is my activity_sign_in.xml and my SignIn.java.
activity_sign_in.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#mipmap/background1"
tools:context=".SignIn">
<LinearLayout
android:orientation="vertical"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_centerInParent="true"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.rengwuxian.materialedittext.MaterialEditText
android:id="#+id/editPhone"
android:hint="Phone Number"
android:textColorHint="#android:color/white"
android:text="0988112456"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#android:color/white"
android:textSize="34sp"
android:inputType="phone"
app:met_baseColor="#android:color/white"
app:met_floatingLabel="highlight"
app:met_maxCharacters="11"
app:met_primaryColor="#android:color/white"
app:met_singleLineEllipsis="true"
/>
<com.rengwuxian.materialedittext.MaterialEditText
android:id="#+id/editPassword"
android:hint="Password"
android:textColorHint="#android:color/white"
android:text="IMF"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#android:color/white"
android:textSize="34sp"
android:inputType="textPassword"
app:met_baseColor="#android:color/white"
app:met_floatingLabel="highlight"
app:met_maxCharacters="11"
app:met_primaryColor="#android:color/white"
app:met_singleLineEllipsis="true"
/>
<LinearLayout
android:orientation="horizontal"
android:weightSum="2"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<CheckBox
android:id="#+id/ckbRemember"
style="#style/Material.Drawable.CheckBox"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="Remember Me"
android:gravity="center_vertical"
android:textColor="#android:color/white"
app:cbd_tickColor="#color/colorPrimaryDark"
app:cbd_strokeColor="#android:color/white"
/>
<TextView
android:id="#+id/txtForgotPwd"
android:textColor="#android:color/white"
android:text="#string/forgot_pwd"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
<info.hoang8f.widget.FButton
android:id="#+id/btnSignIn1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:text="#string/Button2"
android:textColor="#android:color/white"
app:cornerRadius="4dp"
app:fButtonColor="#00A9D440"
app:shadowColor="#00000000"
app:shadowEnabled="true"
app:shadowHeight="5dp" />
</RelativeLayout>
SignIn.java
public class SignIn extends AppCompatActivity {
EditText editPhone,editPassword;
Button btnSignIn;
CheckBox ckbRemember;
TextView txtForgotPwd;
FirebaseDatabase database;
DatabaseReference table_user;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sign_in);
editPassword = (MaterialEditText)findViewById(R.id.editPassword);
editPhone = (MaterialEditText)findViewById(R.id.editPhone);
btnSignIn = (Button)findViewById(R.id.btnSignIn1);
ckbRemember = (CheckBox)findViewById(R.id.ckbRemember);
txtForgotPwd = (TextView) findViewById(R.id.txtForgotPwd);
"Caused by: java.lang.ClassCastException: android.support.v7.widget.AppCompatTextView cannot be cast to com.rey.material.widget.TextView"
Check your imports in SignIn.java. You are probably importing com.rey.material.widget.TextView instead of android.widget.TextView.
If you want to use the com.rey TextView instead of the normal one you have to write
<com.rey.material.widget.TextView
android:id="#+id/txtForgotPwd"
android:textColor="#android:color/white"
...
in your xml.
I have a textView, but when I try to set it's value to an EditText, it says that the textView is final. When I change it to not be final, an error occurs stating that textView needs an int. Why would it do this, and how can I change it so that it will take in the text in EditText? Here is the code for the class where I am trying to set the value for the textView:
public class MainScreen extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_screen);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
R.id.textView12 = R.id.editText3;
}
}
Here is the xml activity where textView is created:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context="com.kalyannath.cancerapp.cancerapp20.MainScreen"
tools:showIn="#layout/activity_main_screen">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="User Control Panel"
android:id="#+id/textView4"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Your Cancer:"
android:id="#+id/textView11"
android:layout_below="#+id/textView4"
android:layout_centerHorizontal="true"
android:layout_marginTop="54dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Small Text"
android:id="#+id/textView12"
android:layout_below="#+id/textView11"
android:layout_centerHorizontal="true"
android:editable="true"
android:enabled="false"
android:inputType="text" />
</RelativeLayout>
Here is the code where the EditText is:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context="com.kalyannath.cancerapp.cancerapp20.GetInformation"
tools:showIn="#layout/activity_get_information">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Please fill out the information below"
android:id="#+id/textView5"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Which type of cancer do you have?"
android:id="#+id/textView6"
android:layout_below="#+id/textView5"
android:layout_centerHorizontal="true"
android:layout_marginTop="47dp" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/editText3"
android:layout_below="#+id/textView6"
android:layout_centerHorizontal="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="What is your age?"
android:id="#+id/textView7"
android:layout_below="#+id/editText3"
android:layout_centerHorizontal="true" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/editText4"
android:layout_below="#+id/textView7"
android:layout_centerHorizontal="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Male or female?"
android:id="#+id/textView8"
android:layout_below="#+id/editText4"
android:layout_centerHorizontal="true" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/editText5"
android:layout_below="#+id/textView8"
android:layout_centerHorizontal="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Which stage?"
android:id="#+id/textView9"
android:layout_below="#+id/editText5"
android:layout_centerHorizontal="true" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/editText6"
android:layout_below="#+id/textView9"
android:layout_centerHorizontal="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Which receptor does your cancer act on? You mau need to ask your doctor"
android:id="#+id/textView10"
android:layout_below="#+id/editText6"
android:layout_centerHorizontal="true" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/editText7"
android:layout_below="#+id/textView10"
android:layout_centerHorizontal="true" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Submit"
android:id="#+id/button3"
android:layout_below="#+id/editText7"
android:layout_centerHorizontal="true"
android:layout_marginTop="59dp" />
</RelativeLayout>
What is happening? Thanks!
Instead of
R.id.textView12 = R.id.editText3;
Use
Textview tv =(TextView)findviewbyid(R.id.textView12);
EditText et =(EditText) findviewbyid(R.id.editText3);
to set content of edittext to textview use
tv.setText(et.getText().toString());
This Might Help You Out...
Reason
you are doing the set of text wrongly
R.id.textView12 = R.id.editText3;
this is trying to manipulate the ids in the android app,
QuickFix
instead use:
textView.setText(editTextString);
Textview textView12=(TextView)findviewbyid(R.id.textView12);
EditText editText3=(EditText)findviewbyid(R.id.editText3);
here is your answer
String text=textView12.getText().toString();
editText3.setText(text);
or
editText3.setText(textView12.getText().toString());
i hope this solves your problem
R.id.textView12 = R.id.editText3;
If this is how you are setting the text of EditText in TextView, it is wrong.
To set text in TextView you have to use setText() method.
example;
//Refering to you edit text
EditText editText = (EditText) findViewById(R.id.editText3);
//Refering to you TextView
TextView textView = (TextView) findViewById(R.id.textView12);
//getting text from edit text
String editTextString = editText.getText();
//setting text to TextView
textView.setText(editTextString);
try this, this will work.
and I recommend you to learn the basics of android/java programming.
I am new in android application here..And my apps cant event run,and i just dont know why..The logcat there keep showing this
android.widget.text view cannot be cast to android.widget.Button
here is my code in mainactivity.java
package com.loginandregister;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
// setting default screen to login.xml
setContentView(R.layout.main);
Button registerScreen = (Button) findViewById(R.id.link_to_register);
// Listening to register new account link
registerScreen.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Switching to Register screen
Intent i = new Intent(getApplicationContext(), RegisterActivity.class);
startActivity(i);
}
});
Button loginScreen = (Button) findViewById (R.id.link_to_login);
// Listening to register new account link
loginScreen.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Switching to Register screen
Intent i = new Intent(getApplicationContext(), LoginActivity.class);
startActivity(i);
}
});
}
}
login.xml
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ffffff">
<!-- Header Starts-->
<LinearLayout
android:id="#+id/header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#layout/header_gradient"
android:orientation="vertical"
android:paddingBottom="5dip"
android:paddingTop="5dip" >
<!-- Logo Start-->
<ImageView android:src="#drawable/logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"/>
<!-- Logo Ends -->
</LinearLayout>
<!-- Header Ends -->
<!-- Footer Start -->
<LinearLayout android:orientation="horizontal"
android:id="#+id/footer"
android:layout_width="fill_parent"
android:layout_height="90dip"
android:background="#layout/footer_repeat"
android:layout_alignParentBottom="true">
</LinearLayout>
<!-- Footer Ends -->
<!-- Login Form -->
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dip"
android:layout_below="#id/header">
<!-- Email Label -->
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#372c24"
android:text="Email"/>
<EditText android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:layout_marginBottom="20dip"
android:singleLine="true" />
<!-- Password Label -->
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#372c24"
android:text="Password"/>
<EditText android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:singleLine="true"
android:password="true"/>
<!-- Login button -->
<Button android:id="#+id/btnLogin"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:text="Login"/>
<!-- Link to Registration Screen -->
<TextView
android:id="#+id/link_to_register"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="40dip"
android:layout_marginTop="40dip"
android:gravity="center"
android:text="New to Plot Out?Register here"
android:textColor="#0b84aa"
android:textSize="20sp" />
</LinearLayout>
<!-- Login Form Ends -->
</RelativeLayout>
</ScrollView>
register.xml
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" android:background="#fff">
<!-- Header Starts-->
<LinearLayout android:id="#+id/header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#layout/header_gradient"
android:paddingTop="5dip"
android:paddingBottom="5dip">
<!-- Logo Start-->
<ImageView android:src="#drawable/logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"/>
<!-- Logo Ends -->
</LinearLayout>
<!-- Header Ends -->
<!-- Footer Start -->
<LinearLayout android:id="#+id/footer"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="90dip"
android:background="#layout/footer_repeat"
android:layout_alignParentBottom="true">
</LinearLayout>
<!-- Footer Ends -->
<!-- Registration Form -->
<!-- Registration Form Ends -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:orientation="vertical"
android:padding="10dip" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Full Name"
android:textColor="#372c24" />
<EditText
android:id="#+id/reg_fullname"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dip"
android:layout_marginTop="5dip"
android:singleLine="true" >
<requestFocus />
</EditText>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Email"
android:textColor="#372c24" />
<EditText
android:id="#+id/reg_email"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dip"
android:layout_marginTop="5dip"
android:singleLine="true" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Password"
android:textColor="#372c24" />
<EditText
android:id="#+id/reg_password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:password="true"
android:singleLine="true" />
<Button
android:id="#+id/btnRegister"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:text="Register New Account" />
<TextView
android:id="#+id/link_to_login"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="40dip"
android:layout_marginTop="40dip"
android:gravity="center"
android:text="Already has account! Login here"
android:textColor="#ffffff"
android:textSize="15sp" />
</LinearLayout>
</RelativeLayout>
</ScrollView>
main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/images" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView1"
android:layout_alignTop="#+id/textView1"
android:layout_marginTop="34dp"
android:text="Bring Me Out"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginBottom="56dp"
android:text="Plot Out"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/textView2"
android:layout_centerHorizontal="true"
android:layout_marginBottom="134dp"
android:text="Forgot Your Password?"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Button
android:id="#+id/link_to_login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/link_to_register"
android:layout_centerHorizontal="true"
android:text="Login" />
<Button
android:id="#+id/link_to_register"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/link_to_login"
android:text="Register" />
>
</RelativeLayout>
So all expect here,anybody can help me on this???
Thank in advance
Add
Button registerScreen = (Button) findViewById(R.id.btnLogin);
Button loginScreen = (Button) findViewById (R.id.btnRegister);
instead of
Button registerScreen = (Button) findViewById(R.id.link_to_register);
`Button loginScreen = (Button) findViewById (R.id.link_to_login);`
you are casting the ID's of textViews instead of buttons.
OR
Change the ID name of buttons in main.xml ..
Your local variable loginScreen is of type Button, but you are calling findViewById() with the id of a TextView. Use R.id.btnRegister if you really want to hook the button before the text field.
i am currently developing a mobile application using eclipse. right now o am facing problem for bringing checked check box to new page...
this is code for the check box page...
page name : mcpakej1.xml
` <?xml version="1.0" encoding="utf-8"?>
<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:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:layout_centerHorizontal="true"
tools:context="com.example.mobilecatering.MainActivity" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<CheckBox
android:id="#+id/pakejA1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView2"
android:layout_below="#+id/textView2"
<CheckBox
android:id="#+id/pakejA2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/nasiputih1"
android:layout_below="#+id/nasiputih1"
android:text="Nasi Beriyani" />
<CheckBox
android:id="#+id/pakejA3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/nasiberiyani1"
android:layout_below="#+id/nasiberiyani1"
android:text="Nasi Minyak" />
<CheckBox
android:id="#+id/pakejA4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView3"
android:layout_below="#+id/textView3"
android:text="Ayam Masak Kurma" />
<CheckBox
android:id="#+id/pakejA5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/ayamkurma1"
android:layout_below="#+id/ayamkurma1"
android:text="Ayam Masak Lemak" />
<CheckBox
android:id="#+id/pakejA6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/ayamlemak1"
android:layout_below="#+id/ayamlemak1"
android:text="Ayam Kari" />
<CheckBox
android:id="#+id/pakejA7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/ayamkari1"
android:layout_below="#+id/ayamkari1"
android:text="Ayam Rendang" />
<CheckBox
android:id="#+id/pakejA8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/ayamrendang1"
android:layout_below="#+id/ayamrendang1"
android:text="Ayam Masak Merah" />
<CheckBox
android:id="#+id/pakejA9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView4"
android:layout_below="#+id/textView4"
android:text="Perut Air Asam" />
<CheckBox
android:id="#+id/pakejA10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="#+id/perutairasam1"
android:layout_below="#+id/perutairasam1"
android:text="Daging Masak Tomato" />
<CheckBox
android:id="#+id/pakejA11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/dagingtomato1"
android:layout_below="#+id/dagingtomato1"
android:text="Daging Masak Singgang" />
<CheckBox
android:id="#+id/pakejA12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/dagingsinggang1"
android:layout_below="#+id/dagingsinggang1"
android:text="Daging Masak Merah" />
<CheckBox
android:id="#+id/pakejA13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView5"
android:layout_below="#+id/textView5"
android:text="Kerabu Taugeh" />
<CheckBox
android:id="#+id/pakejA14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="#+id/kerabutaugeh1"
android:layout_below="#+id/kerabutaugeh1"
android:text="Pindang Kacang Panjang" />
<CheckBox
android:id="#+id/pakejA15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/pindangkacang1"
android:layout_below="#+id/pindangkacang1"
android:text="Jelatah" />
<CheckBox
android:id="#+id/pakejA16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/jelatah1"
android:layout_below="#+id/jelatah1"
android:text="Dalca Sayur" />
<CheckBox
android:id="#+id/pakejA17"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/dalcasayur1"
android:layout_below="#+id/dalcasayur1"
android:text="Papadom" />
<CheckBox
android:id="#+id/pakejA18"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView6"
android:layout_below="#+id/textView6"
android:text="Kari Ikan" />
<CheckBox
android:id="#+id/pakejA19"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="#+id/pakejA18"
android:layout_below="#+id/kariikan1"
android:text="Kari Ikan Masin dan Nenas" />
<CheckBox
android:id="#+id/pakejA20"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView7"
android:layout_below="#+id/textView7"
android:text="Sirap Ais" />
<CheckBox
android:id="#+id/pakejA21"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/sirapais1"
android:layout_below="#+id/sirapais1"
android:text="Oren" />
<CheckBox
android:id="#+id/pakejA22"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/pakejA21"
android:layout_below="#+id/pakejA21"
android:text="Teh Tarik" />
<CheckBox
android:id="#+id/pakejA23"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView8"
android:layout_below="#+id/textView8"
android:text="Agar - Agar" />
<CheckBox
android:id="#+id/pakejA24"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/agaragar1"
android:layout_below="#+id/agaragar1"
android:text="Bubur Kacang Hijau" />
<CheckBox
android:id="#+id/pakejA25"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/buburkacanghijau1"
android:layout_below="#+id/buburkacanghijau1"
android:text="Kuih Muih" />
<ImageButton
android:id="#+id/gobutton"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignTop="#+id/homebtn"
android:layout_toRightOf="#+id/homebtn"
android:background="#drawable/gobutton"
android:onClick="goReceipt" />
</LinearLayout>
</ScrollView></RelativeLayout>`
this is the process in java.
page name : mcpakej1.java
`package com.example.mobilecatering;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.CheckBox;
public class mcpakej1 extends Activity
{
CheckBox nsPutih,nsBeriyani,nsMinyak,aymKurma,aymLemak,aymKari,aymRendang,aymMerah,prtAsam, dggTomato, dggSinggang, dggMerah,kerabuTaugeh, pindangKacang,jelatah,dalcaSayur,papadom,kariIkan,ikanMasin, sirapAis, oren,tehTarik,agarAgar, buburKacang,kuih;
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.mcpakej1);
nsPutih = (CheckBox) findViewById(R.id.pakejA1);
nsBeriyani = (CheckBox) findViewById(R.id.pakejA2);
nsMinyak = (CheckBox) findViewById(R.id.pakejA3);
aymKurma = (CheckBox) findViewById(R.id.pakejA4);
aymLemak = (CheckBox) findViewById(R.id.pakejA5);
aymKari = (CheckBox) findViewById(R.id.pakejA6);
aymRendang = (CheckBox) findViewById(R.id.pakejA7);
aymMerah = (CheckBox) findViewById(R.id.pakejA8);
prtAsam = (CheckBox) findViewById(R.id.pakejA9);
dggTomato = (CheckBox) findViewById(R.id.pakejA10);
dggSinggang = (CheckBox) findViewById(R.id.pakejA11);
dggMerah = (CheckBox) findViewById(R.id.pakejA12);
kerabuTaugeh = (CheckBox) findViewById(R.id.pakejA13);
pindangKacang = (CheckBox) findViewById(R.id.pakejA14);
jelatah = (CheckBox) findViewById(R.id.pakejA15);
dalcaSayur = (CheckBox) findViewById(R.id.pakejA16);
papadom = (CheckBox) findViewById(R.id.pakejA17);
kariIkan = (CheckBox) findViewById(R.id.pakejA18);
ikanMasin = (CheckBox) findViewById(R.id.pakejA19);
sirapAis = (CheckBox) findViewById(R.id.pakejA20);
oren = (CheckBox) findViewById(R.id.pakejA21);
tehTarik = (CheckBox) findViewById(R.id.pakejA22);
agarAgar = (CheckBox) findViewById(R.id.pakejA23);
buburKacang = (CheckBox) findViewById(R.id.pakejA24);
kuih = (CheckBox) findViewById(R.id.pakejA25);
}
public void goHome(View v){
{
Intent intent = new Intent(v.getContext(), MainActivity.class);
startActivityForResult(intent,0);}
}
public void goReceipt(View v)
{
Intent intent = new Intent(v.getContext(), doReceipt.class);
intent.putExtra("nsBeriyani", nsBeriyani.isChecked());
intent.putExtra("nsPutih", nsPutih.isChecked());
intent.putExtra("nsMinyak", nsMinyak.isChecked());
intent.putExtra("aymKurma", aymKurma.isChecked());
intent.putExtra("aymKari", aymKari.isChecked());
intent.putExtra("aymRendang", aymRendang.isChecked());
intent.putExtra("aymMerah", aymMerah.isChecked());
intent.putExtra("prtAsam", prtAsam.isChecked());
intent.putExtra("dggTomato", dggTomato.isChecked());
intent.putExtra("dggSinggang", dggSinggang.isChecked());
intent.putExtra("dggMerah", dggMerah.isChecked());
intent.putExtra("kerabuTaugeh", kerabuTaugeh.isChecked());
intent.putExtra("pindangKacang", pindangKacang.isChecked());
intent.putExtra("jelatah", jelatah.isChecked());
intent.putExtra("dalcaSayur", dalcaSayur.isChecked());
intent.putExtra("papadom", papadom.isChecked());
intent.putExtra("kariIkan", kariIkan.isChecked());
intent.putExtra("ikanMasin", ikanMasin.isChecked());
intent.putExtra("sirapAis", sirapAis.isChecked());
intent.putExtra("oren", oren.isChecked());
intent.putExtra("tehTarik", tehTarik.isChecked());
intent.putExtra("agarAgar", agarAgar.isChecked());
intent.putExtra("buburKacang", buburKacang.isChecked());
intent.putExtra("kuih", kuih.isChecked());
startActivityForResult(intent,0);
}
}`
after user click button id goButton, this page will do this process.
page name = doReceipt.java
package com.example.mobilecatering;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class doReceipt extends Activity
{
boolean nsPutih, nsBeriyani,nsMinyak,aymKurma,aymLemak,aymKari,aymRendang,aymMerah,prtAsam, dggTomato, dggSinggang, dggMerah,kerabuTaugeh, pindangKacang,jelatah,dalcaSayur,papadom,kariIkan,ikanMasin, sirapAis, oren,tehTarik,agarAgar, buburKacang,kuih;
TextView tvOutput;
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.receipt);
tvOutput = (TextView) findViewById(R.id.textView1);
tvOutput = (TextView) findViewById(R.id.textView2);
tvOutput = (TextView) findViewById(R.id.textView3);
tvOutput = (TextView) findViewById(R.id.textView4);
tvOutput = (TextView) findViewById(R.id.textView5);
tvOutput = (TextView) findViewById(R.id.textView6);
tvOutput = (TextView) findViewById(R.id.textView7);
tvOutput = (TextView) findViewById(R.id.textView8);
tvOutput = (TextView) findViewById(R.id.textView9);
tvOutput = (TextView) findViewById(R.id.textView10);
tvOutput = (TextView) findViewById(R.id.textView11);
tvOutput = (TextView) findViewById(R.id.textView12);
tvOutput = (TextView) findViewById(R.id.textView13);
tvOutput = (TextView) findViewById(R.id.textView14);
tvOutput = (TextView) findViewById(R.id.textView15);
tvOutput = (TextView) findViewById(R.id.textView16);
tvOutput = (TextView) findViewById(R.id.textView17);
tvOutput = (TextView) findViewById(R.id.textView18);
tvOutput = (TextView) findViewById(R.id.textView19);
tvOutput = (TextView) findViewById(R.id.textView20);
tvOutput = (TextView) findViewById(R.id.textView21);
tvOutput = (TextView) findViewById(R.id.textView22);
tvOutput = (TextView) findViewById(R.id.textView23);
tvOutput = (TextView) findViewById(R.id.textView24);
tvOutput = (TextView) findViewById(R.id.textView25);
Bundle data = this.getIntent().getExtras();
nsPutih=data.getBoolean("nsPutih");
nsBeriyani=data.getBoolean("nsBeriyani");
nsMinyak=data.getBoolean("nsMinyak");
aymKurma=data.getBoolean("aymKurma");
aymLemak=data.getBoolean("aymLemak");
aymKari=data.getBoolean("aymKari");
aymRendang=data.getBoolean("aymRendang");
aymMerah=data.getBoolean("aymMerah");
prtAsam=data.getBoolean("prtAsam");
dggTomato=data.getBoolean("dggTomato");
dggSinggang=data.getBoolean("dggSinggang");
dggMerah=data.getBoolean("dggMerah");
kerabuTaugeh=data.getBoolean("kerabuTaugeh");
pindangKacang=data.getBoolean("pindangKacang");
jelatah=data.getBoolean("jelatah");
dalcaSayur=data.getBoolean("dalcaSayur");
papadom=data.getBoolean("papadom");
kariIkan=data.getBoolean("kariIkan");
ikanMasin=data.getBoolean("ikanMasin");
sirapAis=data.getBoolean("sirapAis");
oren=data.getBoolean("oren");
tehTarik=data.getBoolean("tehTarik");
agarAgar=data.getBoolean("agarAgar");
buburKacang=data.getBoolean("buburKacang");
kuih=data.getBoolean("kuih");
if(nsPutih==true)
{
tvOutput.setText("Nasi Putih");
}
if (nsBeriyani==true)
{
tvOutput.setText("Nasi Beriyani");
}
if (nsMinyak==true)
{
tvOutput.setText("Nasi Minyak");
}
if(aymKurma==true)
{
tvOutput.setText("Ayam Masak Kurma");
}
if (aymLemak==true)
{
tvOutput.setText("Ayam Masak Lemak");
}
if (aymKari==true)
{
tvOutput.setText("Ayam Masak Kari");
}
if (aymRendang==true)
{
tvOutput.setText("Ayam Masak Rendang");
}
if (aymMerah==true)
{
tvOutput.setText("Ayam Masak Merah");
}
if (prtAsam==true)
{
tvOutput.setText("Perut Air Asam");
}
if (dggTomato==true)
{
tvOutput.setText("Daging Masak Tomato");
}
if (dggSinggang==true)
{
tvOutput.setText("Daging Masak Singgang");
}
if (dggMerah==true)
{
tvOutput.setText("Daging Masak Merah");
}
if (kerabuTaugeh==true)
{
tvOutput.setText("Kerabu Taugeh");
}
if (pindangKacang==true)
{
tvOutput.setText("Pindang Kacang");
}
if (jelatah==true)
{
tvOutput.setText("Jelatah");
}
if (dalcaSayur==true)
{
tvOutput.setText("Dalca Sayur");
}
if (papadom==true)
{
tvOutput.setText("Papadom");
}
if (kariIkan==true)
{
tvOutput.setText("Kari Ikan");
}
if (ikanMasin==true)
{
tvOutput.setText("Kari Ikan Masin");
}
if (sirapAis==true)
{
tvOutput.setText("Sirap Ais");
}
if (oren==true)
{
tvOutput.setText("Oren");
}
if (tehTarik==true)
{
tvOutput.setText("Teh Tarik");
}
if (agarAgar==true)
{
tvOutput.setText("Agar Agar");
}
if (buburKacang==true)
{
tvOutput.setText("Bubur Kacang");
}
if (kuih==true)
{
tvOutput.setText("Kuih Muih");
}
}
}
this is the page where the checked check box should display text...
page name : receipt.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="14dp"
android:layout_marginTop="62dp"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="#+id/textView1"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView2"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView3"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="#+id/textView4"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView5"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView6"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="#+id/textView7"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView8"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView9"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView10"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="#+id/textView11"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView12"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView13"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="#+id/textView14"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView15"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView17"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView16"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView18"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView17"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView19"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView18"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView20"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView19"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView21"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView20"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView22"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView21"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView23"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView22"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView24"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView23"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView25"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView24"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
</ScrollView></RelativeLayout>
when i run eclipse's emulator, the page receipt.xml only display 1 checkbox value even if i checked on many checkbox.
help plz....tq
i tick on the checkbox Ayam Masak kurma and daging masak merah....
the output turn to be this way....
Ayam Masak Kurma
Daging Masak Merah
there are lot of spaces there...can u help me...i cannot upload the image of the emulator here...it says that i must get 10 point to post images....
The white spaces between your textviews are textviews that arent hidden, try to hide them when you have no data for them like:
if(nsPutih==true) {
tvOutput1.setText("Nasi Putih");
tvOutput1.setVisibility(View.VISIBLE);
} else {
tvOutput1.setVisibility(View.GONE);
}
However this is bad practice, you should try to dynamically create the textviews by putting them in a ListView. Also try to pass the data to the activity using a Map of objects.
with your intent try to pass your values with putextra and getextra method it will work