Code not working(android) - java

I know it's a pretty amateur question , but i am really getting frustrated:
I am not getting an error but its just not working.(Ignore the bundle part)package com.example.project1;import android.app.Activity;
here's the java file
package com.example.project1;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class Tictactoe2 extends Activity implements OnClickListener{
EditText et1 , et2;
String str1 , str2;
Button b1;
TextView tv2;
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.ttt);
et1 = (EditText) findViewById (R.id.et1);
et2 = (EditText) findViewById (R.id.et2);
tv2 = (TextView) findViewById (R.id.tv2);
str1 = et1.getText().toString();
str2 = et2.getText().toString();
b1 = (Button) findViewById (R.id.b1);
b1.setOnClickListener(this);
}
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
switch(v.getId())
{
case R.id.b1:
tv2.setText(str1);
/*Bundle bun = new Bundle();
bun.putString("key", str1);
bun.putString("key1", str2);;
Intent intent = new Intent(tictactoe2.this , tictactoe.class);
intent.putExtras(bun);
startActivity(intent);*/
break;
}}
}

I guess you got NPE. You need to remove this lines
str1 = et1.getText().toString();
str2 = et2.getText().toString();
It's because you're trying to getText() from EditText and there is no Text in it. So i would suggest you move this lines under some Listener events where you get values after you set value in your EditText.
You implement like
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
switch(v.getId())
{
case R.id.b1:
str1 = et1.getText().toString();
str2 = et2.getText().toString();
tv2.setText(str1);
}}

package com.example.project1;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class Tictactoe2 extends Activity implements OnClickListener{
EditText et1 , et2;
String str1 , str2;
Button b1;
TextView tv2;
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.ttt);
et1 = (EditText) findViewById (R.id.et1);
et2 = (EditText) findViewById (R.id.et2);
tv2 = (TextView) findViewById (R.id.tv2);
b1 = (Button) findViewById (R.id.b1);
b1.setOnClickListener(this);
}
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
switch(v.getId())
{
case R.id.b1:
str1 = et1.getText().toString();
str2 = et2.getText().toString();
tv2.setText(str1);
/*Bundle bun = new Bundle();
bun.putString("key", str1);
bun.putString("key1", str2);;
Intent intent = new Intent(tictactoe2.this , tictactoe.class);
intent.putExtras(bun);
startActivity(intent);*/
break;
}}
}

you should place your "str1" String and textview and edittext code in your onClick.
like this:
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
switch(v.getId())
{
case R.id.b1:
et1 = (EditText) findViewById (R.id.et1);
tv2 = (TextView) findViewById (R.id.tv2);
str1 = et1.getText().toString();
tv2.setText(str1);
/*Bundle bun = new Bundle();
bun.putString("key", str1);
bun.putString("key1", str2);;
Intent intent = new Intent(tictactoe2.this , tictactoe.class);
intent.putExtras(bun);
startActivity(intent);*/
break;
}}

Related

How to stay in same activity after clicking button in android?

I am trying to develop simple feedback application. When user enters invalid data it should show error. After error is detected all fields should be clear and I should stay on same activity What should I do?Here's my code:
package com.example.feedback;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.Toast;
public class Feedback extends Activity {
String s;
boolean fill=true;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_feedback);
final Button bt1 = (Button) findViewById(R.id.bt1);
final EditText tv2 = (EditText) findViewById(R.id.tv2);
final EditText tv1 = (EditText) findViewById(R.id.tv1);
final EditText tv3 = (EditText) findViewById(R.id.tv3);
final EditText tv4 = (EditText) findViewById(R.id.tv4);
final RadioGroup rg = (RadioGroup) findViewById(R.id.rg1);
bt1.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View arg0) {
s = tv1.getText().toString();
check();
s = tv2.getText().toString();
check();
s = tv3.getText().toString();
check();
s = tv4.getText().toString();
check();
if (rg.getCheckedRadioButtonId() == -1){
Toast.makeText(Feedback.this,"Error",Toast.LENGTH_LONG).show();
}
Toast.makeText(Feedback.this,"Press again to Submit",Toast.LENGTH_LONG).show();
bt1.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View arg0) {
startActivity(new Intent(Feedback.this,Feedback2.class));
// TODO Auto-generated method stub
}
});
// TODO Auto-generated method stub
}
private void check() {
if(s.matches("")){
Toast.makeText(Feedback.this,"Error",Toast.LENGTH_LONG).show();
}
// TODO Auto-generated method stub
}
});
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.feedback, menu);
return true;
}
}
this is the line:
startActivity(new Intent(Feedback.this,Feedback2.class));
after the click, change activity.
I suggest you to check login success in onActivityResult method and if it's true than start new activity

Android camera application. Two activities

