-2

the table code

 public class Main5Activity extends AppCompatActivity {

    @Override
     protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main5);

    {
        TableLayout markstable = (TableLayout) findViewById(R.id.datatable);
        TableRow tableRow = new TableRow(this);
        TextView tv0 = new TextView(this);
        tv0.setText(" Student ");
        tv0.setTextColor(Color.WHITE);
        tableRow.addView(tv0);
        TextView tv1 = new TextView(this);
        tv1.setText(" Oral Mark ");
        tv1.setTextColor(Color.WHITE);
        tableRow.addView(tv1);
        TextView tv2 = new TextView(this);
        tv2.setText(" Home Work ");
        tv2.setTextColor(Color.WHITE);
        tableRow.addView(tv2);
        TextView tv3 = new TextView(this);
        tv3.setText(" Test ");
        tv3.setTextColor(Color.WHITE);
        tableRow.addView(tv3);
        markstable.addView(tableRow);
        for (int i = 0; i < 50; i++) {
            TableRow tableRow1 = new TableRow(this);
            TextView t1v = new TextView(this);
            t1v.setText( + i);
            t1v.setTextColor(Color.WHITE);
            t1v.setGravity(Gravity.CENTER);
            tableRow1.addView(t1v);
            TextView t2v = new TextView(this);
            t2v.setText("Student " + i);
            t2v.setTextColor(Color.WHITE);
            t2v.setGravity(Gravity.CENTER);
            tableRow1.addView(t2v);
            TextView t3v = new TextView(this);
            t3v.setText("Student" + i);
            t3v.setTextColor(Color.WHITE);
            t3v.setGravity(Gravity.CENTER);
            tableRow1.addView(t3v);
            TextView t4v = new TextView(this);
            t4v.setText( + i * 15 / 32 * 10);
            t4v.setTextColor(Color.WHITE);
            t4v.setGravity(Gravity.CENTER);
            tableRow1.addView(t4v);
            markstable.addView(tableRow1);

                     }

              }
           }
       }

here, i try to make a table for a teacher to save the students names and marks in it and save it to edit it, delete it or replace it the table just crashes, by the way i;m trying to make them a text field to enter data but it also crashes this is my error:

Process: com.mohnad.theeducationnewera.marksbook, PID: 4321
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mohnad.theeducationnewera.marksbook/com.mohnad.theeducationnewera.marksbook.Main5Activity}: android.content.res.Resources$NotFoundException: String resource ID #0x0
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
        at android.app.ActivityThread.access$800(ActivityThread.java:144)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:135)
        at android.app.ActivityThread.main(ActivityThread.java:5221)
        at java.lang.reflect.Method.invoke(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:372)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
     Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x0
        at android.content.res.Resources.getText(Resources.java:274)
        at android.widget.TextView.setText(TextView.java:4122)
        at com.mohnad.theeducationnewera.marksbook.Main5Activity.onCreate(Main5Activity.java:45)
        at android.app.Activity.performCreate(Activity.java:5933)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360) 
        at android.app.ActivityThread.access$800(ActivityThread.java:144) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:135) 
        at android.app.ActivityThread.main(ActivityThread.java:5221) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at java.lang.reflect.Method.invoke(Method.java:372) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694) 
MikeT
  • 51,415
  • 16
  • 49
  • 68

1 Answers1

0

It looks like it telling you that it doesn't know what the variable resource ID is:

Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x0

Just a guess after looking at what you posted

mattt
  • 45
  • 5
  • Also, I would check out this posting:https://stackoverflow.com/questions/15191092/android-content-res-resourcesnotfoundexception-string-resource-id-fatal-except/15191120 – mattt Oct 12 '18 at 19:42
  • You may have to edit your code to t1v.setText(String.valueOf(+i)); – mattt Oct 12 '18 at 19:43