Android Studio keeps giving me nullpointerexception [duplicate] - java

This question already has answers here:
What is a NullPointerException, and how do I fix it?
(12 answers)
Closed 5 years ago.
Hi i am doing a project that is due wednesday and i have spent over 13 hours trying to get Android studio working again, first their was a problem with the gradle and now i keep getting a nullpointerexception even though it same code that was working before. here is the code, please help? because i am stuck and could be doing my project rather that trying to solve android studios problems. by the way there are no errors within the code it says but here is the code.
package ie.wit.fitnessmadeeasy;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
public class LogActivity extends AppCompatActivity {
DataBaseHelper helper = new DataBaseHelper(this);
EditText uname = (EditText) findViewById(R.id.et_username);
String unstr = uname.getText().toString();
EditText pass = (EditText) findViewById(R.id.et_password);
String passstr = pass.getText().toString();
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_log);
TextView registerLink = (TextView) findViewById(R.id.regHere); //register link creates a link between the two pages
registerLink.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Intent registerIntent = new Intent(LogActivity.this, RegisterActivity.class);
LogActivity.this.startActivity(registerIntent); //what this does it creates an intent that opens the registeravtivity then it tells the current activity to perform the intent and open the register page
}
});
}
// Button login = (Button) findViewById(R.id.login);
public void onLogClick(View view) {
if (view.getId() == R.id.login) {
String Password = helper.searchPassstr(unstr);
Log.v("pass", passstr);
Log.v("pass", Password);
if (passstr.equals(Password)) {
Intent i = new Intent(LogActivity.this, UserAreaActivity.class);
i.putExtra("username", unstr);
startActivity(i);
} else {
Toast temp = Toast.makeText(LogActivity.this, "Username and Password don't Match", Toast.LENGTH_SHORT);
temp.show();
}
}
}
}
package ie.wit.fitnessmadeeasy;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
//import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class RegisterActivity extends AppCompatActivity {
DataBaseHelper helper = new DataBaseHelper(this);
final EditText name = (EditText) findViewById(R.id.et_name);
final EditText username = (EditText) findViewById(R.id.et_username);
final EditText password1 = (EditText) findViewById(R.id.et_password);
final EditText password2 = (EditText) findViewById(R.id.et_password);
String namestr = name.getText().toString();
String usernamestr = username.getText().toString();
String password1str = password1.getText().toString();
String password2str = password2.getText().toString();
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
// final EditText password2 = (EditText) findViewById(R.id.et_password);
name.setOnFocusChangeListener(new View.OnFocusChangeListener() {
#Override
public void onFocusChange(View v, boolean hasFocus) {
if(name.getText().length()==0){
name.setError("Fill Out");
}
else if(username.getText().length()==0){
username.setError("Fill Out");
}
}
});
}
public void onRegClick(View v)
{
if(v.getId() == R.id.confirm)
{
// EditText age = (EditText) findViewById(R.id.et_age); //age is a final variable and is only assigned to activity_register as a view
// EditText name = (EditText) findViewById(R.id.et_name);
// EditText username = (EditText) findViewById(R.id.et_username);
// EditText password1 = (EditText) findViewById(R.id.et_password);
// EditText password2 = (EditText) findViewById(R.id.et_password2);
if(namestr.equals("")){
Toast pass = Toast.makeText(RegisterActivity.this, "Enter Name!", Toast.LENGTH_SHORT);
pass.show();
}
if(usernamestr.equals("")){
Toast pass = Toast.makeText(RegisterActivity.this, "Enter Username!", Toast.LENGTH_SHORT);
pass.show();
}
if(password1str.equals("")){
Toast pass = Toast.makeText(RegisterActivity.this, "Enter Password!", Toast.LENGTH_SHORT);
pass.show();
}
if(!password1str.equals(password2str))
{
//popup message
Toast pass = Toast.makeText(RegisterActivity.this, "Passwords don't match!", Toast.LENGTH_SHORT);
pass.show();
}
else{
// String namestr = name.getText().toString();
//insert details
RegRequest reg = new RegRequest();
reg.setEt_name(namestr);
reg.setEt_username(usernamestr);
reg.setEt_password(password1str);
// r.setEt_age(agestr);
Toast success = Toast.makeText(RegisterActivity.this, "Success", Toast.LENGTH_SHORT);
success.show();
Intent i = new Intent(RegisterActivity.this, LogActivity.class);
startActivity(i);
helper.insertUser(reg);
}
}
}
}
package ie.wit.fitnessmadeeasy;
public class RegRequest{
String et_name , et_username, et_password;
// int et_age;
public void setEt_name(String et_name)
{
this.et_name = et_name;
}
public String getEt_name()
{
return this.et_name;
}
public void setEt_username(String et_username)
{
this.et_username = et_username;
}
public String getEt_username()
{
return this.et_username;
}
public void setEt_password(String et_password)
{
this.et_password = et_password;
}
public String getEt_password()
{
return this.et_password;
}
}
at ie.wit.fitnessmadeeasy.LogActivity.<init>(LogActivity.java:17)