I am trying to deveolp an Android application. I am learning Android so there I go.
My aplication is similar to this one: http://www.tutorialspoint.com/android/android_camera.htm ;
Except I have two activities.. One is called Report.java and the other one is called Form.java.
In Report.java, I have a button, when I click the button, I want to open the camera and take a picture. After I took the picture, I want to start the second activity (Form.java) and my image to be saved in an ImageView.
How can I do that? Thank you in advance.
Report.java
package com.example.harta;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
public class Report extends Activity implements View.OnClickListener{
ImageView iv;
Button report;
final static int cameraData = 0;
Bitmap bmp;
Intent i;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.report);
initialize();
report.setOnClickListener(this);
}
private void initialize() {
// TODO Auto-generated method stub
report = (Button) findViewById(R.id.bReport);
}
public void onClick(View v) {
// TODO Auto-generated method stub
switch(v.getId()){
case R.id.bReport:
i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(i, cameraData);
break;
}
}
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
if(resultCode == RESULT_OK){
Bundle extras = data.getExtras();
bmp = (Bitmap) extras.get("data");
Intent i = new Intent(Report.this, Formular.class);
startActivity(i);
}
}
}
Form.java
package com.example.harta;
import java.io.IOException;
import java.io.InputStream;
import android.app.Activity;
import android.app.WallpaperManager;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.TextView;
public class Formular extends Activity{
Button button;
ImageView iv;
int cameraResults;
final static int cameraData = 0;
Bitmap bmp;
TextView tvAdress, tvAmpers, tvCommunication, tvCoordinates;
TextView tvName, tvInformations, tvDataIntro, tvPhone, tvLatitude;
TextView tvLongitude, tvInstalledPower, tvContor, tvNetwork;
EditText etAdress, etAmpers, etCommunication, etCoordinates;
EditText etName, etInformations, etDataIntro, etPhone, etLatitude;
EditText etLongitude, etInstalledPower, etContor, etNetwork;
Spinner spinNetwork;
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.formular);
initialize();
}
private void initialize() {
// TODO Auto-generated method stub
tvAdress = (TextView) findViewById(R.id.tvAdresa);
tvAmpers = (TextView) findViewById(R.id.tvAmperaj);
tvCommunication = (TextView) findViewById(R.id.tvComunicatie);
tvCoordinates = (TextView) findViewById(R.id.tvCoord);
tvName = (TextView) findViewById(R.id.tvDenumire);
tvInformations = (TextView) findViewById(R.id.tvInfo);
tvDataIntro = (TextView) findViewById(R.id.tvIntroducereDate);
tvPhone = (TextView) findViewById(R.id.tvIPtelefon);
tvLatitude = (TextView) findViewById(R.id.tvLat);
tvLongitude = (TextView) findViewById(R.id.tvLong);
tvInstalledPower = (TextView) findViewById(R.id.tvPutereInstalata);
tvContor = (TextView) findViewById(R.id.tvSerieContor);
tvNetwork = (TextView) findViewById(R.id.tvTipulRetelei);
etAdress = (EditText) findViewById(R.id.etAdresa);
etAmpers = (EditText) findViewById(R.id.etAmperaj);
etCommunication = (EditText) findViewById(R.id.etComunicatie);
etName = (EditText) findViewById(R.id.etDenumire);
etPhone = (EditText) findViewById(R.id.etIPtelefon);
etInstalledPower = (EditText) findViewById(R.id.etPutereInstalata);
etContor = (EditText) findViewById(R.id.etSerieContor);
spinNetwork = (Spinner) findViewById(R.id.spinTipulRetelei);
button = (Button) findViewById(R.id.bTrimitere);
iv = (ImageView) findViewById(R.id.ivPic);
}
public void onClick(View v) {
// TODO Auto-generated method stub
}
}

Android ( Intent )

