Guest User

Untitled

a guest
Oct 17th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.55 KB | None | 0 0
  1. package com.example.bilsay;
  2.  
  3. import android.app.Activity;
  4. import android.content.res.Resources;
  5. import android.os.Bundle;
  6. import android.view.Menu;
  7. import android.view.MenuItem;
  8. import android.view.View;
  9. import android.widget.Button;
  10. import android.widget.CheckBox;
  11. import android.widget.ImageView;
  12. import android.widget.TextView;
  13.  
  14. public class MainActivity extends Activity {
  15.  
  16. Button item1,item2,btn3,btnonay,btnsedef;
  17. TextView item3,itemtxt;
  18.  
  19. @Override
  20. protected void onCreate(Bundle savedInstanceState) {
  21. super.onCreate(savedInstanceState);
  22. setContentView(R.layout.activity_main);
  23. item1=(Button)findViewById(R.id.btntıkla);
  24. item2=(Button)findViewById(R.id.button2);
  25. item3=(TextView)findViewById(R.id.textView2);
  26. btnsedef=(Button)findViewById(R.id.button4);
  27.  
  28.  
  29. btn3=(Button)findViewById(R.id.button3);
  30. btnsedef.setOnClickListener(new View.OnClickListener() {
  31.  
  32. @Override
  33. public void onClick(View v) {
  34. // TODO Auto-generated method stub
  35. item3.setText("Sedef Bilsayın sevgilisidir");
  36.  
  37. }
  38. });
  39.  
  40. item1.setOnClickListener(new View.OnClickListener() {
  41.  
  42. @Override
  43. public void onClick(View v) {
  44. // TODO Auto-generated method stub
  45. item3.setText("Hoşgeldiniz");
  46. }
  47. });
  48.  
  49. item2.setOnClickListener(new View.OnClickListener() {
  50.  
  51. @Override
  52. public void onClick(View v) {
  53. // TODO Auto-generated method stub
  54. item3.setText("Merhaba Mavi");
  55.  
  56. }
  57. });
  58. btn3.setOnClickListener(new View.OnClickListener() {
  59.  
  60. @Override
  61. public void onClick(View v) {
  62. // TODO Auto-generated method stub
  63. setContentView(R.layout.che);
  64.  
  65.  
  66. }
  67. });
  68.  
  69.  
  70. }
  71.  
  72. package com.example.bilsay;
  73.  
  74. import android.app.Activity;
  75. import android.content.Intent;
  76. import android.os.Bundle;
  77. import android.view.Menu;
  78. import android.view.View;
  79. import android.widget.Button;
  80. import android.widget.CheckBox;
  81. import android.widget.ImageView;
  82. import android.widget.TextView;
  83.  
  84. public class che extends Activity{
  85.  
  86. CheckBox chkc1,chkc2,chkc3,chkc4,chkc5;
  87. ImageView image;
  88. Button btnonay,btntıkla;
  89.  
  90. TextView itemtxt;
  91. int c=0;
  92.  
  93. @Override
  94. protected void onCreate(Bundle bilsayiyicocuktur) {
  95. // TODO Auto-generated method stub
  96. super.onCreate(bilsayiyicocuktur);
  97. setContentView(R.layout.che);
  98.  
  99. Thread timer=new Thread(){
  100. public void run(){
  101. try{
  102. sleep(5000);
  103. //Class myclass=Class.forName("com.example.bilsay.che");
  104.  
  105.  
  106. }
  107. catch(InterruptedException e ){
  108. e.printStackTrace();
  109. }
  110. finally{
  111. Intent openChe =new Intent("com.example.bilsay.che");
  112. startActivity(openChe);
  113. }
  114. }
  115. };
  116. timer.start();
  117.  
  118. chkc1=(CheckBox)findViewById(R.id.checkBox1);
  119. chkc2=(CheckBox)findViewById(R.id.checkBox2);
  120. chkc3=(CheckBox)findViewById(R.id.checkBox3);
  121. chkc4=(CheckBox)findViewById(R.id.checkBox4);
  122. chkc5=(CheckBox)findViewById(R.id.checkBox5);
  123. btnonay=(Button)findViewById(R.id.btnonay);
  124. image=(ImageView)findViewById(R.id.imageView1);
  125. itemtxt=(TextView)findViewById(R.id.chesonuc);
  126. btntıkla=(Button)findViewById(R.id.btnblsay);
  127. btntıkla.setOnClickListener(new View.OnClickListener() {
  128.  
  129. @Override
  130. public void onClick(View v) {
  131. // TODO Auto-generated method stub
  132. c++;
  133. itemtxt.setText("Tıkladın "+c);
  134.  
  135.  
  136. }
  137. });
  138. btnonay.setOnClickListener(new View.OnClickListener() {
  139.  
  140. @Override
  141. public void onClick(View v) {
  142. // TODO Auto-generated method stub
  143. itemtxt.setText("el mature");
  144. if(chkc1.isChecked()){
  145. itemtxt.setText("Kisi");}
  146. else if(chkc2.isChecked())
  147. itemtxt.setText("Rahmetli Arjantinli Devrimci");
  148. else if(chkc3.isChecked())
  149. itemtxt.setText("Ben");
  150. else if(chkc4.isChecked())
  151. itemtxt.setText("Nimet anlamnıa gelir");
  152. else if(chkc5.isChecked())
  153. itemtxt.setText("el mature");
  154.  
  155.  
  156.  
  157. }
  158. });
  159. }
  160.  
  161. }
  162.  
  163. <?xml version="1.0" encoding="utf-8"?>
  164. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  165. android:layout_width="match_parent"
  166. android:layout_height="match_parent"
  167. android:orientation="vertical" >
  168.  
  169. <TextView
  170. android:id="@+id/textView1"
  171. android:layout_width="wrap_content"
  172. android:layout_height="wrap_content"
  173. android:text="Hangisinin Anlamını Öğrenmek İstiyorsun ???"
  174. android:textSize="23dp" />
  175.  
  176. <CheckBox
  177. android:id="@+id/checkBox1"
  178. android:layout_width="wrap_content"
  179. android:layout_height="wrap_content"
  180. android:text="El Peblo" />
  181.  
  182. <CheckBox
  183. android:id="@+id/checkBox2"
  184. android:layout_width="wrap_content"
  185. android:layout_height="wrap_content"
  186. android:text="Che" />
  187.  
  188. <CheckBox
  189. android:id="@+id/checkBox3"
  190. android:layout_width="wrap_content"
  191. android:layout_height="wrap_content"
  192. android:text="Bilsay" />
  193.  
  194. <CheckBox
  195. android:id="@+id/checkBox4"
  196. android:layout_width="wrap_content"
  197. android:layout_height="wrap_content"
  198. android:text="Namet" />
  199.  
  200. <CheckBox
  201. android:id="@+id/checkBox5"
  202. android:layout_width="wrap_content"
  203. android:layout_height="wrap_content"
  204. android:text="Olgun" />
  205.  
  206. <ImageView
  207. android:id="@+id/imageView1"
  208. android:layout_width="wrap_content"
  209. android:layout_height="wrap_content" />
  210.  
  211. <Button
  212. android:id="@+id/btnonay"
  213. android:layout_width="wrap_content"
  214. android:layout_height="wrap_content"
  215. android:text="Onay!" />
  216.  
  217. <TextView
  218. android:id="@+id/chesonuc"
  219. android:layout_width="wrap_content"
  220. android:layout_height="wrap_content"
  221. android:text="Sonuç:"
  222. android:textSize="@dimen/bigdimension" />
  223.  
  224. <Button
  225. android:id="@+id/btnblsay"
  226. android:layout_width="wrap_content"
  227. android:layout_height="wrap_content"
  228. android:text="Tıkla" />
  229.  
  230. </LinearLayout>
Add Comment
Please, Sign In to add comment