Android Updating Last ListView After Fragment Change - android

I have 2 different Fragments and in first Fragment, I am adding a new student entry to my custom Student ArrayList. I also have a ListView to show my student list in my second Fragment. However, when I go to my second Fragment, it doesn't update the latest ListView. So my question is that how can I update my ListView after I change my Fragment tab?
registerBtn simply adds a new entry to my studentsArrayList.
At first, I tried to use "Get" button to update my ListView but it didn't work. What I want to do is that refreshing my ListView whenever I pass to my StudentsFragment.
RegisterFragment.java:
package com.rawsly.android.schoolprogram;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.Random;
public class RegisterFragment extends Fragment {
private static final String TAG = "RegisterFragment";
public ArrayList<Students> studentsArrayList = new ArrayList<>();
private ArrayList<Long> idList = new ArrayList<>();
private TextView studentID;
private Button registerBtn, clearBtn, exitBtn;
private EditText editName, editLastName, editGender, editFaculty, editDepartment, editAdvisor;
#Nullable
#Override
public View onCreateView(LayoutInflater inflater, #Nullable ViewGroup container, #Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.register_fragment, container, false);
studentID = (TextView) view.findViewById(R.id.studentID);
studentID.setText(String.valueOf(generateID()));
editName = (EditText) view.findViewById(R.id.editName);
editLastName = (EditText) view.findViewById(R.id.editLastName);
editGender = (EditText) view.findViewById(R.id.editGender);
editFaculty = (EditText) view.findViewById(R.id.editFaculty);
editDepartment = (EditText) view.findViewById(R.id.editDepartment);
editAdvisor = (EditText) view.findViewById(R.id.editAdvisor);
registerBtn = (Button) view.findViewById(R.id.registerBtn);
registerBtn.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
String id = studentID.getText().toString();
String name = editName.getText().toString();
String lastName = editLastName.getText().toString();
String gender = editGender.getText().toString();
String faculty = editFaculty.getText().toString();
String department = editDepartment.getText().toString();
String advisor = editAdvisor.getText().toString();
studentsArrayList.add(new Students(id, name, lastName, gender, faculty, department, advisor));
Toast.makeText(getContext(), "New entry added.", Toast.LENGTH_SHORT).show();
}
});
clearBtn = (Button) view.findViewById(R.id.clearBtn);
clearBtn.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
editName.setText(null);
editLastName.setText(null);
editGender.setText(null);
editFaculty.setText(null);
editDepartment.setText(null);
editAdvisor.setText(null);
studentID.setText(String.valueOf(generateID()));
}
});
exitBtn = (Button) view.findViewById(R.id.exitBtn);
exitBtn.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
System.exit(1);
}
});
return view;
}
// Generates a random ID.
public long generateID() {
Random rnd = new Random();
char [] digits = new char[11];
digits[0] = (char) (rnd.nextInt(9) + '1');
for(int i=1; i<digits.length; i++) {
digits[i] = (char) (rnd.nextInt(10) + '0');
}
long result = Long.parseLong(new String(digits));
if(idList.contains(result)) {
return generateID();
} else {
return result;
}
}
}
StudentsFragment.java:
package com.rawsly.android.schoolprogram;
import android.app.Dialog;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import java.util.ArrayList;
public class StudentsFragment extends Fragment {
private static final String TAG = "StudentsFragment";
private EditText txtSearch;
private ListView studentsListView;
private Button getStudents, updateStudent, deleteStudent, exitBtn;
public StudentsAdapter adapter;
public ArrayList<Students> studentsArrayList = new ArrayList<>();;
public int selectedItem = -1; // to update or delete the data
#Nullable
#Override
public View onCreateView(LayoutInflater inflater, #Nullable ViewGroup container, #Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.students_fragment, container, false);
// Dummy Data
studentsArrayList.add(new Students("1122334455", "Ahmet", "Özdemir", "Male", "Mühendislik ve Doğa Bilimleri", "Bilgisayar Mühendisliği", "Tuğba Yıldız"));
studentsArrayList.add(new Students("1234567890", "Ezgi", "İmamoğlu", "Female", "Mühendislik ve Doğa Bilimleri", "Bilgisayar Mühendisliği", "Tuğba Yıldız"));
studentsArrayList.add(new Students("0123456789", "Enise", "Usta", "Female", "Sosyal ve Beşeri Bilimler Fakültesi", "Uluslararası İlişkiler", "Murat Orhun"));
studentsArrayList.add(new Students("1122445588", "Sinem", "Ünver", "Female", "Mühendislik ve Doğa Bilimleri", "Endüstri Mühendisliği", "Zehra Yılmaz"));
studentsArrayList.add(new Students("2546882547", "Zehra", "Gürçay", "Female", "Mühendislik ve Doğa Bilimleri", "Endüstri Mühendisliği", "Şule Gündüz"));
adapter = new StudentsAdapter(getContext(), studentsArrayList);
studentsListView = (ListView) view.findViewById(R.id.studentsListView);
studentsListView.setAdapter(adapter);
studentsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
selectedItem = position;
Toast.makeText(getContext(), "Selected entry: " + (selectedItem+1), Toast.LENGTH_LONG).show();
}
});
// Opens a dialog window
getStudents = (Button) view.findViewById(R.id.getStudents);
getStudents.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
adapter.notifyDataSetChanged();
studentsListView.invalidate();
}
}); // end of the add action
// To delete the selected School object
deleteStudent = (Button) view.findViewById(R.id.deleteStudent);
deleteStudent.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
if(selectedItem == -1) {
Toast.makeText(getContext(), "Please, select an entry first.", Toast.LENGTH_SHORT).show();
} else {
studentsArrayList.remove(selectedItem);
selectedItem = -1;
adapter.notifyDataSetChanged();
Toast.makeText(getContext(), "Selected entry is deleted.", Toast.LENGTH_SHORT).show();
}
}
}); // end of the delete action
// To exit the program
exitBtn = (Button) view.findViewById(R.id.exitBtn);
exitBtn.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
System.exit(1);
}
}); // end of the exit action
// To update the selected School object
updateStudent = (Button) view.findViewById(R.id.updateStudent);
updateStudent.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
if(selectedItem == -1) {
Toast.makeText(getContext(), "Please, select an entry first.", Toast.LENGTH_SHORT).show();
} else {
final Dialog dialog = new Dialog(getContext());
dialog.setContentView(R.layout.update_student);
dialog.setTitle("Update An Entry");
// Dialog components - EditText, Button
String id = studentsArrayList.get(selectedItem).id;
String name = studentsArrayList.get(selectedItem).name;
String lastName = studentsArrayList.get(selectedItem).lastName;
String gender = studentsArrayList.get(selectedItem).gender;
String faculty = studentsArrayList.get(selectedItem).faculty;
String department = studentsArrayList.get(selectedItem).department;
String advisor = studentsArrayList.get(selectedItem).advisor;
final TextView studentID = (TextView) dialog.findViewById(R.id.studentID);
final EditText editName = (EditText) dialog.findViewById(R.id.editName);
final EditText editLastName = (EditText) dialog.findViewById(R.id.editLastName);
final EditText editGender = (EditText) dialog.findViewById(R.id.editGender);
final EditText editFaculty = (EditText) dialog.findViewById(R.id.editFaculty);
final EditText editDepartment = (EditText) dialog.findViewById(R.id.editDepartment);
final EditText editAdvisor = (EditText) dialog.findViewById(R.id.editAdvisor);
studentID.setText(id);
editName.setText(name);
editLastName.setText(lastName);
editGender.setText(gender);
editFaculty.setText(faculty);
editDepartment.setText(department);
editAdvisor.setText(advisor);
Button updateStudent = (Button) dialog.findViewById(R.id.updateStudent);
Button clearStudent = (Button) dialog.findViewById(R.id.clearStudent);
Button cancelStudent = (Button) dialog.findViewById(R.id.cancelStudent);
// Updates the selected School object
updateStudent.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
String id = studentID.getText().toString();
String name = editName.getText().toString();
String lastName = editLastName.getText().toString();
String gender = editGender.getText().toString();
String faculty = editFaculty.getText().toString();
String department = editDepartment.getText().toString();
String advisor = editAdvisor.getText().toString();
studentsArrayList.get(selectedItem).setId(id);
studentsArrayList.get(selectedItem).setName(name);
studentsArrayList.get(selectedItem).setLastName(lastName);
studentsArrayList.get(selectedItem).setGender(gender);
studentsArrayList.get(selectedItem).setFaculty(faculty);
studentsArrayList.get(selectedItem).setDepartment(department);
studentsArrayList.get(selectedItem).setAdvisor(advisor);
adapter.notifyDataSetChanged();
Toast.makeText(getContext(), "An entry is updated.", Toast.LENGTH_SHORT).show();
dialog.dismiss();
}
});
// Clears all fields
clearStudent.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
editName.setText(null);
editLastName.setText(null);
editGender.setText(null);
editFaculty.setText(null);
editDepartment.setText(null);
editAdvisor.setText(null);
}
});
// Dismisses the dialog
cancelStudent.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
dialog.dismiss();
}
});
dialog.show();
adapter.notifyDataSetChanged(); // notifying adapter about changes
}
}
}); // end of the update action
return view;
}
}

