Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts

Friday, 15 April 2016

A Good Start Towards Android Development

Do you want to be an android developer but have no idea where to start? Then this article is for you. Generally, people try to learn Java first and then move on to Android Development.  I would recommend that you directly start with Android Development and to do so there are a few courses that will really help you out.

The first course that I would highly recommend you to take is the Android Development for Beginners course on Udacity. They teach you all the essential things that you need to know, from setting up the Android Studio to making your first good looking app in android. Trust me, this is the best place to begin.

After this, you can go ahead and take a course on Java if you like. There are many courses on Udemy that can help you out as well. One of the best courses on Android Development is Master Android Marshmallow Development by Tim Buchalka. This course is truly amazing. The best part is the instructor keeps the course well updated.



If  you are willing to pay a good amount you can take up the Android Development Nanodegree offered by Google.

If you have any question, please leave them in the comments.

Cheers!  

Tuesday, 8 March 2016

How to Make TextView Invisible?

TextView is a view that displays text. Now, the question is how do we make this text disappear and then reappear only when a particular condition is fulfilled? Well, it's easy, here is an example.


<?xml version="1.0" encoding="utf-8"?>
<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:paddingBottom="@dimen/activity_vertical_margin"
  android:paddingLeft="@dimen/activity_horizontal_margin"
  android:paddingRight="@dimen/activity_horizontal_margin"
  android:paddingTop="@dimen/activity_vertical_margin"
  android:orientation="vertical"
  tools:context="com.ruksarkachchhi.textinvisible.MainActivity">

  <TextView
      android:id="@+id/quotes"
      style="@style/Text"
      android:text="@string/quotes"
      android:visibility="gone" />

  <Button
      style="@style/Text"
      android:onClick="ShowText"
      android:text="Show" />
</LinearLayout>



import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

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

  public void ShowText(View view) {
      TextView quotes = (TextView) findViewById(R.id.quotes);
      quotes.getText().toString();
      quotes.setVisibility(View.VISIBLE);
  }
}

Visibility


Visibility is an view attribute and is written as "android:visibility" in xml. There are three options that you get visible, invisible and gone.

What is the difference between Invisible and Gone?


Well, when you set visibility to be invisible then it occupies a space in the layout but it still stays invisible.  On the other hand when you select visibility to be gone then it does not occupy any space in the layout. Here is how it looks.

Text set to Invisible


            

Text set to Gone