Not able to add Title bar for Listview - android

The requirement for my screen is like having a title bar at the top middle and followed by the list view when am trying to do that am not able to do like i got state name in every list item.I want that only in the top and once. And the screen shot of it is
<?xml version="1.0" encoding="utf-8"?>
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TableRow>
<TextView
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:background="#000000"
android:text="Select State"
></TextView>
</TableRow>
<TableRow>
<TextView android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:id="#+id/label"
android:textSize="30px"></TextView>
</TableRow>
</TableLayout>
I have tried many ways this is my present layout
and my java code is
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
public class new21 extends ListActivity {
/** Called when the activity is first created. */
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
// Create an array of Strings, that will be put to our ListActivity
String[] names = new String[] { "Andhra Pradesh", "Kerala","Tamilnadu","Karnataka" };
// Use your own layout and point the adapter to the UI elements which
// contains the label
this.setListAdapter(new ArrayAdapter<String>(this, R.layout.new21,
R.id.label, names));
}
#Override
protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
// Get the item that was clicked
Object o = this.getListAdapter().getItem(position);
String keyword = o.toString();
if(keyword.equals("Andhra Pradesh"))
{
Intent ima45=new Intent(new21.this,new31.class);
startActivity(ima45);
}
Toast.makeText(this, "You selected: " + keyword, Toast.LENGTH_LONG)
.show();
}
}
Can any one help me.

You can addHeader to the ListView like this,
View header = getLayoutInflater().inflate(R.layout.header, null);
ListView listView = getListView();
listView.addHeaderView(header);
setListAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_single_choice, names));
Where R.layout.header is the layout that contains a TextView with text "Select State"
UPDATED:
public class ListViewProblemActivity extends ListActivity {
ListView listView;
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
// Create an array of Strings, that will be put to our ListActivity
String[] names = new String[] { "Andhra Pradesh", "Kerala","Tamilnadu","Karnataka" };
// Use your own layout and point the adapter to the UI elements which
// contains the label
TextView tv = new TextView(getApplicationContext());
tv.setText("Select State");
listView = getListView();
listView.addHeaderView(tv);
this.setListAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_expandable_list_item_1,names));
}
#Override
protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
// Get the item that was clicked
if(position != 0){
System.out.println(position - 1);
Object o = this.getListAdapter().getItem(position - 1);
String keyword = o.toString();
Toast.makeText(this, "You selected: " + keyword, Toast.LENGTH_LONG)
.show();
}
}
}

Usey only a ListView in your activity, remove the heading there. Then use ListView.addHeaderViwe(); to add a header to the Listview. This Header is display before the first item.
See the documentaton for further information.

you better use ListView.addHeaderViwe();
but don't forget to remove what u did "extends ListActivity", no need for that,
and also remove title from your "new21.xml"
in your xml, just fix the text item u want to show in every row of the list,

You are doing fully wrong. Just take a LinearLayout with one TextView (for Title bar) and ListView (To display listview), nothing more than these 2 views.
<?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_height="wrap_content"
android:layout_width="fill_parent"
android:background="#000000"
android:text="Select State">
</TextView>
<ListView
android:id="#+id/lviewState"
android:layout_height="wrap_content"
android:layout_width="match_parent">
</ListView>
</LinearLayout>
Now, follow your code to display ListView.

Related

Android fragments on itemclick (listview)

