Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.androidsetimage;
- import android.os.Bundle;
- import android.app.Activity;
- import android.widget.Button;
- import android.widget.EditText;
- import android.widget.ImageView;
- import android.widget.TextView;
- public class MainActivity extends Activity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- ImageView image1 = (ImageView)findViewById(R.id.image1);
- ImageView image2 = (ImageView)findViewById(R.id.image2);
- ImageView image3 = (ImageView)findViewById(R.id.image3);
- TextView text4 = (TextView)findViewById(R.id.textview4);
- Button button5 = (Button)findViewById(R.id.button5);
- EditText edittext6 = (EditText)findViewById(R.id.edittext6);
- image1.setImageDrawable(getResources().getDrawable(R.drawable.ic_launcher));
- image2.setImageResource(R.drawable.ic_launcher);
- //Requires API 16
- image3.setBackground(getResources().getDrawable(R.drawable.ic_launcher));
- //deprecated
- text4.setBackgroundDrawable(getResources().getDrawable(R.drawable.ic_launcher));
- button5.setBackgroundResource(R.drawable.ic_launcher);
- //Requires API 16
- edittext6.setBackground(getResources().getDrawable(R.drawable.ic_launcher));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement