How to Use Button Click
Minggu, 03 April 2011
0
komentar
In your main.xml file, create the button like this:-
<Button android:id="@+id/Button01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="myClickHandler"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="myClickHandler"
android:text="Click Me"/>
Then in your .java file, put this code:-
public class buttonclick extends Activity
{
private Button btnclickme;
{
private Button btnclickme;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
btnclickme = (Button) findViewById(R.id.Button01);
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
btnclickme = (Button) findViewById(R.id.Button01);
btnclickme.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
{
public void onClick(View v)
{
//what happen when click
//put your code here
}
});
}
}
});
}
}
How's that? Hope that's helpful.
TERIMA KASIH ATAS KUNJUNGAN SAUDARA
Judul: How to Use Button Click
Ditulis oleh Unknown
Rating Blog 5 dari 5
Semoga artikel ini bermanfaat bagi saudara. Jika ingin mengutip, baik itu sebagian atau keseluruhan dari isi artikel ini harap menyertakan link dofollow ke https://androidemoticonss.blogspot.com/2011/04/how-to-use-button-click.html. Terima kasih sudah singgah membaca artikel ini.Ditulis oleh Unknown
Rating Blog 5 dari 5
0 komentar:
Posting Komentar