android findviewbyid() issues [closed]

WociallGlycle

New Member
I have the following code and i am trying to retrieve an id from the main.xml however netbeans is showing an error that id variable not found .I cant see what im doing wrong heres the code anyway\[code\]<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_gravity="center" android:layout_width="wrap_content" android:layout_height="45px" android:text="Helllo mw " android:textColor="@color/aqua" android:id="@+id/my_id2" /></LinearLayout>\[/code\]I am trying to retrieve the id my_id2 in the code heres the code \[code\]package bomb.com;import android.app.Activity;import android.os.Bundle;import android.widget.Button;import android.widget.TextView;import android.widget.*;public class MainActivity extends Activity{/** Called when the activity is first created. */Button sup;TextView uno;@Overridepublic void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.main); uno=(TextView)findViewById(R.id.my_id2);}}\[/code\]thanks ..
 
Back
Top