"Troubleshooting
If calling notifyDataSetChanged() doesn't work all the layout methods won't help either. Believe me the ListView was properly updated. If you fail to find the difference you need to check where the data in your adapter comes from.
If this is just a collection you're keeping in memory check that you actually deleted from or added the item(s) to the collection before calling the notifyDataSetChanged().
If you're working with a database or service backend you'll have to call the method to retrieve the information again (or manipulate the in memory data) before calling the notifyDataSetChanged().
The thing is this notifyDataSetChanged only works if the dataset has changed. So that is the place to look if you don't find changes coming through. Debug if needed."
duplicate: How to refresh Android listview?

Related

How to transfer data of current item and create a new child cart on button click

I want to create a way which will add item to cart by creating a child cart the in that child it will retrieve current username and then under that it will save all the details of added item
this is the code of the fragment in which cart button is available (course = description,email = price,purl = url of image)
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
public class descfragment extends Fragment {
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
private String mParam1;
private String mParam2;
String name, course, email, purl;
public descfragment() {
}
public descfragment(String name, String course, String email, String purl) {
this.name = name;
this.course = course;
this.email = email;
this.purl = purl;
}
public static descfragment newInstance(String param1, String param2) {
descfragment fragment = new descfragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_descfragment, container, false);
view.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
AppCompatActivity activity =(AppCompatActivity)getContext();
activity.getSupportFragmentManager().beginTransaction().replace(R.id.wrapper,new recfragment()).addToBackStack(null).commit();
}
});
ImageView imageholder = view.findViewById(R.id.imageholder);
TextView nameholder = view.findViewById(R.id.nameholder);
TextView courseholder = view.findViewById(R.id.courseholder);
TextView emailholder = view.findViewById(R.id.emailholder);
Button cart = view.findViewById(R.id.cartt);
TextView addItem = view.findViewById(R.id.addIteam);
TextView removeItem = view.findViewById(R.id.removeItem);
TextView quantity = view.findViewById(R.id.quantity);
final int[] totalquantity = {1};
nameholder.setText(name);
courseholder.setText(course);
emailholder.setText(email);
if (imageholder != null) {
Glide.with(getContext()).load(purl).into(imageholder);
}
Glide.with(getContext()).load(purl).into(imageholder);
//changing static getemail to int type
//for openig cart
//setting click on textview for increasing the quantity
addItem.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
if(totalquantity[0] < 10){
totalquantity[0]++;
quantity.setText(String.valueOf(totalquantity[0]));
}
}
});
removeItem.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
if(totalquantity[0] > 1) {
totalquantity[0]--;
quantity.setText(String.valueOf(totalquantity[0]));
}
}
});
return view;
}
#Override
public void onResume() {
super.onResume();
getView().setFocusableInTouchMode(true);
getView().requestFocus();
getView().setOnKeyListener((v, keyCode, event) -> {
if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {
AppCompatActivity activity = (AppCompatActivity) getContext();
activity.getSupportFragmentManager().beginTransaction().replace(R.id.wrapper, new recfragment()).addToBackStack(null).commit();
return true;
}
return false;
});
}
}
this is the register activity code in this activity we have the username which needed to be retirived
import androidx.annotation.NonNull;
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;
import android.widget.Toast;
import com.example.foodcourt.MainActivity;
import com.example.foodcourt.R;
import com.google.android.material.textfield.TextInputLayout;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
public class register extends AppCompatActivity {
Button button5;
//create obj of Databaserefrence to access firebase RealTime Database
DatabaseReference databaseReference = FirebaseDatabase.getInstance().getReferenceFromUrl("https://url of firebase database/");
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
final TextInputLayout nameLayout = findViewById(R.id.Name);
final TextInputLayout phoneLayout = findViewById(R.id.phone);
final TextInputLayout passwordLayout = findViewById(R.id.password);
final TextInputLayout repassLayout = findViewById(R.id.repass);
final Button signup = findViewById(R.id.sign);
final EditText name = nameLayout.getEditText();
final EditText phone = phoneLayout.getEditText();
final EditText password = passwordLayout.getEditText();
final EditText repass = repassLayout.getEditText();
signup.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
//get data from editTexts into string
final String nameTxt = name.getText().toString();
final String phoneTxt = phone.getText().toString();
final String passwordTxt = password.getText().toString();
final String repassTxt = repass.getText().toString();
//Check if user filled all details before sending data to firebase
if (nameTxt.isEmpty() || phoneTxt.isEmpty() || passwordTxt.isEmpty() || repassTxt.isEmpty()) {
Toast.makeText(register.this, "Please fill all fields", Toast.LENGTH_SHORT).show();
}
//check if pass are matching
else if (!passwordTxt.equals(repassTxt)) {
Toast.makeText(register.this, "PASSWORDS ARE NOT MATCHING", Toast.LENGTH_SHORT).show();
} else {
databaseReference.child("users").addListenerForSingleValueEvent(new ValueEventListener() {
#Override
public void onDataChange(#NonNull DataSnapshot snapshot) {
//check if phone number is registered before \
if (snapshot.hasChild(phoneTxt)) {
Toast.makeText(register.this, "Already registered", Toast.LENGTH_SHORT).show();
} else {
//sending data to Firebase
//using phoneNumbers
databaseReference.child("users").child(phoneTxt).child("name").setValue(nameTxt);
databaseReference.child("users").child(phoneTxt).child("phone").setValue(phoneTxt);
databaseReference.child("users").child(phoneTxt).child("password").setValue(passwordTxt);
Toast.makeText(register.this, "REGISTERED SUCCESFULLY", Toast.LENGTH_SHORT).show();
startActivity(new Intent(register.this, MainActivity.class));
}
}
#Override
public void onCancelled(#NonNull DatabaseError error) {
}
});
}
}
});
}
}
I followed some tutorials but they were for firestore.

