title: Android app working on emulator but not on real device
body: <p>Just wrote this simple app for testing: one button that displays date and hour, and another button that selects a random color and shows it.
  It works fine on Emulator but the buttons do nothing (don't work) when i try to run the app on a real device.</p>
  
  <p>Can someone help me understand why?</p>
  
  <p>MainActivity.java:</p>
  
  <pre><code>package yuvallevy.allyouneedapp;
  
  import android.graphics.Color;
  import android.os.Bundle;
  import android.support.v7.app.AppCompatActivity;
  import android.view.View;
  import android.widget.Button;
  import android.widget.TextView;
  
  import java.util.Date;
  import java.util.Random;
  
  public class MainActivity extends AppCompatActivity {
  
      private Button btnShowTime;
      private Button btnRandomColor;
      private TextView timeText;
      private TextView randomColorView;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          btnRandomColor = (Button) findViewById(R.id.btnRandomColor);
          btnShowTime = (Button) findViewById(R.id.btnShowTime);
          timeText = (TextView) findViewById(R.id.timeText);
          randomColorView = (TextView) findViewById(R.id.randomColorView);
  
          btnShowTime.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  String currentDataTimeString = java.text.DateFormat.getDateTimeInstance().format(new Date());
                  timeText.setText(currentDataTimeString);
              }
          });
  
          btnRandomColor.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  Random rnd = new Random();
                  int color = Color.argb(255, rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256));
                  randomColorView.setBackgroundColor(color);
              }
          });
      }
  }
  </code></pre>
  
  <p>activity_main.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout 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"&gt;
  
  
      &lt;Button
          android:id="@+id/btnShowTime"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentLeft="true"
          android:layout_toLeftOf="@+id/randomColorView"
          android:layout_toStartOf="@+id/randomColorView"
          android:text="Show Time"
          android:textAppearance="?android:attr/textAppearanceLarge" /&gt;
  
      &lt;TextView
          android:id="@+id/timeText"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_above="@+id/btnRandomColor"
          android:layout_alignParentEnd="true"
          android:layout_alignParentRight="true"
          android:layout_alignParentTop="true"
          android:layout_toEndOf="@+id/btnRandomColor"
          android:layout_toRightOf="@+id/btnRandomColor" /&gt;
  
      &lt;Button
          android:id="@+id/btnRandomColor"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentLeft="true"
          android:layout_below="@id/btnShowTime"
          android:text="Random Color"
          android:textAppearance="?android:attr/textAppearanceLarge" /&gt;
  
      &lt;TextView
          android:id="@+id/randomColorView"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignBottom="@+id/btnRandomColor"
          android:layout_alignParentEnd="true"
          android:layout_alignParentRight="true"
          android:layout_alignTop="@+id/btnRandomColor"
          android:layout_toRightOf="@+id/btnRandomColor" /&gt;
  
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>AndoirdManifest.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="yuvallevy.allyouneedapp" &gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name"
          android:supportsRtl="true"
          android:theme="@style/AppTheme" &gt;
          &lt;activity android:name=".MainActivity" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>