Build Contacts using Android- Can I  change to a different xml view inside setOnClickListener?
<p>I am very new to android. I have to build an application that stores Contacts(Names ,Numbers etc) in a list view with capabilities to add new contacts, edit them and delete them i.e the normal contacts .
Here is my approach!
 1. First View is the Contacts List View with an Add COntact Button at the end.</p>

<p>2.When One of the contact is clicked,a new view opens up with a picture, name and 3 phone numbers and an Edit Button.</p>

<p>3.when Edit is pressed , one more view opens up with options to edit Name, numbers etc. and an Update button.</p>

<ol>
<li>the New contact view is similar to the Edit view with  a save Button</li>
</ol>

<p>BEING A NEW USER CANNOT PASTE THE IMAGE</p>

<pre><code>enter code here


public class Contacts extends ListActivity implements OnClickListener{
    Button NewContact;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.contacts);
        NewContact = (Button) findViewById(R.id.bAddContact);
        NewContact.setOnClickListener(this);
        setListAdapter(new ArrayAdapter&lt;String&gt;(Contacts.this, R.id.ListView));
    }

    @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {
        // TODO Auto-generated method stub
        super.onListItemClick(l, v, position, id);

        try {
            Class ourClass = Class.forName("com.contacts.app.Contacts");
            Intent ourIntent = new Intent(Contacts.this,ourClass);
            startActivity(ourIntent);
        } catch (ClassNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }


    }

    public void onClick(View arg0) {
        // TODO Auto-generated method stub

        switch (arg0.getId()){
        case R.id.bAddContact :


            break;
        case R.id.ListView:

            break;
        }

    }

}
</code></pre>

<p>CAN I CHANGE TO A DIFFERENT XML VIEW </p>

<p>Ex- After</p>

<pre><code> setContentView(R.layout.contacts);
    NewContact = (Button) findViewById(R.id.bAddContact);
    NewContact.setOnClickListener(this);
</code></pre>

<p>CAN I START SOMETHING LIKE</p>

<pre><code>public void onClick(View arg0) {
        // TODO Auto-generated method stub

        switch (arg0.getId()){
        case R.id.bAddContact :
                   setContentView(R.layout.ContactNew);
                   Button Save = (Button) findViewById(R.id.bAddContact);
                   Save.setOnClickListener(new View.OnclickListener()){
      };
        break;
        case R.id.ListView:

            break;
        }

    }

}
</code></pre>

<p>THANK YOU FOR YOUR TIME AND HELP</p>