LogActivity.java
Only declare the fields like the following:
EditText uname, pass;
String unstr, passstr;
Initialize in onCreate() method.
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_log);
uname = (EditText) findViewById(R.id.et_username);
unstr = uname.getText().toString();
pass = (EditText) findViewById(R.id.et_password);
passstr = pass.getText().toString();
}
And RegisterActivity.java
DataBaseHelper helper ;
EditText name, username,password1,password2;
String namestr,usernamestr,password1str,password2str;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
helper = new DataBaseHelper(this);
name = (EditText) findViewById(R.id.et_name);
username = (EditText) findViewById(R.id.et_username);
password1 = (EditText) findViewById(R.id.et_password);
password2 = (EditText) findViewById(R.id.et_password);
namestr = name.getText().toString();
usernamestr = username.getText().toString();
password1str = password1.getText().toString();
password2str = password2.getText().toString();
}

Related

getText and setText function not working in android studio

i tried to make my first converter in android studio with java but 2 functions setText and getText are not working
package com.example.unitconvertor;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
public class MainActivity<editTextTextPersonName> extends AppCompatActivity {
private Button button;
private editTextTextPersonName editTextTextPersonName;
private View editText;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
button = findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Toast.makeText(MainActivity.this, "value saved", Toast.LENGTH_SHORT).show();
String s = editText.getText().toString();
int inch = Integer.parseInt(s);
double cm = 2.54 * inch;
editText.setText( "the value is" + cm);
}
});
}
}
i hope that i am clear
thankyou
Try this-
public class MainActivity extends AppCompatActivity {
private Button button;
private EditText editText;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
button = findViewById(R.id.button);
editText = findViewById(R.id.your_id);//ADD YOUR EDIT TEXT ID HERE
button.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Toast.makeText(MainActivity.this, "value saved", Toast.LENGTH_SHORT).show();
String s = editText.getText().toString();
int inch = Integer.parseInt(s);
double cm = 2.54 * inch;
editText.setText( "the value is" + cm);
}
});
}
}
The error is that your "edittext" is declared as view, correct it like this : private EditText edittext;
then, retrieve it by id like this in your onCreate method edittext = findViewById(R.id.your_id);

onClick view is already defined

I am trying to work with two buttons on one screen and I want to have two different actions occur when each button is clicked. This is my code and I am getting the error message onClick view is already defined on the method titles of both onClick methods. Any help is greatly appreciated.
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity2 extends AppCompatActivity implements View.OnClickListener {
private Button button3;
private Button button2;
private EditText editText;
private EditText editText9;
private EditText editText10;
private EditText editText11;
private EditText editText12;
private EditText editText13;
private EditText editText14;
private TextView textView;
private TextView textView22;
private View view;
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity2_main);
Intent intent = getIntent();
button3 = (Button) findViewById(R.id.button3);
button3.setOnClickListener(this);
button2 = (Button) findViewById(R.id.button2);
button2.setOnClickListener(this);
editText = (EditText) findViewById(R.id.editText);
editText9 = (EditText) findViewById(R.id.editText9);
editText10 = (EditText) findViewById(R.id.editText10);
editText11 = (EditText) findViewById(R.id.editText11);
editText12 = (EditText) findViewById(R.id.editText12);
editText13 = (EditText) findViewById(R.id.editText13);
editText14 = (EditText) findViewById(R.id.editText14);
textView = (TextView) findViewById(R.id.textView);
textView22 = (TextView) findViewById(R.id.textView22);
}
public void onClick (View view) {
this.view = view;
if (view.getId() == R.id.button3) {
Intent intent = new Intent(MainActivity2.this, MainActivity.class);
MainActivity2.this.startActivity(intent);
}
}
public void onClick (View view){
if (view.getId() == R.id.button2) {
String value8 = editText.getText().toString();
String value9 = editText9.getText().toString();
String value10 = editText10.getText().toString();
String value11 = editText11.getText().toString();
String value12 = editText12.getText().toString();
String value13 = editText13.getText().toString();
String value14 = editText14.getText().toString();
}
}
}
You have two onClick methods with the same parameters so it doesn't know which to use. Combine the two and it should work.