String does not show up in android toast

I have been working on an activity which has two edittext fields and two spinners. The text entered in the EditText fields doesn't show up in the toast that I generate, even though the selections done in the spinners does. What am I doing wrong ?
package com.goswami.pntgo.notifierdemo;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.*;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;
public class LoginScreen extends Activity {
String Course = null;
String Semester = null;
String univRollNo = null;
String name = null;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login_screen);
final EditText tvname = (EditText) findViewById(R.id.name);
final EditText tvunivrn = (EditText) findViewById(R.id.univ_roll_no);
name = tvname.getText().toString();
univRollNo = tvunivrn.getText().toString();
Spinner course = (Spinner)findViewById(R.id.course);
Spinner semester = (Spinner)findViewById(R.id.semester);
ArrayAdapter cadapter = ArrayAdapter.createFromResource(this,R.array.courses,R.layout.courses);
ArrayAdapter sadapter = ArrayAdapter.createFromResource(this,R.array.semesters,R.layout.courses);
course.setAdapter(cadapter);
semester.setAdapter(sadapter);
course.setOnItemSelectedListener(new OnItemSelectedListener(){
#Override
public void onNothingSelected(AdapterView<?> parent) {
}
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id){
Course = parent.getItemAtPosition(pos).toString();
}
});
semester.setOnItemSelectedListener(new OnItemSelectedListener() {
#Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
Semester = parent.getItemAtPosition(position).toString();
}
#Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
Button login = (Button)findViewById(R.id.button);
login.setOnClickListener(new Button.OnClickListener(){
public void onClick(View v){
Toast.makeText(LoginScreen.this,(name+" Roll No:"+univRollNo+"\n"+Course+" "+Semester),Toast.LENGTH_LONG).show();
}
});
}
}
You're setting the contents of univRollNo before anything has been entered into tvunivrn.
Add this line to the top of your login button OnClickListener:
univRollNo = tvunivrn.getText().toString();
Or just circumvent that and extract the text as such:
Toast.makeText(LoginScreen.this, name + " Roll No:" + tvunivrn.getText().toString() + "\n" + Course + " " + Semester, Toast.LENGTH_LONG).show();

