Obviously becuase you're trying to find a TextView but are using an ID of a layout file and this is why findViewById can't find any textview with this id.
You got: setContentView(R.layout.search); final EditText myedittext=(EditText)findViewById(R.layout.search); // <- You're using a layout id, instead of an element id. Probably you meant to use R.id.search instead?) On Jun 15, 9:27 am, sheshi <[email protected]> wrote: > /** can some one tell me why it is not working .here is my code > */ > package com.arka.CallLogDemo; > > import android.app.Activity; > import android.app.AlertDialog; > import android.content.DialogInterface; > import android.content.Intent; > import android.os.Bundle; > //import android.text.Editable; > //import android.text.InputFilter; > import android.text.Editable; > import android.view.View; > import android.widget.Button; > import android.widget.EditText; > //import android.widget.EditText; > > public class TestSearch extends Activity { > @Override > public void onCreate(Bundle icicle) { > super.onCreate(icicle); > setContentView(R.layout.main); > //callDialog("in search"); > setContentView(R.layout.search); > final EditText myedittext=(EditText)findViewById(R.layout.search); > final Button button=(Button) findViewById(R.id.callButton); > button.setOnClickListener(new View.OnClickListener() { > public void onClick(View v ) { > // Perform action on click > //int length=0; > Intent search=new Intent(); > // callDialog("just"); > > search.putExtra("NUMBER_ENTERED",myedittext.getText().toString > ()); > setResult(Activity.RESULT_OK,search); > finish(); > > } > }); > > }//end of onCreate() > > //customized alertDialog > public void callDialog(CharSequence message ) > { > final AlertDialog.Builder a=new AlertDialog.Builder(this); > a.setMessage(message); > a.setTitle("TestSearch"); > //a.wait(2000); > a.setPositiveButton("close", new > DialogInterface.OnClickListener(){ > public void onClick(DialogInterface dialog,int whichButton) > { > > //a.setCancelable(true); > > } > }); > > a.show(); > } > > > > } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---

