When the button is pressed the app is crashing - android

I am trying to run an app and when I try to tap the button the app crashes when it is supposed to save data for backup
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.back4app.userregistrationexample, PID: 31963
java.lang.IllegalStateException: Could not find method onclick(View) in a parent or ancestor Context for android:onClick attribute defined on view class android.support.v7.widget.AppCompatButton with id 'btn_addbalance'
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.resolveMethod(AppCompatViewInflater.java:423)
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:380)
at android.view.View.performClick(View.java:6329)
at android.view.View$PerformClick.run(View.java:25002)
at android.os.Handler.handleCallback(Handler.java:809)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:166)
at android.app.ActivityThread.main(ActivityThread.java:7555)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:469)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:963)
I/Process: Sending signal. PID: 31963 SIG: 9
Application terminated.
Here in the balance I only put the code that I think is needed but if the whole class is needed I will edit it too
Balance
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.app_bar_balance);
Parse.initialize(new Parse.Configuration.Builder(this)
.applicationId("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
.clientKey("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
.server("https://parseapi.back4app.com/").build()
);
LiveQueryClient.init("wss://" + "aaaa.back4app.io", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", true); // Example: 'wss://livequerytutorial.back4app.io'
LiveQueryClient.connect();
Balance = (EditText) findViewById(R.id.txt_editbalance);
final Button addbalance = findViewById(R.id.btn_addbalance);
addbalance.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
//Validating the log in data
boolean validationError = false;
StringBuilder validationErrorMessage = new StringBuilder("Please, insert ");
if (isEmpty(Balance)) {
validationError = true;
validationErrorMessage.append("an balance");
}
validationErrorMessage.append(".");
if (validationError) {
Toast.makeText(Balance.this, validationErrorMessage.toString(), Toast.LENGTH_LONG).show();
return;
}
//Setting up a progress dialog
final ProgressDialog dlg = new ProgressDialog(Balance.this);
dlg.setTitle("Please, wait a moment.");
dlg.setMessage("Adding Load...");
dlg.show();
ParseUser balance = new ParseUser();
balance.setUsername(Balance.getText().toString());
balance.signUpInBackground(new SignUpCallback() {
#Override
public void done(ParseException e) {
if (e == null) {
dlg.dismiss();
} else {
dlg.dismiss();
ParseUser.logOut();
Toast.makeText(Balance.this, e.getMessage(), Toast.LENGTH_LONG).show();
}
}
});
}
});
}
I tried to change the names switching it back and forth hoping that it might fix the problem
app bar balance
<?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">
<TextView
android:id="#+id/txt_currentbal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="59dp"
android:text="Current Balance" />
<TextView
android:id="#+id/txt_balance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="96dp"
android:text="android:id" />
<TextView
android:id="#+id/txt_addbal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="185dp"
android:text="Add Balance" />
<EditText
android:id="#+id/txt_editbalance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="230dp"
android:ems="10"
android:hint="Add Balance"
android:inputType="number" />
<Button
android:id="#+id/btn_addbalance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="177dp"
android:onClick="onclick"
android:text="Add Balance" />
</RelativeLayout>
Now I removed the android:onClick="onclick" and now it looks like this but when I run it again on my phone now it doesn't do anything and the run doesn't even respond when the button is pressed

You already set ClickListener from your from your code. So button onClick attribute not needed.
Just remove this line from the Button.
android:onClick="onclick"
It will look like this
<Button
android:id="#+id/btn_addbalance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="177dp"
android:text="Add Balance" />
This will solve your problem.

