Anda di halaman 1dari 2

package com.

dt1;
import java.util.Random;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.*;

public class show extends Activity implements Button.OnClickListener{


/** Called when the activity is first created. */
TextView t,t2,t3;
Button b1,b2,b3;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mainshow);
//t=(TextView)findViewById(R.id.t);
/* t2=(TextView)findViewById(R.id.t2);
t3=(TextView)findViewById(R.id.t3);*/
/*Bundle b= new Bundle();
b=this.getIntent().getExtras();
String s= b.getString("str");
t.setText(s);*/
t=(TextView)findViewById(R.id.t);
Bundle b= new Bundle();
b=this.getIntent().getExtras();
String s= b.getString("str");
t.setText(s);
b1=(Button)findViewById(R.id.b1);
b1.setOnClickListener(this);
b2=(Button)findViewById(R.id.b2);
b2.setOnClickListener(this);
b3=(Button)findViewById(R.id.b3);
b3.setOnClickListener(this);
// Bundle c=new Bundle();
// c.putString("rd", r);
// /*Intent in=new Intent(this,barcode.class);
// in.putExtras(c);
// startActivity(in);*/
// t3.setText(String.valueOf(c));
}
public void onClick(View v) {
// TODO Auto-generated method stub
if(v==b1)
{
Random l = new Random();
String r= String.valueOf(l.nextInt());
String s21=String.valueOf(r);
String s22=s21.substring(1,3);
int tow=Integer.valueOf(s22);
// t2.setText(String.valueOf(tow));
String s23=s21.substring(3,6);
int three=Integer.valueOf(s23);

s22="5"+"12345"+s22+s23;
Bundle b=new Bundle();
b.putString("str", s22);
//t.setText(s22);
// Bundle b1=new Bundle();
// b1.putString("str1", s23);
Intent i=new Intent(this,brcod.class);
i.putExtras(b);
//i.putExtras(b1);
startActivity(i);
}
if(v==b2)
{
Intent i1=new Intent(this,SimpleUI.class);
startActivity(i1);
}
}

Anda mungkin juga menyukai