i have these peace of code taht is written by eclipse and which gives me no syntax error
but when i run it , it says intent_ has stopped working
Here is my code:
package com.example.intent_;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends Activity {
TextView t1, t2, t3;
EditText tf1;
Button b1, b2;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toast.makeText(MainActivity.this, "Welcome to On create", Toast.LENGTH_LONG).show();
b1 = (Button) findViewById(R.id.button1);
t1 = (TextView) findViewById(R.id.textView1);
t2 = (TextView) findViewById(R.id.textView2);
t3 = (TextView) findViewById(R.id.textView3);
b1 = (Button) findViewById(R.id.button1);
tf1 = (EditText) findViewById(R.id.editText1);
b1.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
t1.setText("Abed-Almalik");
t2.setText("Jorda-jerash");
t3.setText("2010901092");
}
});
b2.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
String url = "http://www.google.com";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
}
});
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
Please help me solve the problem
Thank you !
My guess is that b2 wasn't defined.
so b2.setOnClickListener will give you a null pointer error.
Further to Saba's answer - you have this twice
b1 = (Button) findViewById(R.id.button1);
The second one should probably be b2 = ...
You haven't any button b2 for b2.setOnClickListener
//running code is below
package com.example.intent_;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends Activity {
TextView t1, t2, t3;
EditText tf1;
Button b1, b2;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toast.makeText(MainActivity.this, "Welcome to On create", Toast.LENGTH_LONG).show();
b1 = (Button) findViewById(R.id.button1);
t1 = (TextView) findViewById(R.id.textView1);
t2 = (TextView) findViewById(R.id.textView2);
t3 = (TextView) findViewById(R.id.textView3);
b2 = (Button) findViewById(R.id.button2); //here change it to b2 and button2
tf1 = (EditText) findViewById(R.id.editText1);
b1.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
t1.setText("Abed-Almalik");
t2.setText("Jorda-jerash");
t3.setText("2010901092");
}
});
b2.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
String url = "http://www.google.com";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
}
});
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}

how to use content provider to access shared preferences

i have a registration app in the making where the user registers the data and on the other end the data can be shown and viewed and manipulated , i am using shared preferences method as shown below to write and access data (you can see them in DataEntry.java & DataManipulation.java shown below) but i want to use content provider method to manipulate data like quering or inserting or deleting....is there a way to do this and if yes can you please tell me how?
thank you
here are the codes below
the User end DataEntry.java:
package com.hossa.datamanipulation;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
public class DataEntry extends Activity {
/*
* here is the part the user will submit several data for several people
*/
Button Submit, BroadcastButton;
TextView User, Email, Mobile;
EditText UserEdit, EmailEdit, MobileEdit;
String UserValue, EmailValue, MobileValue;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.dataentry);
Submit = (Button) findViewById(R.id.DataSubmit);
BroadcastButton = (Button) findViewById(R.id.Broadcast);
User = (TextView) findViewById(R.id.TVuser);
Email = (TextView) findViewById(R.id.TVemail);
Mobile = (TextView) findViewById(R.id.TVmobile);
UserEdit = (EditText) findViewById(R.id.Edituser);
EmailEdit = (EditText) findViewById(R.id.Editemail);
MobileEdit = (EditText) findViewById(R.id.Editmobile);
Submit.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
// saving the data of the user//
SharedPreferences sp = getSharedPreferences("userdata",
MODE_PRIVATE);// name of the file and it's mode//
SharedPreferences.Editor edit = sp.edit();// to be able to edit
// the file//
edit.putString("Username", UserEdit.getText().toString());// get
// the
// input
// username//
edit.putString("Email", EmailEdit.getText().toString());// get
// the
// input
// Email//
edit.putString("Mobile", MobileEdit.getText().toString());// get
// the
// input
// Mobile//
edit.commit();
Toast.makeText(getApplicationContext(),
"Data is Saved Successfully", Toast.LENGTH_SHORT)
.show();
}
});
BroadcastButton.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent e = new Intent();
e.setAction("com.hossa.data" + "manipulation.custombroadcast");
sendBroadcast(e);
}
});
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
and the other end DataManipulaton.java:
import android.app.Activity;
import android.content.ContentResolver;
import android.content.Context;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
public class DataManipulation extends Activity {
Button ImportButton, ViewButton, RetrieveButton;
EditText UserShow;
TextView EmailDisplay, UserDisplay, MobileDisplay, EmailTV, UserTV,
MobileTV;
public static final String defaultvalue = "N/A";
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.datamanipulation);
ContentResolver ct = getContentResolver();
String Path = "data/data/com.hossa.datamanipulation/files/userdata";
Uri uri = Uri.parse("content://" + Path);
ImportButton = (Button) findViewById(R.id.ImportButton);
ViewButton = (Button) findViewById(R.id.ViewButton);
RetrieveButton = (Button) findViewById(R.id.RetrieveButton);
EmailDisplay = (TextView) findViewById(R.id.EmailDisplay);
MobileDisplay = (TextView) findViewById(R.id.MobileDisplay);
UserDisplay = (TextView) findViewById(R.id.UsernameDisplay);
EmailTV = (TextView) findViewById(R.id.EmailTV2);
UserTV = (TextView) findViewById(R.id.UserTV2);
MobileTV = (TextView) findViewById(R.id.MobileTV2);
final String U1[] = new String[10];
final String E1[] = new String[10];
final String M1[] = new String[10];
final String[][] alldata = new String[][] { U1, M1, E1 };
RetrieveButton.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
int i = 0;
SharedPreferences spdata = getSharedPreferences("userdata",
Context.MODE_PRIVATE);
while (spdata.getString("Username", defaultvalue) != null) {
String tempuser = spdata
.getString("Username", defaultvalue);
U1[i] = tempuser;
i++;
}
i = 0;
while (spdata.getString("Email", defaultvalue) != null) {
String tempemail = spdata.getString("Email", defaultvalue);
E1[i] = tempemail;
i++;
}
i = 0;
while (spdata.getString("Mobile", defaultvalue) != null) {
String tempmobile = spdata
.getString("Mobile", defaultvalue);
M1[i] = tempmobile;
i++;
}
i = 0;
}
});
ImportButton.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
getApplicationContext();
// TODO Auto-generated method stub
SharedPreferences sp = getSharedPreferences("userdata",
Context.MODE_PRIVATE);
String Username = sp.getString("Username", defaultvalue);
String Email = sp.getString("Email", defaultvalue);
String Mobile = sp.getString("Mobile", defaultvalue);
// what if there is no data from the user??//
if (Username.equals(defaultvalue) || Email.equals(defaultvalue)
|| Mobile.equals(defaultvalue)) {
Toast.makeText(getApplicationContext(),
"no data has been entered", Toast.LENGTH_SHORT)
.show();
} else {
UserTV.setText(Username);
EmailTV.setText(Email);
MobileTV.setText(Mobile);
}
}
});
//THE BELOW IS THE SECTION I NEED HELP WITH...THE ABOVE IS SIMPLY SOME TRIALS AND TESTS//
Cursor c = ct.query(uri, U1, null, null, null);
// c=ct.delete(uri, where, selectionArgs);
// c=ct.update(uri, values, where, selectionArgs);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
PLEASE NOTE THAT BOTH CLASSES ARE IN THE SAME PACKAGE SO IT IS THE SAME APP NOT 2 DIFFERENT APPS