I want to have an activity, where in it's layout I will have a listview with fixed content (array) and on the right side I want dynamic content (so I decided: fragments).
My MainLayout is like this (activity_vizitarea.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:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingBottom="#dimen/activity_vertical_margin"
tools:context="ro.softwarex.bellaapp.procesarevizita.app.VizitareaActivity">
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true">
<ListView
android:layout_width="20dp"
android:layout_height="wrap_content"
android:id="#id/id_vizita_jobs"
android:layout_weight="1" />
<LinearLayout
android:orientation="vertical"
android:layout_width="400dp"
android:layout_height="fill_parent"
android:id="#id/id_fragment_container"></LinearLayout>
</LinearLayout>
</RelativeLayout>
The last LinearLayout will hold the fragments
My Activity looks like this:
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
public class VizitareaActivity extends Activity {
ListView listView;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_vizitarea);
// Get ListView object from xml
listView = (ListView) findViewById(R.id.id_vizita_jobs);
// Defined Array values to show in ListView
String[] values = new String[] { "First category",
"Second category",
"Third category",
"Fourth category",
" and so on",
"Last category"
};
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, android.R.id.text1, values);
listView.setAdapter(adapter);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> parent, View view,int position, long id) {
int itemPosition = position;
String itemValue = (String) listView.getItemAtPosition(position);
Toast.makeText(getApplicationContext(),
"Position :" + itemPosition + " ListItem : " + itemValue, Toast.LENGTH_SHORT)
.show();
}
});
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.vizitarea, menu);
return true;
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
And a fragment looks like this:
public class FirsCatFragment extends Fragment {
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_firstcat_layout, container, false);
}
}
and it's layout is something like this (fragment_firstcat_layout.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">
<ToggleButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New ToggleButton"
android:id="#+id/toggleButton" />
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New RadioButton"
android:id="#+id/radioButton" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New CheckBox"
android:id="#+id/checkBox" />
</LinearLayout>
So my behavior should be: onClick of a category from the listView, a corresponding fragment should be loaded... But I have no idea on how to implement this.
I imagine it to be somewhere in onItemClick, a case or an if statement checking the position of the clicked item, and based on that number, decide which fragment to bring up.
But I do not seem to get how this work. I checked multiple tutorials on the web but I cannot seem to be able to make it work.
The principle of the activity is similar to the Settings page in iOS (only for Android). Like in this image:
I know there is NavigationDrawer but it is not recommended for less than 3 top level elements. I only want 2 levels: master and detail, the category and the details of the category. That is all.
Can you please help me with this?
Thank you
For left side list view you can go for Navigation Drawer and load list view on navigation drawer. and load related fragment on frame layout. Follow this link: http://www.androidhive.info/2013/11/android-sliding-menu-using-navigation-drawer/
check this tutorial: http://android-er.blogspot.in/2013/04/replace-fragment.html
here in main layout having FrameLayout called maincontainer
Inside onitem click of your list view do like this:
MyFragment1 fragment = (MyFragment1)myFragmentManager.findFragmentByTag(TAG_1);
if (fragment == null) {
FragmentTransaction fragmentTransaction = myFragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.maincontainer, myFragment1, TAG_1);
fragmentTransaction.commit();
}else{
fragment.setMsg("MyFragment1 already loaded");
}
}});
Every time maincontainer replacing with new fragments.

listview checkbox trouble in android

i have a trouble with listview. i added a checkbox into listview to choose items. my data is coming from sqlite so i use simple cursor adapter. length of my list is aproximatley 250 lines. i am clicking a check box.when i scroll down page (list), checkbox is clicked in every 10 lines.(for example in my screen show 10 lines data when i scroll 11th lines, this row's checkbox had clicked. how can i solve this problem.
<?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"
android:orientation="vertical" >
<CheckBox
android:id="#+id/checkBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
/>
<TextView
android:id="#+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/checkBox"
android:textStyle="bold"
android:text="TextView" />
<TextView
android:id="#+id/nick"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/nick"
android:layout_alignBottom="#+id/nick"
android:layout_alignParentRight="true"
android:text="TextView" />
<TextView
android:id="#+id/phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/name"
android:layout_toRightOf="#+id/checkBox"
android:text="TextView" />
</RelativeLayout>
and this is source code
package com.example.myprojects;
import android.app.Activity;
import android.database.Cursor;
import android.os.Bundle;
import android.support.v4.widget.SimpleCursorAdapter;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.EditText;
import android.widget.ListView;
public class send_message extends Activity {
private ListView list;
private EditText search;
SimpleCursorAdapter adapterx;
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sendmessage);
list=(ListView)findViewById(R.id.list);
search=(EditText)findViewById(R.id.search);
loadfromdatabase();
}
private void loadfromdatabase() {
mydb info=new mydb(this);
info.open_read();
Cursor c = info.getAllData();
String[] columns = new String[] {mydb.KEY_NAME,mydb.KEY_PHONE, mydb.KEY_NICK};
int[] to = new int[] {R.id.name,R.id.phone, R.id.nick };
#SuppressWarnings("deprecation")
SimpleCursorAdapter adapter= new SimpleCursorAdapter(this, R.layout.activity_sendmesage_rows, c, columns, to,0);
list.setAdapter(adapter);
info.close();
}
}
If you have CheckBoxes in ListView you have problem, because ListView reuses Views that aren't already visible on screen. That's why when you scroll down, it loads (a few times) that one CheckBox that was checked by you previously. So you can't rely on default CheckBox's behaviour. What you need is:
Prevent user from checking CheckBox. You can do this by calling cb.setEnabled(false), where cb is CheckBox which you are using.
Create your own adapter class that will extend SimpleCursorAdapter. In this class you will store list of indexes of items that are checked.
Override getView() method in your adapter class and there manually set CheckBox to be checked if it's position is stored in checked items array.
Create OnClickListener for your ListView which will take care of adding/removing checked items' positions from adapter's internal array.
Edit:
This would be the code of your adapter:
public class MySimpleCursorAdapter extends SimpleCursorAdapter {
public ArrayList<Integer> mItemsChecked;
public MySimpleCursorAdapter(Context context, int layout, Cursor c,
String[] from, int[] to) {
super(context, layout, c, from, to);
mItemsChecked = new ArrayList<Integer>();
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
for(int i = 0; i < mItemsChecked.size(); i++) {
if(mItemsChecked.get(i) == position) {
CheckBox cb = (CheckBox)convertView.findViewById(R.id.checkBox1); // Instead of checkBox1, write your name of CheckBox
cb.setChecked(true);
}
}
return super.getView(position, convertView, parent);
}
/* Just a handy method that will be responsible for adding/removing
items' positions from mItemsChecked list */
public void itemClicked(int position) {
for(int i = 0; i < mItemsChecked.size(); i++) {
if(mItemsChecked.get(i) == position) {
mItemsChecked.remove(i);
return;
}
}
mItemsChecked.add(position);
}
}
This is OnItemClickListener for your ListView:
final ListView lv = (ListView)findViewById(R.id.listView1); // Your ListView name
lv.setOnItemClickListener(new OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
((MySimpleCursorAdapter)lv.getAdapter()).itemClicked(position);
lv.getAdapter().notifyDataSetChanged(); // Because we need to call getView() method for all visible items in ListView, so that they are updated
}
});
Just remember to disable your CheckBox so that user can't click it.
Now you can see it as a little hack, because user doesn't click CheckBox at all - application sees it as clicking in specific ListView item, which in turn automatically checks appropriate CheckBox for you.
Here is simple example that will help you to implement that scenario
http://www.mysamplecode.com/2012/07/android-listview-checkbox-example.html