retrieving shared preferences value from asynctask

I am trying to get values from shared preferences and it is returning null. The shared preference value is set from an asynctask. I tested it from inside the asynctask, printing the stord value in a toast and it worked, but problem is when I try the retrive the value outside the asynctask by clicking on the buttonRegister, it display null. There is no error shown into the logcat.
The code of the Activity:
package com.example.mohalogin;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Properties;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class RegisterActivity extends Activity {
private EditText editTextName;
private EditText editTextUsername;
private EditText editTextPassword;
private EditText editTextEmail;
private Button buttonRegister;
private Button buttonLogin;
//private Button gmail,yahoo;
Context context;
private SharedPreferences sharedpreferences;
public static final String MyPREFERENCES = "MyPreferences" ;
public static final String RegisResult = "result";
private static final String REGISTER_URL = "xxxxxxxxxx"; //fake data
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
editTextName = (EditText) findViewById(R.id.editTextName);
editTextUsername = (EditText) findViewById(R.id.editTextUserName);
editTextPassword = (EditText) findViewById(R.id.editTextPassword);
editTextEmail = (EditText) findViewById(R.id.editTextEmail);
buttonRegister = (Button) findViewById(R.id.buttonRegister);
buttonLogin = (Button) findViewById(R.id.buttonLogin);
buttonRegister.setOnClickListener(new View.OnClickListener(){
#Override
public void onClick(View arg0){
registerUser();
sharedpreferences=getApplicationContext().getSharedPreferences("MyPrefs", getApplicationContext().MODE_PRIVATE);
buttonLogin.setText(sharedpreferences.getString("result","")); //testing by printing the value in the button
}
});
/*buttonLogin.setOnClickListener(new View.OnClickListener(){
#Override
public void onClick(View arg0){
startActivity(new Intent(RegisterActivity.this, LoginActivity.class));
}
});*/
}
private void registerUser() {
String name = editTextName.getText().toString().trim().toLowerCase();
String username = editTextUsername.getText().toString().trim().toLowerCase();
String password = editTextPassword.getText().toString().trim().toLowerCase();
String email = editTextEmail.getText().toString().trim().toLowerCase();
register(name,username,password,email);
}
private void register(String name, String username, String password, String email) {
class RegisterUser extends AsyncTask<String, Void, String> {
ProgressDialog loading;
RegisterUserClass ruc = new RegisterUserClass();
private Context context2;
#Override
protected void onPreExecute() {
super.onPreExecute();
loading = ProgressDialog.show(RegisterActivity.this, "Please Wait","Registering new user", true, false);
}
#Override
protected String doInBackground(String... params) {
HashMap<String, String> data = new HashMap<String,String>();
data.put("name",params[0]);
data.put("username",params[1]);
data.put("password",params[2]);
data.put("email",params[3]);
String result = ruc.sendPostRequest(REGISTER_URL,data);
return result;
}
#Override
protected void onPostExecute(String s) {
super.onPostExecute(s);
loading.dismiss();
sharedpreferences = context2.getSharedPreferences(MyPREFERENCES, context2.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putString(RegisResult, s);
editor.commit();
Toast.makeText(getApplicationContext(),sharedpreferences.getString("result",""), Toast.LENGTH_LONG).show();
}
public RegisterUser(Context context2)
{
this.context2=context2;
}
}
RegisterUser ru = new RegisterUser(getApplicationContext());
ru.execute(name, username, password, email);
}
}
Your problem is with the call to getSharedPreferences(String, int) -
You basically use two separate SharePreference instances, since you are passing a different name (String) for the SharedPreferences each time -
When you store the value, you are using
getSharedPreferences("MyPreferences", context2.MODE_PRIVATE);
And when you try to obtain the value, you are using
getSharedPreferences("MyPrefs", getApplicationContext().MODE_PRIVATE);
Modify your code to use the same SharedPreference name and it should work.
When you assign part of the code to be executed by the AsyncTask, it is actually executed in a new thread, other than the Ui thread. Actually in the onClick of the ButtonRegister, the registerUser() and the following two lines, run in parallel mode not sequentially.
If you want to make sure that saving in SharedPreferences is completed successfully, you can read it again and set the button text. Alter the OnPostExecute of your AsyncTask this way:
#Override
protected void onPostExecute(String s)
{
super.onPostExecute(s);
loading.dismiss();
.
.
.
buttonLogin.setText(sharedpreferences.getString("result",""));
}
You are accessing the value at the wrong place.
Try this code instead :)
package com.example.mohalogin;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Properties;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class RegisterActivity extends Activity {
private EditText editTextName;
private EditText editTextUsername;
private EditText editTextPassword;
private EditText editTextEmail;
private Button buttonRegister;
private Button buttonLogin;
//private Button gmail,yahoo;
Context context;
private SharedPreferences sharedpreferences;
public static final String MyPREFERENCES = "MyPreferences" ;
public static final String RegisResult = "result";
private static final String REGISTER_URL = "xxxxxxxxxx"; //fake data
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
sharedpreferences=getApplicationContext().getSharedPreferences("MyPrefs", getApplicationContext().MODE_PRIVATE);
editTextName = (EditText) findViewById(R.id.editTextName);
editTextUsername = (EditText) findViewById(R.id.editTextUserName);
editTextPassword = (EditText) findViewById(R.id.editTextPassword);
editTextEmail = (EditText) findViewById(R.id.editTextEmail);
buttonRegister = (Button) findViewById(R.id.buttonRegister);
buttonLogin = (Button) findViewById(R.id.buttonLogin);
buttonRegister.setOnClickListener(new View.OnClickListener(){
#Override
public void onClick(View arg0){
registerUser();
}
});
/*buttonLogin.setOnClickListener(new View.OnClickListener(){
#Override
public void onClick(View arg0){
startActivity(new Intent(RegisterActivity.this, LoginActivity.class));
}
});*/
}
private void registerUser() {
String name = editTextName.getText().toString().trim().toLowerCase();
String username = editTextUsername.getText().toString().trim().toLowerCase();
String password = editTextPassword.getText().toString().trim().toLowerCase();
String email = editTextEmail.getText().toString().trim().toLowerCase();
register(name,username,password,email);
}
private void register(String name, String username, String password, String email) {
class RegisterUser extends AsyncTask<String, Void, String> {
ProgressDialog loading;
RegisterUserClass ruc = new RegisterUserClass();
private Context context2;
#Override
protected void onPreExecute() {
super.onPreExecute();
loading = ProgressDialog.show(RegisterActivity.this, "Please Wait","Registering new user", true, false);
}
#Override
protected String doInBackground(String... params) {
HashMap<String, String> data = new HashMap<String,String>();
data.put("name",params[0]);
data.put("username",params[1]);
data.put("password",params[2]);
data.put("email",params[3]);
String result = ruc.sendPostRequest(REGISTER_URL,data);
return result;
}
#Override
protected void onPostExecute(String s) {
super.onPostExecute();
loading.dismiss();
sharedpreferences = context2.getSharedPreferences(MyPREFERENCES, context2.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putString(RegisResult, s);
editor.commit();
Toast.makeText(getApplicationContext(),sharedpreferences.getString("result",""), Toast.LENGTH_LONG).show();
buttonLogin.setText(sharedpreferences.getString(RegisResult,"")); //testing by printing the value in the button
}
public RegisterUser(Context context2)
{
this.context2=context2;
}
}
RegisterUser ru = new RegisterUser(getApplicationContext());
ru.execute(name, username, password, email);
}
}
When you try to retrieve the value outside the asynctask, it display null because the asynctask didn't finish. Whatever you need to do with the data you get it in the executing of the asyncTask, you need to do it inside of onPostExecute, it is the only place where you can be sure the asyncTask already finish.
Re-instantiate your Shared-preference after the commit.