Clear variable when Android back button is clicked

I have an app where I would like to be able to click on a button, A, and show a certain set of information. Then click the back button and click on button B and show a different set of information. I have coded a test TextView into the Drinks.java file in order to begin the process by confirming what is being passed along. Currently whatever button I push first is getting stuck in the variable. So for example if I push button A, then push the back arrow and push button B, button A is still showing up in the textView. I tried making the Strings empty within the on click listener, to "clear them out" as it were, but that isn't working. Is there a way to wipe out what is in the variable and reassign something else? Or does my problem lie elsewhere?
Bar.java
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
public class Bar extends Activity{
String setBarTest = MainActivity.setBar;
String barNameHolder, picHolder, barContactHolder, barPhoneHolder;
int imageInt, textInt1,textInt2, textInt3;
TextView setBarName, setBarContact,setBarPhone;
ImageView barPic;
Button viewAll, beer, wine, mixedDrinks, other, getTaxi;
static String setDrinkType = "";
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_bar);
Button viewAll = (Button)findViewById(R.id.btnviewAll);
Button beer = (Button)findViewById(R.id.btnBeer);
Button wine = (Button)findViewById(R.id.btnWine);
Button mixedDrinks = (Button)findViewById(R.id.btnMixedDrinks);
Button other = (Button)findViewById(R.id.btnOther);
Button getTaxi = (Button)findViewById(R.id.btnTaxi);
barPic = (ImageView) findViewById(R.id.barPic);
String picHolder = "drawable/"+setBarTest;
int imageInt = getResources().getIdentifier(picHolder, null, getPackageName());
barPic.setImageResource(imageInt);
setBarName = (TextView)findViewById(R.id.barName);
String barNameHolder = "#string/"+setBarTest;
int textInt1 = getResources().getIdentifier(barNameHolder, null, getPackageName());
setBarName.setText(textInt1);
setBarContact = (TextView)findViewById(R.id.barContact);
String barContactHolder = "#string/"+setBarTest+"Contact";
int textInt2 = getResources().getIdentifier(barContactHolder, null, getPackageName());
setBarContact.setText(textInt2);
setBarPhone = (TextView)findViewById(R.id.barPhone);
String barPhoneHolder = "#string/"+setBarTest+"Phone";
int textInt3 = getResources().getIdentifier(barPhoneHolder, null, getPackageName());
setBarPhone.setText(textInt3);
viewAll.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
Intent i = (new Intent(Bar.this, Drinks.class));
startActivity(i);
}
});
beer.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
setDrinkType = "";
setDrinkType = "Beer";
Intent i = (new Intent(Bar.this, Drinks.class));
startActivity(i);
}
});
wine.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
setDrinkType = "";
setDrinkType = "Wine";
Intent i = (new Intent(Bar.this, Drinks.class));
startActivity(i);
}
});
mixedDrinks.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
setDrinkType = "";
setDrinkType = "Mixed Drink";
Intent i = (new Intent(Bar.this, Drinks.class));
startActivity(i);
}
});
other.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
setDrinkType = "";
setDrinkType = "Other";
Intent i = (new Intent(Bar.this, Drinks.class));
startActivity(i);
}
});
getTaxi.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
Intent i = (new Intent(Bar.this, Taxi.class));
startActivity(i);
}
});
}
}
Drinks.java
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class Drinks extends Activity{
TextView drinkHolder;
public static String drinkType = Bar.setDrinkType;
String drinkTestHolder="";
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_drinks);
drinkTestHolder = drinkType;
drinkHolder = (TextView)findViewById(R.id.drinkTest);
//String barNameHolder = "#string/"+drinkType;
//int textInt1 = getResources().getIdentifier(barNameHolder, null, getPackageName());
drinkHolder.setText(drinkTestHolder);
}
}
Please, use instead for instance the intent sent to the launching Activity:
How do I get extra data from intent on Android?

Android Error on passing data from one activity to another acitvity

