I just wanted to click on a button to see a text. Do I Need to import the public boolean onCreateOptionsMenu(Menu menu)? Or what am I doing wrong? I tried to Import some things, but it didn't help. Java-Code:
package com.example.tsd453;
import android.app.Activity;
import android.os.Bundle;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
public class Blume extends Activity implements OnClickListener {
public Button btn;
public TextView tw;
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.blume);
btn = (Button)findViewById(R.id.BtnKlick);
tw = (TextView)findViewById(R.id.Text);
btn.setOnClickListener(this);
}
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
tw.setText("Hallo");
XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="#+id/Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginRight="70dp"
android:layout_marginTop="50dp"
android:textSize="70sp" />
<Button
android:id="#+id/BtnKlick"
android:layout_width="100dp"
android:layout_height="70dp"
android:layout_centerInParent="true"
android:layout_marginTop="31dp"
android:text="Button" />
</RelativeLayout>
you could try this:
instead of
btn.setOnClickListener(this);
and
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
tw.setText("Hallo");
try this in your onCreate:
btn.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
tw.setText("Hallo, Welt!");
}
});
and you don't need to "implements onClickListener" in class blume
and e.g. use android:layout_below="#id/tw" in the xml file of the button to set the button below the textview
EDIT:
i just tried it on my nexus 5, and this code (i think it is the same like yours) is working
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
public class MainActivity extends Activity implements OnClickListener {
public Button btn;
public TextView tw;
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btn = (Button)findViewById(R.id.BtnKlick);
tw = (TextView)findViewById(R.id.Text);
btn.setOnClickListener(this);
}
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
tw.setText("Hallo");
}
}
i removed the options menu, but it also worked with it.
screenshot:
https://copy.com/3TX47IAK9gya
screenshot of the code in android studio:
https://copy.com/hbwnH0vZkzMn
It seems that the Button is hiding the TextView, try setting margin like:
<TextView
android:layout_marginTop="50dp" />
<Button
android:layout_marginTop="150dp"
/>
and remove center align (at least for one of them).
Related
I can make listener button or other widgets in MainLayout but when I pass second layout the button's listener doesn't work. how can I fix it
MainActivity.java
package com.example.bilsay;
import android.app.Activity;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;
public class MainActivity extends Activity {
Button item1,item2,btn3,btnonay,btnsedef;
TextView item3,itemtxt;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
item1=(Button)findViewById(R.id.btntıkla);
item2=(Button)findViewById(R.id.button2);
item3=(TextView)findViewById(R.id.textView2);
btnsedef=(Button)findViewById(R.id.button4);
btn3=(Button)findViewById(R.id.button3);
btnsedef.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
item3.setText("Sedef Bilsayın sevgilisidir");
}
});
item1.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
item3.setText("Hoşgeldiniz");
}
});
item2.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
item3.setText("Merhaba Mavi");
}
});
btn3.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
setContentView(R.layout.che);
}
});
}
Second layout
che.java :
the second layout is seen but actionlisteners do not work ; these code do not work.
package com.example.bilsay;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;
public class che extends Activity{
CheckBox chkc1,chkc2,chkc3,chkc4,chkc5;
ImageView image;
Button btnonay,btntıkla;
TextView itemtxt;
int c=0;
#Override
protected void onCreate(Bundle bilsayiyicocuktur) {
// TODO Auto-generated method stub
super.onCreate(bilsayiyicocuktur);
setContentView(R.layout.che);
Thread timer=new Thread(){
public void run(){
try{
sleep(5000);
//Class myclass=Class.forName("com.example.bilsay.che");
}
catch(InterruptedException e ){
e.printStackTrace();
}
finally{
Intent openChe =new Intent("com.example.bilsay.che");
startActivity(openChe);
}
}
};
timer.start();
chkc1=(CheckBox)findViewById(R.id.checkBox1);
chkc2=(CheckBox)findViewById(R.id.checkBox2);
chkc3=(CheckBox)findViewById(R.id.checkBox3);
chkc4=(CheckBox)findViewById(R.id.checkBox4);
chkc5=(CheckBox)findViewById(R.id.checkBox5);
btnonay=(Button)findViewById(R.id.btnonay);
image=(ImageView)findViewById(R.id.imageView1);
itemtxt=(TextView)findViewById(R.id.chesonuc);
btntıkla=(Button)findViewById(R.id.btnblsay);
btntıkla.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
c++;
itemtxt.setText("Tıkladın "+c);
}
});
btnonay.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
itemtxt.setText("el mature");
if(chkc1.isChecked()){
itemtxt.setText("Kisi");}
else if(chkc2.isChecked())
itemtxt.setText("Rahmetli Arjantinli Devrimci");
else if(chkc3.isChecked())
itemtxt.setText("Ben");
else if(chkc4.isChecked())
itemtxt.setText("Nimet anlamnıa gelir");
else if(chkc5.isChecked())
itemtxt.setText("el mature");
}
});
}
}
che.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hangisinin Anlamını Öğrenmek İstiyorsun ???"
android:textSize="23dp" />
<CheckBox
android:id="#+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="El Peblo" />
<CheckBox
android:id="#+id/checkBox2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Che" />
<CheckBox
android:id="#+id/checkBox3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Bilsay" />
<CheckBox
android:id="#+id/checkBox4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Namet" />
<CheckBox
android:id="#+id/checkBox5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Olgun" />
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:id="#+id/btnonay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Onay!" />
<TextView
android:id="#+id/chesonuc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Sonuç:"
android:textSize="#dimen/bigdimension" />
<Button
android:id="#+id/btnblsay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Tıkla" />
</LinearLayout>
I have problem with button in activity_main.xml,
I need to launch by click on "imageButton8" a webView (website URL) in application.
MainActivity.Java
package com.XX.app;
import com.XX.app.R;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.ImageButton;
public class MainActivity extends Activity {
WebView view;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Empêcher le téléphone de passer en mode veille
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
//When User click on the button imageButton8 the Activity2 launch
Button imageButton8 = (Button) findViewById(R.id.imageButton8);
setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent(v.getContext(), Activity2.class);
startActivityForResult(intent, 0);
}
});
}
private void setOnClickListener(OnClickListener onClickListener) {
// TODO Auto-generated method stub
}
//loads RETURN URL on lastpage
#Override
public void onBackPressed() {
if(this.view.canGoBack())
{
this.view.goBack();
} else {
new AlertDialog.Builder(this)
.setIcon(android.R.drawable.ic_dialog_alert)
.setTitle("إغلاق تطبيق جمعية البر و التعاون")
.setMessage("هل أنت متأكد أنك تريد إغلاق تطبيق جمعية البر و التعاون ؟")
.setPositiveButton("نعم", new DialogInterface.OnClickListener()
{
#Override
public void onClick(DialogInterface dialog, int which) {
finish();
}
})
.setNegativeButton("لا", null)
.show();
}
}
}
activity_main.xml for imageButton8 is
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/background_1">
<ImageButton
android:id="#+id/imageButton8"
android:onClick="click"
android:layout_width="90dp"
android:layout_height="90dp"
android:layout_marginLeft="140dp"
android:layout_marginTop="380dp"
android:background="#0000"
android:scaleType="fitXY"
android:src="#drawable/btn_www" />
</RelativeLayout>
Activity2.java
package com.XX.app;
import com.XX.app.R;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.app.Application;
import android.os.Bundle;
public class Activity2 extends Activity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_webview);
}
}
activity_webview.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/background_1">
<WebView
android:id="#+id/webView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" />
</RelativeLayout>
In the same project,
2. Others Issues: I have 08 buttons. How do I execute each button in its template xml?
For example: Button 1 => about_obama.xml. When user click (in this file) it will find the description of obama.
Button 2 => ....xml...etc!
Button 3......
You need to set the onclickListener for the ImageButton using the ImageButton's setOnClickListener() method. So, in your MainActivity, inside your onCreate() method, do the following:
Button imageButton8 = (Button) findViewById(R.id.imageButton8);
// Set the OnClickListener on the button itself
imageButton8.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, Activity2.class); // Use the MainActivity context
startActivityForResult(intent, 0);
}
});
// You should delete the private setOnClickListener() method as it does not
// have any purpose
To specify the onClick() in the xml when the Button is clicked, set the:
android:onClick:"some_method"
property for your button. Then declare and define this method in your Activity.
I'm very new to Android development and just started to study.
What I'm trying is to add a button and when that button is pressed a text "my first project" to get displayed in the text view.
With the help of some experts I created the button and text view.
So the button is showing in the simulator but when I click that button nothing happens.
Can anyone please help me with how can I display the text when pressing the button?
.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:id="#+id/txtView"
android:layout_width="150dp"
android:layout_height="150dp"
android:text="#string/hello" />
<Button
android:id="#+id/mybtn"
android:layout_width="50dp"
android:layout_height="30dp" />
<TextView
android:id="#+id/viewwidth"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/viewheight"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
.java
import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;
import android.view.View;
import android.widget.Toast;
public class NameonbuttonclickActivity extends Activity implements View.OnClickListener {
Button mybtn;
TextView txtView;
String hello;
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.main);
super.onCreate(savedInstanceState);
mybtn= new Button(this);
txtView=new TextView(this);
mybtn.setOnClickListener(this);
printmyname();
mybtn = (Button)findViewById(R.id.mybtn);
txtView=(TextView)findViewById(R.id.txtView);
txtView = (TextView)findViewById(R.id.viewwidth);
txtView = (TextView)findViewById(R.id.viewheight);
hello="This is my first project";
//setContentView(mybtn);
// setContentView(R.layout.main);
}
public void onClick(View view){
txtView.setText(hello);
//printmyname();
Toast.makeText(NameonbuttonclickActivity.this, hello, Toast.LENGTH_LONG).show();
}
private void printmyname(){
System.out.println("coming");
}
}
You can do like this:
String hello;
public void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.main);
super.onCreate(savedInstanceState);
mybtn = (Button)findViewById(R.id.mybtn);
txtView=(TextView)findViewById(R.id.txtView);
txtwidth = (TextView)findViewById(R.id.viewwidth);
hello="This is my first project";
mybtn.setOnClickListener(this);
}
public void onClick(View view){
txtView.setText(hello);
}
Check your textview names. Both are same . You must use different object names and you have mentioned that textview object which is not available in your xml layout file.
Hope this will help you.
First create xml file as follows. Create one textview and a button:
main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/hello" />
<Button
android:id="#+id/mybutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Click Me" />
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
The first TextView is created by default. You can leave or remove it if you want.
Next one is to create a button
The next one is TextView where you want to display text.
Now coming to the main activity code...
package com.android.example.simple;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class SimpleActivity extends Activity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final TextView textView=(TextView)findViewById(R.id.textView1);
final Button button1 = (Button)findViewById(R.id.mybutton);
//Implement listener for your button so that when you click the
//button, android will listen to it.
button1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Perform action on click
textView.setText("You clicked the button");
} });
}
}
This is because you DON'T associated the OnClickListener() on the button retrieve from the XML layout.
You don't need to create object because they are already created by the Android system when you inflate XML file (with the Activity.setContentLayout( int resourceLayoutId ) method).
Just retrieve them with the findViewById(...) method.
Just check your code in .java class
You had written below line
mybtn.setOnClickListener(this);
before initializing the mybtn object I mean
mybtn = (Button)findViewById(R.id.mybtn);
just switch this two line or put that line "mybtn.setOnClickListener(this)" after initializing your mybtn object and you will get the answer what you want..
Try this
public void onClick(View view){
txtView.setText("hello");
//printmyname();
Toast.makeText(NameonbuttonclickActivity.this, "hello", Toast.LENGTH_LONG).show();
}
Also in toast use "Hello"
you use this as txtView.setText("hello");
MainActivity.java:
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import android.view.View;
import android.view.View.OnClickListener;
public class MainActivity extends Activity {
Button button1;
TextView textView1;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
button1=(Button)findViewById(R.id.button1);
textView1=(TextView)findViewById(R.id.textView1);
button1.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
textView1.setText("TextView displayed Successfully");
}
});
}
}
activity_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Click here" />
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
public void onCreate(Bundle savedInstanceState)
{
setContentView(R.layout.main);
super.onCreate(savedInstanceState);
mybtn = (Button)findViewById(R.id.mybtn);
txtView=(TextView)findViewById(R.id.txtView);
mybtn .setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
txtView.SetText("Your Message");
}
});
}
Check this:
hello.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View paramView) {
text.setText("hello");
}
});
I am looking for a way to close a custom dialog with a button that is inside the xml used in the dialog, alternatively closing it by pressing anywhere on the dialog. What I have is this; a layout with a Image Button that brings up the custom dialog with the content. I have setCanceledOnTouchOutside(true); and that works, but I need the dialog to fill up most of the screen and it can be hard for the user to click in the small space that is available. So how do I do this?
My java code:
import android.app.Activity;
import android.app.Dialog;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
public class Rose extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
this.setRequestedOrientation(
ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
setContentView(R.layout.rose);
ImageButton b = (ImageButton) findViewById(R.id.imageButton1);
b.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View arg0) {
Dialog d1 = new Dialog(Rose.this);
d1.setContentView(R.layout.tariquet);
d1.setCanceledOnTouchOutside(true);
d1.show();
}
});
}
}
And my XML:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fitsSystemWindows="true"
android:isScrollContainer="true"
android:minHeight="1100dp"
android:minWidth="650dp">
<ImageView
android:src="#drawable/rose_tariquet"
android:id="#+id/imageView1"
android:layout_height="fill_parent"
android:layout_width="fill_parent"></ImageView>
<Button android:text="X"
android:layout_height="wrap_content"
android:id="#+id/button1"
android:layout_width="55dp"
android:layout_gravity="right"></Button>
</FrameLayout>
public class CustomizeDialog extends Dialog implements OnClickListener {
Button close;
TextView tv;
public CustomizeDialog(Context context,String Stringcontent) {
super(context);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.custom_diolog_main);
tv=(TextView) findViewById(R.id.content);
tv.setText(Stringcontent);
close = (Button) findViewById(R.id.close);
close.setOnClickListener(this);
}
#Override
public void onClick(View v) {
if (v == close)
dismiss();
}
}
called:
CustomizeDialog customizeDialog = new CustomizeDialog(CustomDialog.this,"clickme");
customizeDialog.show();
I have the following actvity.
package org.dewsworld.ui;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;
public class DetailList extends Activity {
TextView title = (TextView) findViewById(R.id.title) ;
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.detail_list);
title.setText("hello world");
}
}
Which manipulate detail_list.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent" android:weightSum="1">
<TextView android:id="#+id/title" android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_height="wrap_content" android:layout_width="match_parent"
android:text="#string/headline" />
<ListView android:id="#+id/listView1" android:layout_width="match_parent" android:layout_height="match_parent"></ListView>
</LinearLayout>
But, when I run this, I get a runtime error. LogCat is,
try like this
public class DetailList extends Activity {
TextView title;
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.detail_list);
title = (TextView) findViewById(R.id.title) ;
title.setText("hello world");
}
}
package org.dewsworld.ui;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;
public class DetailList extends Activity {
TextView title;
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.detail_list);
title = (TextView) findViewById(R.id.title) ;;
title.setText("hello world");
}
}
its complaining because you are trying to get the value of textView using an Activity method which is not been created yet (Since its Oncreate() is yet to run)