SQLite username check with EditText value

Hi i have bit problem in login actually i"m trying to tesing login by checking username from databse and edit text value but its not working . the following is my codes .
i'm bit confussed about to get the EditTextvalue
package com.example.employeemanager;
import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class Login extends Activity {
SQLiteDatabase db;
EditText unameedt;
String unam;
String pass;
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.login);
Button logbtn = (Button) findViewById(R.id.loginbtn);
Button signup = (Button) findViewById(R.id.signup);
EditText unameedt = (EditText) findViewById(R.id.editText1);
EditText passedt = (EditText) findViewById(R.id.editText2);
db = openOrCreateDatabase("Employeemanager", MODE_PRIVATE, null);
unam = unameedt.getText().toString();
pass = passedt.getText().toString();
logbtn.setOnClickListener(new OnClickListener()
{
public void onClick(View v) {
Cursor c = db.rawQuery(
"SELECT username, password from Employee", null);
if (c != null) {
if (c.moveToFirst()) {
do {
String uname = c.getString(c
.getColumnIndex("username"));
String upass = c.getString(c
.getColumnIndex("password"));
if (uname.equals(unam)) {
StartActivity(new Intent(Login.this, Home.class));
}
} while (c.moveToNext());
}
}
}
});
signup.setOnClickListener(new OnClickListener()
{
#Override
public void onClick(View v) {
startActivity(new Intent(Login.this, Emp_signup.class));
}
});
}
}
Put your
unam = unameedt.getText().toString();
pass=passedt.getText().toString();
into butonClick event
logbtn.setOnClickListener(new OnClickListener()
{
unam = unameedt.getText().toString();
pass=passedt.getText().toString();
});
Its simple but looks like a big thing while start learning Android. What you doing now is you got the value in onCreate
unam = unameedt.getText().toString();
pass = passedt.getText().toString();
So, now the unameand pass is empty because while onCreate there is no values set to the corresponding EditText.
In OnClick Method you comparing the Value from Edittext and from database
if (uname.equals(unam)) {//if(usernamefromDatabase.equals(emptyValue))
StartActivity(new Intent(Login.this, Home.class));
}
Thats where the problem is.
What you want to do now is get the unam and pass values in onClick
unam = unameedt.getText().toString();
pass = passedt.getText().toString();
if (uname.equals(unam)) {//if(usernamefromDatabase.equals(valueyouentered))
StartActivity(new Intent(Login.this, Home.class));
}
It should work now.