switching from a CustomAdapter ListView to an standard ArrayAdapter ListView fails

I recently got interested in Android coding and working my way through several tutorials. however, right now i m stuck for a day and hope you guys can help me out.
basically i want to create a main menu and a submenu for every main menue entry. (right now this is only the case for the first entry)
For the main menu I used a ListView with different icons (realized with a custom adapter). Selecting one of the menu entries works fine in general, but if I choose to configure the onitemclick to start a new activity which is another (simple) ListView which uses the ArrayAdapter it breaks after switching into the submenu activity.
Strangely if i use the ArrayAdapter in both ListViews it is no problem; also when using CustomAdapter in both.
Here is the code, thanks in advance for any help ;)
main menu:
public class MainActivity extends ListActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// storing string resources into Array contentmenu
String[] contentmenu = getResources().getStringArray(R.array.mainmenu_cats);
// storing icons in Array
TypedArray iconarray = getResources().obtainTypedArray(R.array.mainmenu_icons);
// Binding resources Array to ListAdapter
this.setListAdapter(new ImageAndTextAdapter(this, R.layout.list_item, contentmenu, iconarray));
ListView lv = getListView();
// listening to single list item on click
lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// Launching new Activity on selecting single List Item
switch( position )
{
case 0: Intent newActivity0 = new Intent(getApplicationContext(),SubActivity.class);
startActivity(newActivity0);
break;
case 1: Intent newActivity1 = new Intent(getApplicationContext(),SubActivity2.class);
startActivity(newActivity1);
break;
}
}
});
}
submenu:
public class SubActivity extends ListActivity{
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// storing string resources into Array
String[] submen_1 = getResources().getStringArray(R.array.submenu_1);
// Binding resources Array to ListAdapter
setListAdapter(new ArrayAdapter<String>(ctx, R.layout.list_item1, R.id.submen1, submen_1));
ListView sublv1 = getListView();
// listening to single list item on click
sublv1.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// Launching new Activity on selecting single List Item
Intent newActivity = new Intent(getApplicationContext(),Page1.class);
// sending data to new activity
newActivity.putExtra("position",position);
startActivity(newActivity);
}
});
}
xml main menu:
list_item.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android">
<ImageView
android:id="#+id/option_icon"
android:layout_width="48dp"
android:layout_height="fill_parent"/>
<TextView
android:id="#+id/option_text"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dp"
android:textSize="16dp" >
</TextView>
sub menu:
list_item1.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android">
<ImageView
android:id="#+id/icon1"
android:layout_width="48dp"
android:layout_height="fill_parent"
android:src="#drawable/ic_action_google_play" />
<TextView
android:id="#+id/submen1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dp"
android:textSize="16dp" >
</TextView>
Currently you are not defining Hight and Width for LinearLayout in both list_item.xml and list_item1.xml layouts . add height-width as :
In list_item.xml :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android">
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<!-- PUT YOUR ImageView or other xml elements here -->
</LinearLayout>
and do same for list_item1.xml layout

How to implement onItemClickListener in List Activity

