title: Create multiplication table layout
body: <p>I am trying to generate Multiplication Table of any number that is input by user. I have developed the interface for the application but cannot understand where to start with the logical part(coding). What i want is when a user inputs a number into the EditText then in the TextView (id: printArea) should show the table of the input number in the format as given in image 2. [Just to show you example i used TextView in the printArea part and i do not know what to use instead] </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"
      tools:context=".MainActivity"
      android:weightSum="1"&gt;
  
      &lt;LinearLayout
  
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:orientation="horizontal"&gt;
  
          &lt;TextView
              android:id="@+id/textView1"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_marginBottom="16dp"
              android:text="Please Enter a Number: "
              android:textSize="20sp" /&gt;
  
          &lt;EditText
              android:id="@+id/num"
              android:layout_width="90dp"
              android:layout_height="wrap_content"
              android:layout_alignParentStart="true"
              android:layout_marginLeft="30dp"
              android:textSize="20sp" /&gt;
  
      &lt;/LinearLayout&gt;
  
  
      &lt;Button
          android:id="@+id/calculate"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_alignParentStart="true"
          android:layout_below="@+id/log"
          android:onClick="submitNumber"
          android:text="Get Table" /&gt;
  
  &lt;TextView
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_weight="1.0"
      android:id="@+id/printArea" /&gt;
  
      &lt;LinearLayout
  
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:orientation="horizontal"&gt;
  
          &lt;Button
              android:id="@+id/clear"
              android:layout_width="125dp"
              android:layout_height="wrap_content"
              android:layout_marginLeft="2dp"
              android:layout_marginRight="1dp"
              android:text="Clear" /&gt;
  
          &lt;Button
              android:id="@+id/credits"
              android:layout_width="125dp"
              android:layout_height="wrap_content"
              android:layout_marginLeft="1dp"
              android:layout_marginRight="1dp"
              android:text="Credits" /&gt;
  
          &lt;Button
              android:id="@+id/exit"
              android:layout_width="125dp"
              android:layout_height="wrap_content"
              android:layout_marginLeft="1dp"
              android:layout_marginRight="2dp"
              android:text="Exit" /&gt;
  
      &lt;/LinearLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>and the MainActivity.java is: </p>
  
  <pre class="lang-java prettyprint-override"><code>package com.example.tara.multiplicationtable;
  
  
  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 MainActivity extends AppCompatActivity {
  
      EditText num;
      Button credits;
      Button calculate;
      Button clear;
      Button exit;
      TextView printArea;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
  
          num = new EditText(this);
          clear = new Button(this);
          calculate = new Button(this);
          credits = new Button(this);
          calculate = new Button(this);
          printArea = new TextView(this);
  
          num = (EditText) findViewById(R.id.num);
  
          credits = (Button) findViewById(R.id.credits);
          clear = (Button) findViewById(R.id.clear);
          exit = (Button) findViewById(R.id.exit);
          printArea = (TextView) findViewById(R.id.printArea);
  
  
          calculate = (Button) findViewById(R.id.calculate);
  
          calculate.setOnClickListener(new View.OnClickListener() {
              public void onClick(View v) {
  
                  //change the integer value into string
                  int num1 = Integer.parseInt(num.getText().toString());
  
                  // Perform action on click
                  for (int i = 1; i &lt;= 10; i++) {
  
                      printArea.setText(num1 + "X" + i + "=" + i * num1);
  
  
                  }
              }
          });
  
          clear.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
  
                  num.setText("");
              }
          });
          credits.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  Intent i = new Intent(MainActivity.this, Credits.class);
                  startActivity(i);
              }
          });
          exit.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  finish();
                  System.exit(0);
              }
          });
      }
  
  }
  </code></pre>
  
  <p>when application is launched it should show like this<a href="http://i.stack.imgur.com/pFmkU.jpg" rel="nofollow">The initial state of application</a></p>
  
  <p>and i want to make the application show the table like this if user input is 2  <a href="http://i.stack.imgur.com/XIeT1.jpg" rel="nofollow">The Final Result</a></p>