I am creating an app which calculates the total marks & percentage and shows the result in the next activity called ResultActvity. I am using same ResultActivity for showing result for 1st yr student & 2nd yr student marks, everything works fine when it come to show the result for 1st yr students but when it comes to show the result for second yr students it is only showing total marks but no % is shown. I am a newbie to android development please help me in fixing this. Thank You :).
FIRSTACTIVITY
package com.jntuhcalculator.anu.jntuhcalculator;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
/**
* Created by anu on 18/9/15.
*/
public class FirstMarks extends Activity {
TextView tv_Subjects1, tv_Internal1, tv_External1;
EditText et_Int_Eng, et_Int_M1, et_Int_MM, et_Int_Phy, et_Int_Chem, et_Int_Cp, et_Int_ElcsLab, et_Int_EpLab, et_Int_ItLab, et_Int_Draw;
EditText et_Ext_Eng, et_Ext_M1, et_Ext_MM, et_Ext_Phy, et_Ext_Chem, et_Ext_Cp, et_Ext_ElcsLab, et_Ext_EpLab, et_Ext_ItLab, et_Ext_Draw;
Button btn_Cal1, btn_Ok1;
int IEng,IM1,IMM,IEPhy,IEChem,ICp,IEDraw,IELCS_Lab,IEP_LAB,IIT_LAB;
int EEng,EM1,EMM,EEPhy,EEChem,ECp,EEDraw,EELCS_Lab,EEP_LAB,EIT_LAB;
int ITotal1,ETotal1,Total1;
float Percentage1;
String f1;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.marks_1);
//INITIALISING VIEWS.
//INITIALISING TEXT VIEWS.
tv_Subjects1 = (TextView) findViewById(R.id.tv_Subject1);
tv_Internal1 = (TextView) findViewById(R.id.tv_Internal1);
tv_External1 = (TextView) findViewById(R.id.tv_External1);
//INITIALISING EDIT TEXT.
//INTERNAL
et_Int_Eng = (EditText) findViewById(R.id.et_Int_Eng);
et_Int_M1 = (EditText) findViewById(R.id.et_Int_M1);
et_Int_MM = (EditText) findViewById(R.id.et_Int_MM);
et_Int_Phy = (EditText) findViewById(R.id.et_Int_Phy);
et_Int_Chem = (EditText) findViewById(R.id.et_Int_Chem);
et_Int_Cp = (EditText) findViewById(R.id.et_Int_Cp);
et_Int_ElcsLab = (EditText) findViewById(R.id.et_Int_ElcsLab);
et_Int_EpLab = (EditText) findViewById(R.id.et_Int_EpLab);
et_Int_ItLab = (EditText) findViewById(R.id.et_Int_ItLab);
et_Int_Draw = (EditText) findViewById(R.id.et_Int_Draw);
//EXTERNAL
et_Ext_Eng = (EditText) findViewById(R.id.et_Ext_Eng);
et_Ext_M1 = (EditText) findViewById(R.id.et_Ext_M1);
et_Ext_MM = (EditText) findViewById(R.id.et_Ext_MM);
et_Ext_Phy = (EditText) findViewById(R.id.et_Ext_Phy);
et_Ext_Chem = (EditText) findViewById(R.id.et_Ext_Chem);
et_Ext_Cp = (EditText) findViewById(R.id.et_Ext_Cp);
et_Ext_ElcsLab = (EditText) findViewById(R.id.et_Ext_ElcsLab);
et_Ext_EpLab = (EditText) findViewById(R.id.et_Ext_EpLab);
et_Ext_ItLab = (EditText) findViewById(R.id.et_Ext_ItLab);
et_Ext_Draw = (EditText) findViewById(R.id.et_Ext_Draw);
//INITIALISING BUTTON
btn_Cal1 = (Button) findViewById(R.id.btn_Cal1);
btn_Ok1 = (Button) findViewById(R.id.btn_Ok1);
//WHEN SAVE BUTTON IS CLICKED.
btn_Ok1.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
//GETTING VALUES FROM EDIT TEXT.
//INTERNALS.
IEng = getIntValue(et_Int_Eng);
IM1 = getIntValue(et_Int_M1);
IMM = getIntValue(et_Int_MM);
IEPhy = getIntValue(et_Int_Phy);
IEChem = getIntValue(et_Int_Chem);
ICp = getIntValue(et_Int_Cp);
IEDraw = getIntValue(et_Int_Draw);
IELCS_Lab = getIntValue(et_Int_ElcsLab);
IEP_LAB = getIntValue(et_Int_EpLab);
//EXTERNALS.
EEng = getIntValue(et_Ext_Eng);
EM1 = getIntValue(et_Ext_M1);
EMM = getIntValue(et_Ext_MM);
EEPhy = getIntValue(et_Ext_Phy);
EEChem = getIntValue(et_Ext_Chem);
ECp = getIntValue(et_Ext_Cp);
EEDraw = getIntValue(et_Ext_Draw);
EELCS_Lab = getIntValue(et_Ext_ElcsLab);
EEP_LAB = getIntValue(et_Ext_EpLab);
EIT_LAB = getIntValue(et_Ext_ItLab);
//CALCUATIONS.
//INTERNAL TOTAL.
ITotal1 = (IEng+IM1+IMM+IEPhy+IEChem+ICp+IEDraw+IELCS_Lab+IEP_LAB+IIT_LAB);
//EXTERNAL TOTAL.
ETotal1 = (EEng+EM1+EMM+EEPhy+EEChem+ECp+EEDraw+EELCS_Lab+EEP_LAB+EIT_LAB);
//TOTAL.
Total1 = (ITotal1+ETotal1);
//PERCENTAGE.
Percentage1 = (float)(Total1/10);
f1 = Float.toString(Percentage1);
//CREATING TOAST.
Toast.makeText(getBaseContext(),"Press Result",Toast.LENGTH_SHORT).show();
}
});
btn_Cal1.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Intent i = new Intent(FirstMarks.this,FirstResult.class);
Bundle b = new Bundle();
b.putInt("res1",Total1);
b.putString("per1",f1);
i.putExtras(b);
startActivity(i);
finish();
}
});
}
//SUB-FUNCTION FOR GETTING INTEGER FROM EDITTEXT.
private int getIntValue(EditText et) throws NumberFormatException {
int i =0;
String s;
try {
s = et.getText().toString();
if(s.equals("")){
Toast.makeText(getApplicationContext(),"Invalid Marks",Toast.LENGTH_SHORT).show();
}
i = Integer.parseInt(s);
return i;
} catch (NumberFormatException e) {
Log.e("ERROR:", "NOT A NUMBER");
}
return 0;
}
}
**SECONDACTIVITY**
package com.jntuhcalculator.anu.jntuhcalculator;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
/**
* Created by anu on 19/9/15.
*/
public class SecondMarks_1 extends Activity {
TextView tv_PS,tv_MFCS,tv_DS,tv_DLD,tv_EDC,tv_BEE,tv_EELab,tv_DSLab;
TextView tv_Subjects21, tv_Internal21, tv_External21;
EditText et_Int_PS, et_Int_MFCS, et_Int_DS, et_Int_DLD, et_Int_EDC, et_Int_BEE, et_Int_EELab, et_Int_DSLab;
EditText et_Ext_PS, et_Ext_MFCS, et_Ext_DS, et_Ext_DLD, et_Ext_EDC, et_Ext_BEE, et_Ext_EELab, et_Ext_DSLab;
Button btn_Cal21, btn_Ok21;
int IPS,IMFCS,IDS,IDLD,IEDC,IBEE,IEE_Lab,IDS_Lab;
int EPS,EMFCS,EDS,EDLD,EEDC,EBEE,EEE_Lab,EDS_Lab;
int ITotal21,ETotal21,Total21;
float Percentage21;
String f21;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.secondmarks_1);
//INITIALISING VIEWS.
//INITIALISING TEXT VIEWS.
tv_Subjects21 = (TextView) findViewById(R.id.tv_Subject21);
tv_Internal21 = (TextView) findViewById(R.id.tv_Internal21);
tv_External21 = (TextView) findViewById(R.id.tv_External21);
//SUBJECT TEXT VIEWS.
tv_PS = (TextView) findViewById((R.id.tv_PS));
tv_MFCS = (TextView) findViewById((R.id.tv_MFCS));
tv_DS = (TextView) findViewById((R.id.tv_DS));
tv_DLD = (TextView) findViewById((R.id.tv_DLD));
tv_EDC = (TextView) findViewById((R.id.tv_EDC));
tv_BEE = (TextView) findViewById((R.id.tv_BEE));
tv_EELab = (TextView) findViewById((R.id.tv_EE_Lab));
tv_DSLab = (TextView) findViewById((R.id.tv_DS_Lab));
//INITIALISING EDIT TEXT.
//INTERNAL
et_Int_PS = (EditText) findViewById(R.id.et_Int_PS);
et_Int_MFCS = (EditText) findViewById(R.id.et_Int_MFCS);
et_Int_DS = (EditText) findViewById(R.id.et_Int_DS);
et_Int_DLD = (EditText) findViewById(R.id.et_Int_DLD);
et_Int_EDC = (EditText) findViewById(R.id.et_Int_EDC);
et_Int_BEE = (EditText) findViewById(R.id.et_Int_BEE);
et_Int_EELab = (EditText) findViewById(R.id.et_Int_EELab);
et_Int_DSLab = (EditText) findViewById(R.id.et_Int_DSLab);
//EXTERNAL
et_Ext_PS = (EditText) findViewById(R.id.et_Ext_PS);
et_Ext_MFCS = (EditText) findViewById(R.id.et_Ext_MFCS);
et_Ext_DS = (EditText) findViewById(R.id.et_Ext_DS);
et_Ext_DLD = (EditText) findViewById(R.id.et_Ext_DLD);
et_Ext_EDC = (EditText) findViewById(R.id.et_Ext_EDC);
et_Ext_BEE = (EditText) findViewById(R.id.et_Ext_BEE);
et_Ext_EELab = (EditText) findViewById(R.id.et_Ext_EELab);
et_Ext_DSLab = (EditText) findViewById(R.id.et_Ext_DSLab);
//INITIALISING BUTTON
btn_Cal21 = (Button) findViewById(R.id.btn_Cal21);
btn_Ok21 = (Button) findViewById(R.id.btn_Ok21);
//DISPLAYING SUBJECT NAMES WHEN TEXT VIEW IS CLICKED.
tv_PS.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
disp(tv_PS, "PS:Probabilty & Statistics");
}
});
tv_MFCS.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
disp(tv_MFCS, "MFCS:Mathematical Foundation Of Computer Science");
}
});
tv_DS.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {disp(tv_DS, "DS:Data Structures");
}
});
tv_DLD.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
disp(tv_DLD, "DLD:Digital Logic Design");
}
});
tv_EDC.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
disp(tv_EDC, "EDC:Electronic Devices & Circuits");
}
});
tv_BEE.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) { disp(tv_BEE, "BEE:Basic Electrical Engineering");
}
});
tv_EELab.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) { disp(tv_EELab, "Electrical & Electronics Lab");
}
});
tv_DSLab.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {disp(tv_DSLab, "Data Structures Lab");
}
});
//WHEN SAVE BUTTON IS CLICKED.
btn_Ok21.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
//GETTING VALUES FROM EDIT TEXT.
//INTERNALS.
IPS = getIntValue(et_Int_PS);
IMFCS = getIntValue(et_Int_MFCS);
IDS = getIntValue(et_Int_DS);
IDLD = getIntValue(et_Int_DLD);
IEDC = getIntValue(et_Int_EDC);
IBEE = getIntValue(et_Int_BEE);
IEE_Lab = getIntValue(et_Int_EELab);
IDS_Lab = getIntValue(et_Int_DSLab);
//EXTERNALS.
EPS = getIntValue(et_Ext_PS);
EMFCS = getIntValue(et_Ext_MFCS);
EDS = getIntValue(et_Ext_DS);
EDLD = getIntValue(et_Ext_DLD);
EEDC = getIntValue(et_Ext_EDC);
EBEE = getIntValue(et_Ext_BEE);
EEE_Lab = getIntValue(et_Ext_EELab);
EDS_Lab = getIntValue(et_Ext_DSLab);
//CALCULATIONS.
//INTERNAL TOTAL.
ITotal21 = (IPS+IMFCS+IDS+IDLD+IEDC+IBEE+IEE_Lab+IDS_Lab);
//EXTERNAL TOTAL.
ETotal21 = (EPS+EMFCS+EDS+EDLD+EEDC+EBEE+EEE_Lab+EDS_Lab);
//TOTAL.
Total21 = (ITotal21+ETotal21);
//PERCENTAGE.
Percentage21 = ((Total21/750)*100);
f21 = Float.toString(Percentage21);
//CREATING TOAST.
Toast.makeText(getBaseContext(),"Press Result",Toast.LENGTH_SHORT).show();
}
});
btn_Cal21.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Intent i = new Intent(SecondMarks_1.this,FirstResult.class);
Bundle b = new Bundle();
b.putInt("res1",Total21);
b.putString("per1",f21);
i.putExtras(b);
startActivity(i);
finish();
}
});
}
//SUB-FUNCTION FOR GETTING INTEGER FROM EDITTEXT.
private int getIntValue(EditText et) throws NumberFormatException {
int i =0;
String s;
try {
s = et.getText().toString();
if(s.equals("")){
Toast.makeText(getApplicationContext(),"Invalid Marks",Toast.LENGTH_SHORT).show();
}
i = Integer.parseInt(s);
return i;
} catch (NumberFormatException e) {
Log.e("ERROR:", "NOT A NUMBER");
}
return 0;
}
private void disp(TextView tv,String s){
Toast.makeText(getApplicationContext(), s, Toast.LENGTH_SHORT).show();
}
}
**RESULTACTIVITY**
<pre><code>
package com.jntuhcalculator.anu.jntuhcalculator;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
/**
* Created by anu on 18/9/15.
*/
public class FirstResult extends Activity {
EditText et_Total1,et_Percentage1;
Button btn_Exit1;
int sres1;
String sper1;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.result_first);
//INITIALISING VIEWS.
et_Total1 = (EditText) findViewById(R.id.et_Total1);
et_Percentage1 = (EditText) findViewById(R.id.et_Percentage1);
btn_Exit1 = (Button) findViewById(R.id.btn_Exit1);
//GETTING DATA FROM PREVIOUS ACTIVITY.
Bundle b = getIntent().getExtras();
sres1 = b.getInt("res1", 0);
sper1 = b.getString("per1");
//Converting Float Into String.
//f = Float.toString(sper1);
//SETTING RESULTS.
et_Total1.setText(sres1+"");
et_Percentage1.setText(sper1+"%");
//WHEN EXIT IS CLICKED.
btn_Exit1.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Intent i = new Intent(getBaseContext(), YearDetails.class);
i.putExtra("Total",sres1);
startActivity(i);
finish();
System.exit(0);
}
});
}
}
You are properly not able to send values between different activities, i will give you an example, try it.
The syntax is like this
For sending data
String data = getIntent().getExtras().getString("keyName");
Intent intent = new Intent(ActivityOne.this, ActivityTwo.class);
intent.putExtra("keyName","value");
For receiving at ActivityTwo
String value= getIntent().getStringExtra("keyName");
Intent intent = getIntent();
Bundle extras = intent.getExtras();
Additional hint:-
So you need to edit in FirstActivity
btn_Cal21.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Intent i = new Intent(SecondMarks_1.this,FirstResult.class);
Bundle b = new Bundle();
b.putInt("res1",Total21);
b.putString("per1",f21);
i.putExtras(b);
startActivity(i);
finish();
}
});
Same for the following activities.
Still Did not get ? Actually in you FirstActivity you have put
Intent i = new Intent(FirstMarks.this,FirstResult.class);
Bundle b = new Bundle();
b.putInt("res1",Total1);
b.putString("per1",f1);
And in your second activity.
Intent i = new Intent(SecondMarks_1.this,FirstResult.class);
Bundle b = new Bundle();
b.putInt("res1",Total21);
b.putString("per1",f21);
i.putExtras(b);
startActivity(i);
You see you have used per1 string in both places, change that, that is probably causing the app not to get values(possibly give some other string).
And in this part, you need to add code for 2nd activity result to be received.
Bundle b = getIntent().getExtras();
sres1 = b.getInt("res1", 0);
sper1 = b.getString("per1");
Hope that helps.

