Structure Query Language, C programming, Java, Servlet, Jsp, Unix

Thursday, 18 October 2012

Create “Hello World” application. That will display “Hello World” in the middle of the screen in the red color with white background.

Pro1Activity.java
package ps.pro1;

import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.widget.RelativeLayout;
import android.widget.TextView;

public class Pro1Activity extends Activity {
   /**
     *  www.master-gtu.blogspot.com
     *  pankaj sharma(8460479175),
     *  chavda vijay(8460420769) 
     */
 RelativeLayout rl;
 TextView tvmsg;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        rl=(RelativeLayout) findViewById(R.id.rl);
        tvmsg = (TextView) findViewById(R.id.textView1);
        
        rl.setBackgroundColor(Color.WHITE);
        tvmsg.setTextColor(Color.RED);
    }
}

4 comments:

  1. where is the code for displaying the text view in the middle?

    ReplyDelete
  2. Please provide the XML file of this program

    ReplyDelete
  3. how to run this code in the android studio ??......
    where is the xml file without xml file that is not run the programm....

    ReplyDelete