title: How to retrieve listview using BaseAdapter?
body: <p>I have created android apps to retrieving Listview using BaseAdapter from ArrayList but not displayed anything in Listview. Description of my apps is that I want retrieve listview using BaseAdapter. when my app is run on emulator nothing is displayed on screen when clicked on menu button on my emulator only add button displayed on screen after clicked on add launch the new activity in that activity i have created two editText. after submit, return to prev activity and display the listview.  </p>
  
  <p>Please can anybody help me to find out this error</p>
  
  <blockquote>
    <p><em>Following is the Adapter class</em></p>
  </blockquote>
  
  <pre><code>package com.oj2.exlistview;
  
  import java.util.ArrayList;
  
  import android.os.Bundle;
  import android.app.Activity;
  import android.content.Context;
  import android.view.LayoutInflater;
  import android.view.Menu;
  import android.view.View;
  import android.view.ViewGroup;
  import android.webkit.WebView.FindListener;
  import android.widget.BaseAdapter;
  import android.widget.TextView;
  
  public class TimeTrackAdapter extends BaseAdapter {
  
      ArrayList&lt;TimeRecord&gt; times = new ArrayList&lt;TimeRecord&gt;();
      public Context cntxt;
      public TimeTrackAdapter(Context cnt,ArrayList&lt;TimeRecord&gt; list2) {
          super();
          cntxt = cnt;
          times = list2;
      }
  
      @Override
      public int getCount() {
          // TODO Auto-generated method stub
          return new TimeTracker().getList1().size(); 
      }
  
      @Override
      public Object getItem(int position) {
          // TODO Auto-generated method stub
          return getItem(position);
      }
  
      @Override
      public long getItemId(int position) {
          // TODO Auto-generated method stub
          return position;
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          // TODO Auto-generated method stub
          if (convertView == null){
              System.out.println("in getView");
              LayoutInflater inflater = LayoutInflater.from(parent.getContext());
              convertView = inflater.inflate(R.layout.time_list_item, parent,false);
              TimeRecord time = times.get(position);
  
              TextView timeTextView = (TextView) convertView.findViewById(R.id.timeView);
              timeTextView.setText(time.getTimes());
  
  
              TextView noteTextView = (TextView) convertView.findViewById(R.id.noteView);
              noteTextView.setText(time.getNotes());
  
          }
          return convertView;
      }
  
  }
  </code></pre>
  
  <blockquote>
    <p><strong>Following is the Activity class</strong></p>
  </blockquote>
  
  <pre><code> package com.oj2.exlistview;
  
      import java.util.ArrayList;
  
      import android.app.Activity;
      import android.content.Intent;
      import android.os.Bundle;
      import android.view.Menu;
      import android.view.MenuInflater;
      import android.view.MenuItem;
      import android.widget.ListView;
  
      public class TimeTracker extends Activity{
          TimeTrackAdapter timeTrackAdapter;
          ListView listView;
          TimeRecord timerecord;
          public ArrayList&lt;TimeRecord&gt; list1 = new ArrayList&lt;TimeRecord&gt;();
  
          public static final int TIME_ENTRY_REQUEST_CODE = 1;
          @Override
          protected void onCreate(Bundle savedInstanceState) {
              // TODO Auto-generated method stub
              super.onCreate(savedInstanceState);
              setContentView(R.layout.activity_list);
              System.out.println("in onCreate()");
  
          }
  
          public ArrayList&lt;TimeRecord&gt; getList1() {
              return list1;
          }
  
          public void setList1(ArrayList&lt;TimeRecord&gt; list1) {
              this.list1 = list1;
          }
  
          @Override
          public boolean onCreateOptionsMenu(Menu menu) {
              // TODO Auto-generated method stub
              super.onCreateOptionsMenu(menu);
              System.out.println("in onCreateOptionsMenu");
              MenuInflater mI = getMenuInflater();
  
              mI.inflate(R.menu.time_list_menu,menu);
              return true;
          }
          @Override   
          public boolean onMenuItemSelected(int featureId, MenuItem item) {
              // TODO Auto-generated method stub
              System.out.println("in onMenuItemSelected");
              if (item.getItemId()==R.id.add_time_menu_item) {
                  Intent intent = new Intent(this, AddTimeActivity.class);
                  startActivityForResult(intent, TIME_ENTRY_REQUEST_CODE);
  
                  return true;
              }
              return super.onOptionsItemSelected(item);
          }
          @Override
          protected void onActivityResult(int requestCode, int resultCode, Intent data) {
              // TODO Auto-generated method stub
              super.onActivityResult(requestCode, resultCode, data);
              System.out.println("in onActivityResult");
              if (requestCode==TIME_ENTRY_REQUEST_CODE) {
                  if (resultCode==RESULT_OK) {
                      String Time = data.getStringExtra("time");
                      String Note = data.getStringExtra("note");
  
                      list1.add(new TimeRecord(Time, Note));
  
                      timeTrackAdapter = new TimeTrackAdapter(this,list1);
                      listView = (ListView) findViewById(R.id.timeListView);
                      listView.setAdapter(timeTrackAdapter);
                      listView.getAdapter();
                      /* timeTrackAdapter.addTimeRecord(new TimeRecord(Time, Note));*/
                      timeTrackAdapter.notifyDataSetChanged();
                  }
              }
          }
  
      }
  </code></pre>
  
  <blockquote>
    <p><strong>Following is the AddTimeActivity</strong></p>
  </blockquote>
  
  <pre><code> package com.oj2.exlistview;
  
      import android.app.Activity;
      import android.content.Intent;
      import android.os.Bundle;
      import android.view.Menu;
      import android.view.View;
      import android.widget.EditText;
  
      public class AddTimeActivity extends Activity{
  
          @Override
          protected void onCreate(Bundle savedInstanceState) {
              // TODO Auto-generated method stub
              super.onCreate(savedInstanceState);
              setContentView(R.layout.add_time);
          }
  
          public void onCancle(View view) {
              finish();
          }
          public void onSave(View view) {
              Intent intent = getIntent();
  
              EditText TimeView = (EditText) findViewById(R.id.editText1);
              intent.putExtra("time", TimeView.getText().toString());
  
              EditText Noteview = (EditText)findViewById(R.id.editText2);
              intent.putExtra("note", Noteview.getText().toString());
  
              this.setResult(RESULT_OK, intent);
              finish();
          }
      }
  </code></pre>
  
  <p>Thanking You</p>