following is my ListActivity, onCreate code
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
fakeTripBuilder();
setContentView(R.layout.cutom_list_view);
SimpleAdapter adapter = new SimpleAdapter(this, list, R.layout.custom_row_view,
new String[] {"stop","distance","time","icon","mode"},
new int[] {R.id.text_stop,R.id.text_distance, R.id.text_time, R.id.icon, R.id.text_mode});
populateList();
setListAdapter(adapter);
}
inside the the same class i have the following method
#Override
protected void onListItemClick(ListView l, View v, int position, long id){
super.onListItemClick(l, v, position, id);
Log.d("Travel","You choosed!");
Object o = this.getListAdapter().getItem(position);
Toast.makeText(this, "You Choosed"+o.toString(), Toast.LENGTH_LONG).show();
}
and here is the "custom_list_view.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="wrap_content"
android:clickable="false"
android:gravity="center_horizontal|center_vertical"
android:orientation="vertical" >
<ListView
android:id="#android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#000fff"
android:layout_weight="2"
android:drawSelectorOnTop="false">
</ListView>
<TextView
android:id="#id/android:empty"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFff00"
android:text="No data"
/>
</LinearLayout>
Problem is, onListItemClick method do not call when i click on it. Help !!
To get a reference to the ListView in a ListActivity you should call:
ListView lv = getListView();
You do not need to set a click listener, it already has one. Simply override:
#Override
public void onListItemClick(ListView l, View v, int position, long id) {
Object item = lv.getAdapter().getItem(position);
}
And in your xml file, the ListView should have the id:
android:id="#android:id/list"
Edit
You need to remove
android:clickable="false"
from the layout to allow any child views to be clicked
A lot has changed since this question was asked in 2012. This is an update to the accepted answer
To use onItemClickListener in your ListActivity, just override the onListItemClick(...) method like this:
public void onListItemClick(ListView listView, View view, int position, long id) {
ListView myListView = getListView();
Object itemClicked = myListView.getAdapter().getItem(position);
Toast.makeText(getApplicationContext(), "Item Clicked: " + item + " \nPosition: " + id,
Toast.LENGTH_SHORT).show();
}
Notice the getItem() method instead of getItemAtPosition() in the accepted answer
Remember: for this to work, you need to have a listview with id list, else your app will crash.
<ListView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/list"
/>
Try overriding the onListItemClick method if you want to catch click events on your list.
ListView lv = (ListView) findViewById(R.layout.cutom_list_view);
You should use R.id.listview_id instead, that should be defined in R.layout.cutom_list_view
like so:
<ListView
android:id="#+id/listview_id"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ListView>
EDIT:
R.layout.cutom_list_view is id of your layout file, but you should find listview by its own id, defined like android:id="#+id/listview_id", so the id will be R.id.listview_id

Android Activity with Listview keeps throwing NullPointerException

I'm trying to create a ListView that displays 2 TextViews per row.
However I keep getting a NullPointerException when opening the Activity and I have no idea why (logCat logs don't tell me which line(s) on my end create the problem).
Here's the relevant code:
The main class EventViewActivity
public class EventViewActivity extends ListActivity {
public String[] eventTitles;
#Override
public void onCreate(Bundle savedInstanceState) {
//Remove title bar
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
//Remove notification bar
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
super.onCreate(savedInstanceState);
setContentView(R.layout.eventview_layout);
eventTitles = new String[]{
getResources().getString(R.string.eventtitle1),
getResources().getString(R.string.eventtitle2),
getResources().getString(R.string.eventtitle3),
getResources().getString(R.string.eventtitle4),
getResources().getString(R.string.eventtitle5)
};
setListAdapter(new ArrayAdapter<String>(this, R.layout.eventview_layout, R.id.row_title, eventTitles));
setListAdapter(new ArrayAdapter<String>(this, R.layout.eventview_layout, R.id.row_descr, eventTitles));
ListView lv = getListView();
lv.setTextFilterEnabled(true);
}
#Override
protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
Toast.makeText(getApplicationContext(), "You have clicked an item", Toast.LENGTH_SHORT).show();
}
}
layout.xml is:
<LinearLayout xmlns:android="schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:orientation="vertical" >
<ListView android:id="#+id/android:eventlist" android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/eventview_background"/>
</LinearLayout>
Thanks!
does your eventview_layout has a ListView with id android:id="#android:id/list" ..? if not add it.. i assume its not done
a small correction..
<LinearLayout xmlns:android="schemas.android.com/apk/res/android"; android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ListView android:id="#android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/eventview_background"/>
</LinearLayout>
its necessary that the contentView of ListACtivity has a listView with exact same Id..
I think the way you are approaching for ListView is not the correct.
Please have A look on this sample LINK to have complete view how create a ListView with custom adapter.
The above link has sample application created with listview and each listitem having two text fields as your requirement.
You should call the:
super.onCreate();
first!

Categories

Resources