how to change Image on the Screen in Android Program
Today is Learn how to change Image on the Screen in Android Program follow this Tutorial
1.Main Activity.java:
import android.app.Activity;
import android.graphics.Typeface;
import android.os.Bundle;
import android.renderscript.Type;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;
import android.widget.TextView;
public class MainActivity extends Activity implements OnCheckedChangeListener {
RadioGroup group1, group2;
Button gen;
ImageView img;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
group1 = (RadioGroup) findViewById(R.id.rg1);
group1.setOnCheckedChangeListener((OnCheckedChangeListener) this);
group2 = (RadioGroup) findViewById(R.id.rg2);
group2.setOnCheckedChangeListener((OnCheckedChangeListener) this);
img = (ImageView) findViewById(R.id.imageView1);
// oncheckedChanged function
gen = (Button) findViewById(R.id.button1);
gen.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
}
});
}
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
// TODO Auto-generated method stub
switch (checkedId) {
case R.id.radioButton1:
img.setImageResource(R.drawable.image4);
break;
case R.id.radioButton2:
img.setImageResource(R.drawable.image5);
break;
case R.id.radioButton3:
img.setImageResource(R.drawable.image6);
break;
case R.id.radioButton4:
img.setImageResource(R.drawable.image7);
break;
default:
break;
}
}
}
2. activitymain.xml:
<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"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingBottom="40px"
android:weightSum="2" >
<RadioGroup
android:id="@+id/rg1"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical" >
<RadioButton
android:id="@+id/radioButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginTop="20dp"
android:text="Image2" />
<RadioButton
android:id="@+id/radioButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/radioButton1"
android:layout_alignBottom="@+id/radioButton1"
android:layout_alignParentLeft="true"
android:text="Image1" />
</RadioGroup>
<RadioGroup
android:id="@+id/rg2"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical" >
<RadioButton
android:id="@+id/radioButton3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:text="Image3" />
<RadioButton
android:id="@+id/radioButton4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/radioButton3"
android:layout_alignBottom="@+id/radioButton3"
android:layout_alignParentRight="true"
android:text="Image4" />
</RadioGroup>
</LinearLayout>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:text="Change Image" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/button1"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/button1"
android:layout_marginTop="50dp"
android:src="@drawable/ic_launcher" />
</RelativeLayout>
I want to download delta executor online but don't know the process, can anyone let me know?
ReplyDeleteI was skeptical at first, but the dota 2 boosting services actually played my heroes and kept my match history clean — no obvious red flags.
ReplyDelete“Had some trouble with in-app purchases before, so I switched to the APK traffic rider The base game is fun enough without paying, and the APK runs great without bugs.”
ReplyDeleteDownload LokLok APK
ReplyDeleteE88 App Download
SVIP2 Android App
H89 APK Latest Version
Tevi APK for Android
OKJKT Mobile App
Download 8ID APK
Rajabandot APK Download
MainDuit App
BigWinner APK Latest
Komik APK
ReplyDeleteRemi 101 APK
Win IDN APK
Tachiyomi APK Download
Yacine TV APK
SVIP5 APK
LuckSVIP APK
Bybit APK
JKT APK
Unduh Win IDN APK
Dana VIP APK
ReplyDeleteIdrok APK
Unduh CarX Street APK
KPKToto APK
Unduh BitTV APK
TokuPlay APK
Cinema APK
ReplyDeleteCuphead APK
Espacio APK
Free Fire Max APK
Geometry Dash APK
GTA San Andreas APK
Hollow Knight APK
Honista APK
Juegos APK
Lucky Patcher APK
Majis TV APK
ReplyDeleteMinecraft Bedrock APK
Movie Plus APK
My Boy APK
PelisPlus APK
Poppy Playtime APK
PVZ Fusion APK
Rick Browser APK
Sigma APK
Sprunki APK