World of Thoughts and Telepathy through the eyes of Science

As humans, we can identify galaxies light years away, we can study particles smaller than an atom. But we still haven’t unlocked the mystery of the three pounds of matter that sits between our ears. – US President Obama on the BRAIN initiative

The human brain has 100 billion neurons, each neuron connected to 10 thousand other neurons. Sitting on your shoulders is the most complicated object in the known universe – Michio Kaku.

“Know Thyself” – A Greek Motto

Introduction

Like most of us I too have this burning desire to understand the real ME which gives me a feeling of “I” or “Self”. Some theory suggests that its all in the brain, with our Prefrontal Cortex responsible for this, and some that its more than that. There are no easy answers and that’s why we have Science to our rescue.

Two theories of Consciousness

1. One theory suggests that our Brains are like Generators which can produce current / signals. If we go by this analogy then the concept of Consciousness vanishes. Our brains are so evolved and capable that it integrates all the information and presents it in a cohesive manner.

2. A second theory suggests that our Brains are analogous to television or radio sets which receives signals or instructions from some source.

In this article I do not explore this Science of Consciousness, which I plan to do in a future post, but I do want to share some of the cutting edge research, taking place worldwide, in the field of Brain and Neuroscience.

Continue reading “World of Thoughts and Telepathy through the eyes of Science”

Android Basics – How to use findViewById method

If you want to reference any UI component, defined in the Layout XML file, then you need to use the findViewById method.

In your Activity class add the following code snippet

TextView helloText = (TextView) findViewById(R.id.helloId);
if(helloText != null){
Log.v(TAG, “Lets check the value in hello id “+helloText.getText());
}

Once you get a reference you can perform operations on the element.

Code: https://github.com/ankur-srivastava/HelloAndroid/blob/master/app/src/main/java/com/edocent/helloandroid/MainActivity.java

Android Basics – Add a Button and display a Toast on click

Time for some Action. Let’s add a Button to the Layout XML file and on click of button let’s display a message to the user.

Simple Steps

Add a Button component to the XML file.

<Button
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/buttonId"
    android:text="Click Me"
    android:onClick="clickMe"
    android:layout_margin="15dp"/>



Add a method to the MainActivity class.

public void clickMe(View view){
    Toast.makeText(MainActivity.this, "Button Clicked !!", Toast.LENGTH_SHORT).show();
}

You are all set. Test your app now.

Source Code  

https://github.com/ankur-srivastava/HelloAndroid/tree/master/app/src/main/java/com/edocent/helloandroid

Android Basics – What is an R file ?

R is a Java Class file which is autogenerated by Android for your Project. It contains a list of all Resources being used.

For example if you have the following TextView in your Layout

<TextView
android:id=”@+id/helloId”
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:text=”Hello Android !!”/>

Android will create the following entry in the R file for this ID.

public static final int helloId=0x7f0c0069;

This helps us to reference this UI component in our Activity Class.

Android Basics – How to Add Log to your Class for Debug Purpose

Using Log statements in your Android Project is both useful and important. It will help you to debug problems.

 

The following Log levels are available in Android

  • Debug
  • Verbose
  • Error
  • Warn
  • Info
  • Error
  • Assert

To add a Log statement to your MainActivity Class simply add the following code statement to the onCreate method.

Log.v(MainActivity.class.getSimpleName(), “In onCreate”);

 

Android Basics – A quick look at the Layout File in Android Project

In the last Article you learnt about MainActivity class. Let’s look at the Layout XML file.

The Layout file is responsible for the User Interface (UI). It’s what you see when you Launch an App.

The File can have Text, Buttons and other elements. Just like a website.

Go ahead an open the content_main.xml file in the new Project. As you can see this XML file contains two primary XML tags:

1. RelativeLayout : This Element tells Android to put elements relative to each other.
2. TextView : This Element is used to display Text.

The android:text attribute in the TextView element is used to display Text. Go ahead and modify this. Save and test. In the next Video we will add a Button to this Layout file.

Android Basics – What is an Activity in Android

In the last video you saw the Android Manifest File.

Let’s look at the MainActivity class. The MainActivity class is called when you Launch the App.

This Class is an Activity. Now you might be wondering what is an Activity. An Activity is used to peform certain basic setup tasks when the App Launches. Like specify the Layout
which the App will use. All activities should extend Activity class and implement the onCreate method which gets called when the activity object gets created.

I hope this gives you an idea about the MainActivity Class. We will look at the activity life cycle a little later. In the next video you will see the Layout file. Until next time, bye.

Android Basics – A quick look at the Android Manifest File in Android Project

Now that you have a basic Android App and have been able to run it in the Emulator. It’s time to look at the Manifest file.

The Manifest file is used to define your App settings. Like Name of the App, the App Theme, Launcher Icon, Activities and more.

The important thing to understand is the definition of the MainActivity. The MainActivity class is used by Android when your App Launches.

Android Basics – How to Use Github to Maintain Your Android Project Source Code

In the last Article you got an overview of Git and GitHub.

The following Video Tutorial will help you to connect your Android Project to GitHub.

GitHub is a great way to not only maintain your Code Versions but also to showcase your Work and Collaborate with others.

Source Code – https://github.com/ankur-srivastava/HelloAndroid