Solusi:
TextView textView = new TextView(this);
textView.setText("Hello World!");
setContentView(textView);
Penyelesaian:
package com.android;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class AndroidApp extends Activity {
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
TextView textView = new TextView(this);
textView.setText("Hello World!");
setContentView(textView);
}
}
Apabila diselesaikan dengan file main.xml maka kodenya adalah:
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Hello World!" />
Tidak ada komentar:
Posting Komentar