how to remove force close error in android code

package com.example.app123;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends Activity {
EditText input;
EditText output;
Button one;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
input = (EditText) findViewById(R.id.editText1);
output = (EditText) findViewById(R.id.editText2);
one = (Button) findViewById(R.id.button1);
one.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
if (v == one) {
Context context1 = getApplicationContext();
CharSequence text1 = "Please enter a valid number";
int duration = Toast.LENGTH_SHORT;
final Toast toast = Toast.makeText(context1, text1,
duration);
toast.show();
int inputValue = Integer.parseInt(input.getText()
.toString());
int value = inputValue * inputValue;
output.setText(value);
}
}
});
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it ispresent.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
hi remove this condition in your button click code if(v==one) only use this like
input=(EditText)findViewById(R.id.editText1);
output = (EditText) findViewById(R.id.editText2);
one = (Button) findViewById(R.id.button1);
one.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Context context1 = getApplicationContext();
CharSequence text1 = "Please enter a valid number";
int duration = Toast.LENGTH_SHORT;
final Toast toast = Toast.makeText(context1, text1,
duration);
toast.show();
int inputValue = Integer.parseInt(input.getText()
.toString());
int value = inputValue * inputValue;
output.setText(value);
}
});
i hope it's work for you.
If you have multiple buttons:
Button b1=(Button)findviewById(R.id.b1);
Button b2=(Button)findviewById(R.id.b2);
one.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
switch(v.getid())
case R.id.b1:
CharSequence text1 = "Please enter a valid number";
int duration = Toast.LENGTH_SHORT;
final Toast toast = Toast.makeText(YourActivity.this, text1,
duration);
toast.show();
int inputValue = Integer.parseInt(input.getText()
.toString());
int value = inputValue * inputValue;
output.setText(value);
break;
case R.id.b1:
break;
}
});

Categories