In your XML you use a button from the support library (widget.AppCompatButton), but in your code you're trying to cast it to a regular Button. Either use the regular Button in your XML code, or use the AppCompatButton in the Java code.
Seeing that you are using the support library (you're using the AppCompatActivity), I'd advice you to change 'Button' to 'AppCompatButton' in your Java code.

put onclick() method in the button view of your xml

If you want to use in XML onClick then use like this :
<Button
android:id="#+id/btn_addbalance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="177dp"
android:onClick="onClick"
android:text="Add Balance" />
you have entered in wrong format
do this : "onClick"
instead of : "onclick"
you can check in logcats it's shows also same thing in it, So change it :
Could not find method onclick(View) in a parent or ancestor Context for android:onClick attribute defined on view class android.support.v7.widget.AppCompatButton with id 'btn_addbalance'
by the way there is no need to add attribute in xml if you are doing in java

Related

how to add buttons that appear dynamically in a dialog using android studio

I have a dialog that shows an error message,
i know i can take that error message and just make it invisible, and visible in the code,
but then the Dialog would still save room in it and it will just show as a white space.
I want the error message to be added dynamical so if no error message will be shown the dialog will be sized accordingly.
how do i do that ?
here is my Dialog >
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.design.widget.TextInputLayout
android:id="#+id/textContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:counterEnabled="true"
app:counterMaxLength="14">
<EditText
android:id="#+id/barcode_activity_input_editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:ems="10"
android:hint="Enter Serial Number"
android:inputType="number"
android:maxLength="14" />
</android.support.design.widget.TextInputLayout>
<Button
android:id="#+id/barcode_activity_button_cancel"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_below="#+id/barcode_activity_manual_input_check_box"
android:text="Cancel" />
<Button
android:id="#+id/barcode_activity_button_ok"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_below="#+id/barcode_activity_manual_input_check_box"
android:layout_toEndOf="#+id/barcode_activity_button_cancel"
android:text="Ok" />
<TextView
android:id="#+id/barcode_activity_text_view_warning"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/textContainer"
android:layout_toRightOf="#+id/barcode_activity_image_view_warning"
android:paddingTop="5dp"
android:text="Serial doesn't match Workorder"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#f00000"
android:textSize="13dp" />
<ImageView
android:id="#+id/barcode_activity_image_view_warning"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_below="#+id/textContainer"
android:background="#drawable/warning" />
<CheckBox
android:id="#+id/barcode_activity_manual_input_check_box"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_below="#+id/barcode_activity_image_view_warning"
android:text="Allow Serial In Workorder"
android:textSize="13dp" />
</RelativeLayout>
and here is my main file >
inputFieldDialog = new Dialog(this); // CASTING
//inputFieldDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
inputFieldDialog.setContentView(R.layout.aligment_manager_manual_input_layout); // INFLATING VIEW
Button cancelInputButton, confirmInputButton; //declaring BOXES
final EditText inputField;
TextView warningTextView;
ImageView warningImageView;
CheckBox warningCheckBox;
cancelInputButton = (Button) inputFieldDialog.findViewById(R.id.barcode_activity_button_cancel); //casting
confirmInputButton = (Button) inputFieldDialog.findViewById(R.id.barcode_activity_button_ok); //casting
inputField = (EditText) inputFieldDialog.findViewById(R.id.barcode_activity_input_editText); //casting
warningTextView = (TextView) inputFieldDialog.findViewById(R.id.barcode_activity_text_view_warning); //casting
warningImageView = (ImageView) inputFieldDialog.findViewById(R.id.barcode_activity_image_view_warning); //casting
warningCheckBox = (CheckBox) inputFieldDialog.findViewById(R.id.barcode_activity_manual_input_check_box); //casting
warningTextView.setVisibility(TextView.INVISIBLE); //sets warnings invisible
warningImageView.setVisibility(ImageView.INVISIBLE); //sets warnings invisible
warningCheckBox.setVisibility(CheckBox.INVISIBLE); //sets warnings invisible
cancelInputButton.setOnClickListener(new View.OnClickListener() { //listeners for the buttons
#Override
public void onClick(View v) {
inputFieldDialog.hide();
}
});
confirmInputButton.setOnClickListener(new View.OnClickListener() { //listeners for the buttons
#Override
public void onClick(View v) {
scanResults = String.valueOf(inputField.getText());
scanBarcodeText.setText(inputField.getText());
editor.putString("boxID", String.valueOf(inputField.getText())); //saves the data as antenaNamein shared prefrences
editor.commit();
if (checkIfIdMatched(String.valueOf(inputField.getText())) == true) { //checkks if id is maching the one in the workorder
aligmentManagerClass.scanFromBarcodeApproved(); //ID MACHED
if (mainDialog != null) {
mainDialog.show();
}
loaderScreenMainText.setText("initlizing WiFi");//shows the user on screen message
wifiWrapper myWifiWrapper = new wifiWrapper(); //- INIZILIZING WIFI
myWifiWrapper.checkWifiState(getApplication(), callbackFunctionForisWifiOn);
} else {
loaderScreenMainText.setText("Scan Doesn't Match Data In Workoder"); // notify onScreen User
if (mainDialog != null) { // hides the loading dialog
mainDialog.hide();
}
AlertDialog wrongNumberDialog = getAlertDialogForWrongId(); //shows to user alert dialog for Wrong Number
wrongNumberDialog.show(); // show it
}
}
For remove white space...
Use "View.GONE" property of setVisibility() method rather than "TextView.INVISIBLE".
Set below code for hide views
warningTextView.setVisibility(View.GONE);
warningImageView.setVisibility(View.GONE);
warningCheckBox.setVisibility(View.GONE);
And for visible view just user
warningTextView.setVisibility(View.VISIBLE);
warningImageView.setVisibility(View.VISIBLE);
warningCheckBox.setVisibility(View.VISIBLE);
You can add buttons dynamically by creating buttons in Java file
Add this XML to dialog like dialog.addView(...)
Then Create Dynamically Buttons by according to values like
for(){
Create Buttons and add to above layout
layout.addView(button);
}
Hope it will help.

RippleView effect on view appears late android

I am using com.andexert.library.RippleViewlibrary from Here's a link
Its working but not as expected . The ripple effect appears late i.e; when I click on TextView the Activity gets launched , then the ripple effect appears on the TextView of previous activity.
Also it shows error " cannot resolve method setOnRippleCompleteListener() "
xml file
<com.andexert.library.RippleView
android:id="#+id/ripple_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
rv_centered="true"
android:padding="0dp"
android:layout_alignParentBottom="true">
<com.techmorphosis.Utils.TextViewCustomFont
android:id="#+id/txt_lets_go"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#color/white_text"
android:background="#drawable/purple_button_bg"
android:gravity="center"
android:padding="10dp"
android:text="#string/lets_go"
android:textSize="#dimen/textsize_medium" />
</com.andexert.library.RippleView>
java file
rippleView.setOnRippleCompleteListener(new RippleView.OnRippleCompleteListener() {
// #Override
public void onComplete(RippleView rippleView) {
Log.d("Sample", "Ripple completed");
}
});
I solved this by placing the view id's click event inside rippleView.setOnRippleCompleteListener
Eg :
rippleviewNavigation.setOnRippleCompleteListener(new RippleView.OnRippleCompleteListener() {
#Override
public void onComplete(RippleView rippleView) {
if(id==R.id.txt_open){
// do stuffs here
}
}

Android: Unable to Prevent buttons from increasing size and overlapping with other buttons

I am new to Android Programming, what I am trying to do in this Android Application is to create a xml page filled with buttons.
When I click the button, the button would change to light green color and when I click it again, it would change to light grey
The error: I am getting is when I click the button, it increases in size and overlaps with the other buttons, please help me out here, it is not user friendly in this case
attached below is the code:
lockerbooking.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button
android:id="#+id/sisButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="16dp"
android:layout_marginTop="28dp"
android:text="#string/sis"
/>
<Button
android:id="#+id/solButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/soeButton"
android:layout_alignBottom="#+id/soeButton"
android:layout_alignParentRight="true"
android:text="#string/sol" />
<Button
android:id="#+id/soeButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/sisButton"
android:layout_alignBottom="#+id/sisButton"
android:layout_centerHorizontal="true"
android:text="#string/soe" />
</RelativeLayout>
Code:
makeBooking.java
public class makeBooking extends Activity {
Button sisButton;
Button solButton;
Button soeButton;
Button sobButton;
super.onCreate(savedInstanceState);
// Get the message from the intent
setContentView(R.layout.lockerbookpage);
Intent intent = getIntent();
// Initialize TextViews
sisButton = (Button) findViewById(R.id.sisButton);
solButton = (Button) findViewById(R.id.solButton);
soeButton = (Button) findViewById(R.id.soeButton);
sobButton = (Button) findViewById(R.id.sobButton);
}
public OnClickListener solButtonListener = new OnClickListener(){
boolean flag = true;
public void onClick(View arg0) {
// TODO Auto-generated method stub
if(flag){
solButton.setBackgroundColor(Color.GREEN);
}
else{
solButton.setBackgroundColor(Color.LTGRAY);
}
flag=!flag;
}
};
...The code goes on
Please help me out here, I am eager to learn
to avoid overlapping of buttons, use fixed width and height for buttons:
change this:
android:layout_width="wrap_content"
android:layout_height="wrap_content"
to some this like this:
android:layout_width="100dp" //what ever size suits your layout
android:layout_height="50dp" //fixing this,will not overlap the buttons

use checkbox to send textview value to another activity using image button onclick

i am making a program, in which i am using 3 checkboxes for the item variations along with 3 textviews for their prices, now i want to know, whenever user will click on checkbox1 then price appears in textview1 send to next activity, like in second activity you have selected : checkbox1 $2.00,i want to do this using image button for add to order, please write some brief code how is it possible for me. Here i am placing main.xml code:-
<TextView
android:id="#+id/regular"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/var1"
android:layout_marginLeft="40dp"
android:text="$2.00"
android:textColor="#343434"
android:textSize="15dip" />
<CheckBox
android:id="#+id/var2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/cost"
android:layout_toRightOf="#+id/var1"
android:text="Small" />
<TextView
android:id="#+id/small"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/var2"
android:layout_toRightOf="#+id/var1"
android:layout_marginLeft="40dp"
android:text="$1.00"
android:textColor="#343434"
android:textSize="15dip" />
<CheckBox
android:id="#+id/var3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/cost"
android:layout_toRightOf="#+id/var2"
android:text="Large" />
<TextView
android:id="#+id/large"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/var3"
android:layout_toRightOf="#+id/var2"
android:layout_marginLeft="40dp"
android:text="$3.00"
android:textColor="#343434"
android:textSize="15dip" />
<ImageButton
android:id="#+id/add_order"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="#drawable/add_order" />
You need to add an onClickListener to your ImageButton. Now if the onClick method is called retrieve the state of the checkboxes and determine the price of the item.
This price can now be added to the Intent that you use to start the next Activity.
Use the setExtra and getExtra Methods of the Intent class as explained in this Tutorial
Try this code
public class MainActivity extends Activity {
private ImageButton btn;
private TextView txtSmall, txtMed,txtLarge;
private CheckBox chkSmall, chkLarge;
private String strSmall, strLarge;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Checkbox Declaration
chkSmall = (CheckBox)findViewById(R.id.var2);
chkLarge = (CheckBox)findViewById(R.id.var3);
//TextView Declaration
txtSmall = (TextView)findViewById(R.id.small);
txtLarge = (TextView)findViewById(R.id.large);
//ImageButton
btn = (ImageButton)findViewById(R.id.add_order);
//RESET VALUES
strSmall = txtSmall.getText().toString();
strLarge = txtLarge.getText().toString();
btn.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
if(chkSmall.isChecked()){
Toast.makeText(MainActivity.this, "SMALL CHECKBOX SELECTED", Toast.LENGTH_SHORT).show();
txtLarge.setText(txtSmall.getText().toString());
}
else if(chkLarge.isChecked()){
Toast.makeText(MainActivity.this, "LARGE CHECKBOX SELECTED", Toast.LENGTH_SHORT).show();
txtSmall.setText(txtLarge.getText().toString());
}
else{
Toast.makeText(MainActivity.this, "RESET Called", Toast.LENGTH_SHORT).show();
txtSmall.setText(strSmall);
txtLarge.setText(strLarge);
}
}
});
}
Here Your XML code set to layout.

Textview causing java.lang.ClassCastException: android.widget.TextView

I have three textviews and applied clickevent on them, but when i click on any of them the they cause Forceclose error in application. i have also tried changing ids textviews and then clean project and ran the project still that error is not removed.
My XML code is
for one textview
<LinearLayout
android:id="#+id/LL_fb"
android:layout_width="180px"
android:layout_height="27px"
android:layout_above="#+id/txt_msg_regs"
android:layout_alignLeft="#+id/LL_signup"
android:layout_marginBottom="25dp"
android:background="#drawable/facebook" >
<TextView
android:id="#+id/btn_txt_fb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Connect with facebook"
android:layout_gravity="center_vertical"
android:layout_marginLeft="23dp"
android:layout_marginTop="1dp"
android:clickable="true"
android:textColor="#FFFFFF" />
</LinearLayout>
for second textview
<LinearLayout
android:id="#+id/LL_signup"
android:layout_width="180px"
android:layout_height="29px"
android:layout_above="#+id/textView1"
android:layout_alignLeft="#+id/LL_login"
android:background="#drawable/lmyic_signup">
<TextView
android:id="#+id/btn_txt_sinup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="signup with email"
android:layout_gravity="center_vertical"
android:layout_marginLeft="25dp"
android:layout_marginTop="1dp"
android:clickable="true"
android:textColor="#FFFFFF" />
</LinearLayout>
for third one
<LinearLayout
android:id="#+id/LL_login"
android:layout_width="180px"
android:layout_height="29px"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="69dp"
android:background="#drawable/lmyic_login">
<TextView
android:id="#+id/btn_txt_login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Log in"
android:layout_gravity="center_vertical"
android:layout_marginLeft="70dp"
android:layout_marginTop="1dp"
android:textColor="#FFFFFF"
android:clickable="true"/>
</LinearLayout>
this is my android code. This class name in intent are also correct and i verified them.
TextView img_login;
img_login = (TextView)findViewById(R.id.btn_txt_login);
img_login.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
if(v.getId() == img_login.getId())
{
Intent i_lin = new Intent(LockmeifyoucanActivity.this,lmiyc_login.class);
startActivity(i_lin);
}
}
});
Please Tell me what is wrong with this. If logcat is needed then ask me for it....
Please post the complete XMl so that we can view the btn_txt_login in that.
It looks it is button because "findViewById(R.id.btn_txt_login);" would return null if this "btn_txt_login" id is not in xml.
you have some problem with textview in lmiyc_login activity.in lmiyc_login corrent line number 46 which maybe:
TextView txtview;
txtview = (TextView)yourlayout.findViewById(R.id.txtviewid);
findViewById(R.id.btn_txt_login);
Is this really a TextView or do you have a Button in your layout as well? I think you're trying to cast a Button to a TextView
Wrong resource ID...
img_login = (TextView)findViewById(R.id.btn_txt_login);
according to your XML should be
img_login = (TextView)findViewById(R.id.txt_login);
etc..
change ur code with this
TextView img_login;
img_login = (TextView)findViewById(R.id.txt_login);
img_login.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
if(v.getId().equals(img_login.getId()))
{
Intent i_lin = new Intent(LockmeifyoucanActivity.this,lmiyc_login.class);
startActivity(i_lin);
}
}
});
To resolve this error quickly, set one break point at line:
View view = findViewById(R.id.btn_txt_login);
Then, see on locals tab which component is, looking at gen/R.java.
these are lines from 42-48
setContentView(R.layout.lmyic_login_page);
txtBack = (TextView)findViewById(R.id.ImgViewTxtBack); txtBack.setTypeface(null,Typeface.BOLD);
iv_login = (ImageView)findViewById(R.id.Txtlogin);
iv_login.setOnClickListener(this);
iv_sign_up = (ImageView)findViewById(R.id.TxtSignup);
I think problem is with iv_login = (ImageView)findViewById(R.id.Txtlogin); – Dheeresh Singh 1 min ago edit
because this is 46 line and it should be textview and you are castin it in Imageview – Dheeresh Singh just now edit
if you have duplicate resource Id, that will throw ClasscastException. So make sure you don't have duplicate element id throughout the whole project.

Categories

Resources