Get text from dynamically created EditText

in the program I have 3 fields to enter when I enter data and pressed for starting the button below creates three dynamic input fields, the program calculates the average score of only 3 top fields. I want that when the user changed any data in dynamically created fields it counted the data from these fields, regardless of their number
package com.example.averegemark;
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TableRow.LayoutParams;
import android.widget.TextView;
import android.widget.Toast;
public class Table extends Activity {
LinearLayout LL;
EditText et1,et2,et3;
double coef=0,points=0,sum=0,coefsum=0;
TextView total;
Button bNext;
String name="",mark="",coeff="";
int i=0;
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.table);
bNext = (Button) findViewById(R.id.bNext);
et1 = (EditText) findViewById(R.id.et1);
et2 = (EditText) findViewById(R.id.et2);
et3 = (EditText) findViewById(R.id.et3);
total = (TextView) findViewById(R.id.tvTotal);
total.setText("GPA:");
LL = (LinearLayout) findViewById(R.id.LL);
bNext.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
name = et1.getText().toString();
mark = et2.getText().toString();
coeff = et3.getText().toString();
if(mark.length()==0 || coeff.length()==0)
Toast.makeText(getApplicationContext(), "Enter mark `and coefficient", Toast.LENGTH_LONG).show();
else
NewView(name,mark,coeff);
}
});
}
private void NewView(String name, String mark, String coeff) {
// TODO Auto-generated method stub
EditText info1 = new EditText(this);
EditText info2 = new EditText(this);
EditText info3 = new EditText(this);
info1.setId(i);i++;
info1.setId(i);i++;
info1.setId(i);i++;
info1.setText(""+name);
info2.setText(""+mark);
info3.setText(""+coeff);
TableLayout table = (TableLayout) findViewById(R.id.tbl);
table.setLayoutParams(new TableLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
TableRow row = new TableRow(this);
row.setLayoutParams(new TableRow.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
row.addView(info1);
row.addView(info2);
row.addView(info3);
table.addView(row);
String rez="";
rez= info2.getText().toString();
points = Double.parseDouble(rez);
rez= info3.getText().toString();
coef = Double.parseDouble(rez);
sum +=coef*points;
coefsum+=coef;
sum/=coefsum;
total.setText("GPA : "+sum+"\nCoefficient sum. "+coefsum);
et3.setText("");
et2.setText("");
et1.setText("");
et1.requestFocus();
}
}
so when I will change any data in row , i want to recalculate this, but here it use only top EditText not dynamically created :
String rez="";
rez= info2.getText().toString();
points = Double.parseDouble(rez);
rez= info3.getText().toString();
coef = Double.parseDouble(rez);
sum +=coef*points;
coefsum+=coef;
sum/=coefsum;
total.setText("GPA : "+sum+"\nCoefficient sum. "+coefsum);
When you press the button, you get the information from the original edittexts. You have to find the last row in the table and get the edittexts from there.
CharSequence data = ((TextView) v).getText();
String result = data.toString();

Categories

Resources