-2

I am developing an app that providing details about a city. When the user selects any of the city from the first page, the page has to direct to the next page..in that page the details of city has to be displayed, by scrolling down the user has to read all details.. for this what I have to done. which component I have to use..pls help ..I read so many questions but I didn't get an answer. I know this is a simple thing but this is my roblem..

I read this questions

Displaying object details in a ListView in Android

Community
  • 1
  • 1
user2223317
  • 211
  • 1
  • 3
  • 13
  • 1
    use custom list view. – Senthil Apr 19 '13 at 06:16
  • thanks ...by using custom list view i can display the name of different cities...when the user clicks on any of the list item ..the user has to go to another page ..that will be the details of that city... in that page which method I have to use..thats my problem... – user2223317 Apr 19 '13 at 06:21
  • use setonitemclicklistner for listview. – Senthil Apr 19 '13 at 06:27
  • that i know...setitemonclick listner...when we click on that list next page will be selected I am speaking about that page ..that page must include a desription...which method i have to slect for that ...web view..? – user2223317 Apr 19 '13 at 06:39

1 Answers1

1

Use Custom listview for example See this Sample and this Sample 2

To call the detail view. you need to handle the OnItemClick Listener of the ListView in first activity.On Item click Call the intent to for Detail Activity. You can pass the required text with intent.putExtra to detail activity. And dont forget to give that New activity in manifest.

It Will be something like this:

listView.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,int position, long id) {
  Intent in=new Intent(FirstActivity.this,DetailActivity.class);
  startActivity(in)           
            }
        });

Refer This Sample 3. It will give clear picture.

Abhi
  • 8,935
  • 7
  • 37
  • 60
  • thanks abhi..these all are ok.. but I want a detail page.. of a city description..for example their history so which method i have to use for example web view..that I am asking...list view..ok...i am ..discussing about after that...there will b ap – user2223317 Apr 19 '13 at 06:37
  • From where you getting city description? – Abhi Apr 19 '13 at 06:38
  • the description I have with me...that was written by me...for that iresearched several datas..that is my own data..if it is from another site i could be use webview....for my own data what i have to do... – user2223317 Apr 19 '13 at 06:43
  • 1
    Take another activty like i said, Pass the description to that activity using putExtra. Take textview there and set description to the textview – Abhi Apr 19 '13 at 06:49
  • textview...by using textview is it possible dipslay morethan two pages...like it has to scroll down..that much of data is there... – user2223317 Apr 19 '13 at 06:59
  • 1
    You can design the layout as you want,if you want the text scroll use ScrollView – Abhi Apr 19 '13 at 07:00
  • 1
    http://stackoverflow.com/questions/6674341/how-to-use-scrollview-in-android. this cleared my doubt..once again ..thanks abhy and daveychu... I got my answer from your help...that is... if the entire screen has to scroll the scroolview has to be declared as root element.. and if the text view only ..then do it only.... I got the answer... – user2223317 Apr 19 '13 at 07:10