Change the value of EditText with onClick Button?

In main.xml I made a row containing a TextView, an EditText and a "+" and "-" button.
Underneath that I made an "Add" button that will help you create a new row When you click the add button, you get an EditText and a Submit and Cancel button.
On "Submit" it outputs the EditText value to the TextView and creates the same row as the first one.
The numeric value "NewValueBox" should +1 when the "+" button is pressed.
But because I call it in another function it is not recognized by createNewAddButton() function in which the button is set up.
So in short:
"How do I change the value of NewValueBox when I click NewAddButton?"
Here's the code:
package com.lars.MyApp;
import com.google.ads.*;
import com.lars.MyApp.R;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import android.text.InputType;
import android.view.View;
import android.view.View.OnClickListener;
public class DrinkRecOrderActivity extends Activity {
int currentValue1 = 0;
int currentValueNew = 0;
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final EditText firstValue = (EditText) findViewById(R.id.firstValue);
Button valuePlus = (Button) findViewById(R.id.valuePlus);
Button valueMinus = (Button) findViewById(R.id.valueMinus);
final Button addValue = (Button) findViewById(R.id.add);
final TableLayout tableLayout1 = (TableLayout) findViewById(R.id.tableLayout1);
final LinearLayout addValueRow = (LinearLayout) findViewById(R.id.addValueRow);
final EditText addNewValue = (EditText) findViewById(R.id.addNewValue);
final Button submitNewValue = (Button) findViewById(R.id.submitNewValue);
final Button cancelNewValue = (Button) findViewById(R.id.cancelNewValue);
// BEGIN ONCLICKLISTENERS
valuePlus.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
plusValue();
firstValue.setText("" + currentValue1);
}
});
valueMinus.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
minValue();
firstValue.setText("" + currentValue1);
}
});
addValue.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
addValueRow.setVisibility(View.VISIBLE);
addValue.setVisibility(View.GONE);
}
});
cancelNewValue.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
addValueRow.setVisibility(View.GONE);
addValue.setVisibility(View.VISIBLE);
}
});
submitNewValue.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
tableLayout1.addView(createnewRow());
addValueRow.setVisibility(View.GONE);
addValue.setVisibility(View.VISIBLE);
addNewValue.setText("");
}
});
// END ONCLICKLISTENERS
// Look up the AdView as a resource and load a request.
AdView adView = (AdView) this.findViewById(R.id.adView);
adView.loadAd(new AdRequest());
}
public TableRow createNewRow() {
final TableRow newRow = new TableRow(this);
final EditText addNewValue = (EditText) findViewById(R.id.addNewValue);
newRow.addView(createNewTextView(addNewValue.getText().toString()));
newRow.addView(createNewValueBox());
newRow.addView(createNewAddButton());
newRow.addView(createNewMinusButton());
return newRow;
}
public TextView createNewTextView(String text) {
final TextView textView = new TextView(this);
textView.setText(text);
return textView;
}
public EditText createNewValueBox() {
EditText NewValueBox = new EditText(this);
NewValueBox.setHint("0");
NewValueBox.setInputType(InputType.TYPE_CLASS_NUMBER);
return NewValueBox;
}
public Button createNewAddButton() {
final Button NewAddButton = new Button(this);
NewAddButton.setText("+");
NewAddButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
plusNew();
//NewValueBox.setText("" + currentValueNew);
}
});
return NewAddButton;
}
public Button createNewMinusButton() {
final Button NewMinusButton = new Button(this);
NewMinusButton.setText("-");
return NewMinusButton;
}
// BEGIN PLUS AND MIN FUNCTIONS
public void plusNew() {
if (currentValueNew <= 999) {
currentValueNew = currentValueNew + 1;
}
}
public void plusValue() {
if (currentValue1 <= 999) {
currentValue1 = currentValue1 + 1;
}
}
public void minValue() {
if (currentValue1 >= 1) {
currentValue1 = currentValue1 - 1;
}
}
// END PLUS AND MIN FUNCTIONS
}
Add IDs for your Views so you can later reference them. Make 3 private static int field in your activity(the ID for NewValueBox, NewAddButton and NewMinusButton):
private static int edt = 1;
private static int add = 1001;
private static int minus = 2001;
Then in your createNewValueBox() method set the ID:
NewValueBox.setId(edt);
edt++;
Do the same for the NewAddButton and the NewMinusButton:
NewAddButton.setId(add);
add++;
NewMinusButton.setId(minus);
minus++;
Then in your listener for the buttons find out exactly which add button has been clicked and set the text in the corresponding EditText:
NewAddButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
plusNew();
int tmp = v.getId();
EditText temp = (EditText) findViewById(1 + (tmp - 1001));
temp.setText("" + currentValueNew);
}
Kind of hackish method.

Categories

Resources