Wednesday, May 8, 2013

10th prac android

TenthActivity.java

package a.b;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class TenthActivity extends Activity implements OnClickListener{
    /** Called when the activity is first created. */
Button b1;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
       
        b1 = (Button) findViewById(R.id.button1);
b1.setOnClickListener(this);
    }
   
    public void onClick(View v) {
Intent it = new Intent(this,tenthActivity1.class);
startActivity(it);

    }
}


tenthActivity1.java
package a.b;

import android.app.Activity;
import android.os.Bundle;

public class tenthActivity1 extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main2);
    }
}

No comments:

Post a Comment