Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如果我在列表视图中单击特定项,如何使用volley库获取特定数据_Android_Json_Listview_Android Volley - Fatal编程技术网

Android 如果我在列表视图中单击特定项,如何使用volley库获取特定数据

Android 如果我在列表视图中单击特定项,如何使用volley库获取特定数据,android,json,listview,android-volley,Android,Json,Listview,Android Volley,如果我在列表视图中使用volley库的功能单击特定项,如何获取特定数据 我正在使用volley库获取一个包含图像和文本的列表视图。图文 我想点击列表视图中的特定项目。因此,它应该在其他屏幕中打开,并显示更多详细信息。 例如:如果我在列表视图“Hotel Ramashray”的第一个项目中单击,它应该会以另一个活动名称、计时成本、图像url等的详细信息打开。 如果我点击了第二个项目“Mirchi and mine”,它应该会显示更多的细节,比如名称、计时成本、图片url等 我该怎么做呢?请帮帮我

如果我在列表视图中使用volley库的功能单击特定项,如何获取特定数据

我正在使用volley库获取一个包含图像和文本的列表视图。图文

我想点击列表视图中的特定项目。因此,它应该在其他屏幕中打开,并显示更多详细信息。 例如:如果我在列表视图“Hotel Ramashray”的第一个项目中单击,它应该会以另一个活动名称、计时成本、图像url等的详细信息打开。 如果我点击了第二个项目“Mirchi and mine”,它应该会显示更多的细节,比如名称、计时成本、图片url等

我该怎么做呢?请帮帮我

在图像中看到我正在获取列表视图,如下图所示,现在我想单击特定项目,它应该是“打开新活动”并提供更多详细信息

适配器->自定义列表适配器.java

public class CustomListAdapter extends BaseAdapter {
    private Activity activity;
    private LayoutInflater inflater;
    private List<Movie> movieItems;
    ImageLoader imageLoader = AppController.getInstance().getImageLoader();

    public CustomListAdapter(Activity activity, List<Movie> movieItems) {
        this.activity = activity;
        this.movieItems = movieItems;
    }

    @Override
    public int getCount() {
        return movieItems.size();
    }

    @Override
    public Object getItem(int location) {
        return movieItems.get(location);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        if (inflater == null)
            inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        if (convertView == null)
            convertView = inflater.inflate(R.layout.list_row, null);

        if (imageLoader == null)
            imageLoader = AppController.getInstance().getImageLoader();
        /*ImageView img;
        img = (ImageView)convertView
                .findViewById(R.id.img);

        img.setImageResource(R.drawable.bc);
        else {*/

        NetworkImageView _ImageView = (NetworkImageView) convertView.findViewById(R.id.thumbnail);
         _ImageView.setDefaultImageResId(R.drawable.bc);
        //NetworkImageView.setImageUrl(m.getThumbnailUrl(), ImageLoader);
        /*NetworkImageView thumbNail = (NetworkImageView) convertView
                .findViewById(R.id.thumbnail);*/
        TextView name = (TextView) convertView.findViewById(R.id.name);
        TextView average_ratings = (TextView) convertView.findViewById(R.id.average_ratings);
        TextView address=(TextView) convertView.findViewById(R.id.area);
        TextView cuisine =(TextView) convertView.findViewById(R.id.cuisine);
        //TextView genre = (TextView) convertView.findViewById(R.id.genre);
        //TextView year = (TextView) convertView.findViewById(R.id.releaseYear);

        // getting movie data for the row
        Movie m = movieItems.get(position);

        // thumbnail image
        //_ImageView.setImageUrl(m.getThumbnailUrl(), imageLoader);
        /*if (TextUtils.isEmpty(m.getThumbnailUrl()))
            thumbNail.setImageResource(R.drawable.bc);
    else
            //Log.d("KeyHash:","Neeraj");*/
        _ImageView.setImageUrl(m.getThumbnailUrl(), imageLoader);
        /*if (m.getThumbnailUrl().compareTo("")!=0)
            thumbNail.setImageUrl(m.getThumbnailUrl(), imageLoader);
        //else{
        //thumbNail.setImageResource(R.drawable.bc);

            else {

                thumbNail.setDefaultImageResId(R.drawable.bc);
                //thumbNail.setErrorImageResId(R.drawable.bc);

        }*/


        // title
        name.setText(m.getName());

        // rating
        average_ratings.setText("Rating: " + String.valueOf(m.getAverage_ratings()));
        address.setText("Area: " + String.valueOf(m.getAddress()));
        cuisine.setText("Cusine: " + String.valueOf(m.getCuisine()));
        /*// genre
        String genreStr = "";
        for (String str : m.getGenre()) {
            genreStr += str + ", ";
        }
        genreStr = genreStr.length() > 0 ? genreStr.substring(0,
                genreStr.length() - 2) : genreStr;
        genre.setText(genreStr);

        // release year
        year.setText(String.valueOf(m.getYear()));*/

        return convertView;
    }
}  

在您的
列表视图活动中添加此项,

listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        Movie movie = movieList.get(position);
        // retrieve from movie whatever you want
        movie.getName();
        Toast.makeText(getApplicationContext(),"Name: "+movie.getName(),Toast.LENGTH_LONG).show();
        // creaet intent and add data to it.
        Intent intent = new Intent(MainActivity.this,SecondActivity.class); 
        intent.putExtra("name",movie.getName()); 
        startActivity(intent);
     }
});

是的,当我点击“撞车”时尝试过。java.lang.NullPointerException:尝试对空对象引用调用接口方法“java.lang.Object java.util.List.get(int)”。请尝试更新的答案。它应该是
movieList.get(position)
而不是
movieItems.get(position)
我已经尝试了更新的答案。当我点击特定的项目时,什么都没有发生。我在click listener中添加了toast。试试这个,顺便说一下,截击只下载数据。您本可以让自己更容易理解如何在简单的listview上添加项目单击侦听器
public class Movie {
    private String name, thumbnailUrl;
    //private int year;
    private String average_ratings,area,cuisine,address;
//  private ArrayList<String> genre;

    public Movie() {
    }

    public Movie(String name, String thumbnailUrl, String average_ratings, String area, String cuisine, String address
            ) {
        this.name = name;
        this.thumbnailUrl = thumbnailUrl;
        //this.year = year;
        this.average_ratings = average_ratings;
        this.area=area;
        this.cuisine=cuisine;
this.address=address;
        //this.genre = genre;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getThumbnailUrl() {
        return thumbnailUrl;
    }

    public void setThumbnailUrl(String thumbnailUrl) {
        this.thumbnailUrl = thumbnailUrl;
    }

    /*public int getYear() {
        return year;
    }*/

    /*public void setYear(int year) {
        this.year = year;
    }*/

    public String getAverage_ratings() {
        return average_ratings;
    }

    public void setAverage_ratings(String average_ratings) {
        this.average_ratings = average_ratings;
    }
    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getCuisine() {
        return cuisine;
    }

    public void setCuisine(String cuisine) {
        this.cuisine = cuisine;
    }
    /*public ArrayList<String> getGenre() {
        return genre;
    }

    public void setGenre(ArrayList<String> genre) {
        this.genre = genre;
    }
*/
}
public class ListViewActivity extends Activity {
    // Log tag
    private static final String TAG = ListViewActivity.class.getSimpleName();
    // change here url of server api
    private static final String url = "http://fa94e20d.ngrok.io/api/v1/restaurants?per_page=10&page=1&sort_col=average_ratings";

    private ProgressDialog pDialog;
    private List<Movie> movieList = new ArrayList<Movie>();
    private ListView listView;
    private CustomListAdapter adapter;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_listview);
        listView = (ListView) findViewById(R.id.list);
        adapter = new CustomListAdapter(this, movieList);
        listView.setAdapter(adapter);
         pDialog = new ProgressDialog(this);
        // Showing progress dialog before making http request
        pDialog.setMessage("Loading...");
        pDialog.show();
        // changing action bar color
        //getActionBar().setBackgroundDrawable(
              //  new ColorDrawable(Color.parseColor("#1b1b1b")));
        // Creating volley request obj
        JsonArrayRequest movieReq = new JsonArrayRequest(url,
                new Response.Listener<JSONArray>() {
                    @Override
                    public void onResponse(JSONArray response) {
                        Log.d(TAG, response.toString());
                        hidePDialog();
                        // Parsing json
                        for (int i = 0; i < response.length(); i++) {
                            try {
                                JSONObject obj = response.getJSONObject(i);
                                Movie movie = new Movie();
                                //movie.setTitle(obj.getString("title"));
                                movie.setName(obj.getString("name"));
                                //movie.setThumbnailUrl(obj.getString("image"));
                                movie.setThumbnailUrl(obj.getString("image_url"));
                                movie.setAverage_ratings(obj.getString("average_ratings"));
                                movie.setCuisine(obj.getString("cuisine"));
                                movie.setAddress(obj.getJSONObject("address").getString("area"));
                                //movie.setAddress(obj.getString("address"));
                                //movie.setYear(obj.getInt("releaseYear"));
                                // Genre is json array
                                /*JSONArray genreArry = obj.getJSONArray("genre");
                                ArrayList<String> genre = new ArrayList<String>();
                                for (int j = 0; j < genreArry.length(); j++) {
                                    genre.add((String) genreArry.get(j));
                                }
                                movie.setGenre(genre);*/
                                // adding movie to movies array
                                movieList.add(movie);
                            } catch (JSONException e) {
                                e.printStackTrace();
                            }
                        }

                        // notifying list adapter about data changes
                        // so that it renders the list view with updated data
                        adapter.notifyDataSetChanged();
                    }
                }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                VolleyLog.d(TAG, "Error: " + error.getMessage());
                hidePDialog();

            }
        });

        // Adding request to request queue
        AppController.getInstance().addToRequestQueue(movieReq);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        hidePDialog();
    }

    private void hidePDialog() {
        if (pDialog != null) {
            pDialog.dismiss();
            pDialog = null;
        }
    }

    /*@Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }*/

}
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/ly_root"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="12dp"
    android:background="#FEFEFE"
    app:cardCornerRadius="8dp">
    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">
        <com.android.volley.toolbox.NetworkImageView
            android:id="@+id/thumbnail"
            android:layout_width="120dp"
            android:layout_height="100dp"
            android:layout_marginRight="8dp"
            android:scaleType="centerCrop" />

        <!-- Restaurant name  -->
        <TextView
            android:id="@+id/name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"

            android:layout_toRightOf="@+id/thumbnail"
            android:textStyle="bold" />

        <TextView
            android:id="@+id/area"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/name"
            android:layout_toRightOf="@+id/thumbnail"
            android:textColor="#D2691E"/>

        <!-- Rating -->
        <TextView
            android:id="@+id/average_ratings"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/area"
            android:layout_toRightOf="@+id/thumbnail"
            android:textColor="#D2691E" />

        <TextView
            android:id="@+id/cuisine"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/average_ratings"
            android:layout_toRightOf="@+id/thumbnail"
            android:textColor="#D2691E" />
    </RelativeLayout>

</android.support.v7.widget.CardView>



<!--
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
     >
&lt;!&ndash;<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/list_row_selector"
    android:padding="8dp" >&ndash;&gt;

    &lt;!&ndash; Thumbnail Image &ndash;&gt;
    <android.support.v7.widget.CardView
        android:id="@+id/ly_root"
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#FEFEFE"
        android:layout_margin="8dp"
        app:cardCornerRadius="4dp">


    &lt;!&ndash;<android.support.v7.widget.CardView
        xmlns:card_view="http://schemas.android.com/apk/res-auto"
        android:id="@+id/card_view"
        android:layout_gravity="center"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        card_view:cardCornerRadius="4dp">&ndash;&gt;
    <com.android.volley.toolbox.NetworkImageView
        android:id="@+id/thumbnail"
        android:layout_width="120dp"
        android:layout_height="80dp"
        android:scaleType="centerCrop"
        android:layout_marginRight="8dp"  />

    &lt;!&ndash; Restaurant name  &ndash;&gt;
    <TextView
        android:id="@+id/name"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"

        android:layout_toRightOf="@+id/thumbnail"
        android:textSize="@dimen/title"
        android:textStyle="bold" />

    <TextView
        android:id="@+id/area"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/name"
        android:textColor="#D2691E"
        android:layout_toRightOf="@+id/thumbnail"
        android:textSize="@dimen/rating" />

    &lt;!&ndash; Rating &ndash;&gt;
    <TextView
        android:id="@+id/average_ratings"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/area"
        android:textColor="#D2691E"
        android:layout_toRightOf="@+id/thumbnail"

        android:textSize="@dimen/rating" />

    <TextView
        android:id="@+id/cuisine"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/average_ratings"
        android:textColor="#D2691E"
        android:layout_toRightOf="@+id/thumbnail"
        android:textSize="@dimen/rating" />

    &lt;!&ndash; Genre &ndash;&gt;
   &lt;!&ndash; <TextView
        android:id="@+id/genre"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/rating"
        android:layout_marginTop="5dp"
        android:layout_toRightOf="@+id/thumbnail"
        android:textColor="@color/genre"
        android:textSize="@dimen/genre" />&ndash;&gt;
&lt;!&ndash;
    &lt;!&ndash; Release Year &ndash;&gt;
    <TextView
        android:id="@+id/releaseYear"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:textColor="@color/year"
        android:textSize="@dimen/year" />&ndash;&gt;
    </android.support.v7.widget.CardView>
</LinearLayout>-->
[{"id":149,"name":"Hotel Ramashray","description":"Great Breakfasts","restaurant_type":null,"restaurant_url":null,"restaurant_facebook_url":null,"restaurant_google_url":null,"restaurant_zomato_url":"https://www.zomato.com/mumbai/hotel-ramashray-matunga-east","average_ratings":"4.9","profile_image_file_name":null,"profile_image_content_type":null,"cover_image_file_name":null,"cover_image_content_type":null,"establishment_type":"Casual Dining","cost":"200","cuisine":"South Indian","timing":"5 AM to 9:30 PM (Tue-Sun), Mon Closed","extras":null,"phone_numbers":[{"id":201,"restaurant_id":149,"number":"022 30151190","created_at":"2016-07-25T07:01:21.224-04:00","updated_at":"2016-07-25T07:01:21.224-04:00"}],"image_url":null,"menus":[],"restaurant_offers":[]},{"id":20,"name":"Mirchi And Mime","description":"Insta-Worthy, Trending this Week","restaurant_type":null,"restaurant_url":null,"restaurant_facebook_url":null,"restaurant_google_url":null,"restaurant_zomato_url":"https://www.zomato.com/mumbai/mirchi-and-mime-powai","average_ratings":"4.9","profile_image_file_name":null,"profile_image_content_type":null,"cover_image_file_name":null,"cover_image_content_type":null,"establishment_type":"Casual Dining","cost":"1000","cuisine":"North Indian, South Indian, Mughlai","timing":"12:30 PM to 3 PM, 6:30 PM to 11 PM","extras":null,"phone_numbers":[{"id":25,"restaurant_id":20,"number":"022 41415151","created_at":"2016-07-25T07:01:20.074-04:00","updated_at":"2016-07-25T07:01:20.074-04:00"},{"id":26,"restaurant_id":20,"number":" +91 8828024151","created_at":"2016-07-25T07:01:20.076-04:00","updated_at":"2016-07-25T07:01:20.076-04:00"}],"image_url":null,"menus":[],"restaurant_offers":[{"id":12,"text":"\"Choice of a Fratelli red or white wine free per person \u0026 a free cocktail/mocktail per person\"","offer_link":"https://www.eazydiner.com//mumbai/mirchi-and-mime-powai-230933","resource":"eazydiner"}]},{"id":689,"name":"Wasabi By Morimoto - The Taj Mahal Palace","description":"Book a Table Online on Zomato, Super Sushi, Trending this Week","restaurant_type":null,"restaurant_url":null,"restaurant_facebook_url":null,"restaurant_google_url":null,"restaurant_zomato_url":"https://www.zomato.com/mumbai/wasabi-by-morimoto-the-taj-mahal-palace-colaba","average_ratings":"4.9","profile_image_file_name":null,"profile_image_content_type":null,"cover_image_file_name":null,"cover_image_content_type":null,"establishment_type":"Fine Dining","cost":"12000","cuisine":"Japanese, Sushi","timing":"12:30 PM to 2:45 PM, 7 PM to 11:45 PM","extras":null,"phone_numbers":[{"id":946,"restaurant_id":689,"number":"022 66653366","created_at":"2016-07-25T07:01:25.843-04:00","updated_at":"2016-07-25T07:01:25.843-04:00"}],"image_url":null,"menus":[],"restaurant_offers":[]},{"id":197,"name":"Jimis Burgers","description":"Kickass Burgers","restaurant_type":null,"restaurant_url":null,"restaurant_facebook_url":null,"restaurant_google_url":null,"restaurant_zomato_url":"https://www.zomato.com/mumbai/jimis-burgers-malad-west","average_ratings":"4.9","profile_image_file_name":null,"profile_image_content_type":null,"cover_image_file_name":null,"cover_image_content_type":null,"establishment_type":"Quick Bites","cost":"300","cuisine":"Burger","timing":"12 Noon to 11 PM (Tue-Sun), Mon Closed","extras":null,"phone_numbers":[{"id":266,"restaurant_id":197,"number":"022 28882645","created_at":"2016-07-25T07:01:21.639-04:00","updated_at":"2016-07-25T07:01:21.639-04:00"},{"id":267,"restaurant_id":197,"number":" +91 8879485752","created_at":"2016-07-25T07:01:21.640-04:00","updated_at":"2016-07-25T07:01:21.640-04:00"}],"image_url":null,"menus":[],"restaurant_offers":[]},{"id":504,"name":"Peshawri - ITC Maratha","description":"Kebab Places","restaurant_type":null,"restaurant_url":null,"restaurant_facebook_url":null,"restaurant_google_url":null,"restaurant_zomato_url":"https://www.zomato.com/mumbai/peshawri-itc-maratha-chakala","average_ratings":"4.9","profile_image_file_name":null,"profile_image_content_type":null,"cover_image_file_name":null,"cover_image_content_type":null,"establishment_type":"Fine Dining","cost":"5000","cuisine":"North Indian, Mughlai","timing":"12 Noon to 2:45 PM, 7 PM to 11:45 PM (Mon-Sun)","extras":null,"phone_numbers":[{"id":680,"restaurant_id":504,"number":"022 30151699","created_at":"2016-07-25T07:01:24.251-04:00","updated_at":"2016-07-25T07:01:24.251-04:00"}],"image_url":null,"menus":[],"restaurant_offers":[]},{"id":12,"name":"Farzi Cafe","description":"Trending this Week","restaurant_type":null,"restaurant_url":null,"restaurant_facebook_url":null,"restaurant_google_url":null,"restaurant_zomato_url":"https://www.zomato.com/mumbai/farzi-cafe-lower-parel","average_ratings":"4.8","profile_image_file_name":"1a1938c7ca6630b4fbc9b0b0a0c8ef95_featured_v2.jpg","profile_image_content_type":"image/jpeg","cover_image_file_name":null,"cover_image_content_type":null,"establishment_type":"Casual Dining","cost":"1500","cuisine":"North Indian, Continental","timing":"12 Noon to 1 AM","extras":null,"phone_numbers":[{"id":15,"restaurant_id":12,"number":"+91 8433942801","created_at":"2016-07-25T07:01:20.009-04:00","updated_at":"2016-07-25T07:01:20.009-04:00"},{"id":16,"restaurant_id":12,"number":" +91 8433942802","created_at":"2016-07-25T07:01:20.011-04:00","updated_at":"2016-07-25T07:01:20.011-04:00"}],"image_url":"http://comida-dev.s3.amazonaws.com/res_pro_images/12.jpg","menus":[],"restaurant_offers":[]},{"id":451,"name":"Shree Thaker Bhojanalay","description":"Regional Favorites, Terrific Thalis, All You Can Eat","restaurant_type":null,"restaurant_url":null,"restaurant_facebook_url":null,"restaurant_google_url":null,"restaurant_zomato_url":"https://www.zomato.com/mumbai/shree-thaker-bhojanalay-kalbadevi","average_ratings":"4.8","profile_image_file_name":null,"profile_image_content_type":null,"cover_image_file_name":null,"cover_image_content_type":null,"establishment_type":"Casual Dining","cost":"1000","cuisine":"Gujarati","timing":"11:30 AM to 3:30 PM, 7 PM to 10:30 PM (Mon-Sat)...","extras":null,"phone_numbers":[{"id":610,"restaurant_id":451,"number":"022 22069916","created_at":"2016-07-25T07:01:23.817-04:00","updated_at":"2016-07-25T07:01:23.817-04:00"},{"id":611,"restaurant_id":451,"number":" 022 22011232","created_at":"2016-07-25T07:01:23.818-04:00","updated_at":"2016-07-25T07:01:23.818-04:00"}],"image_url":null,"menus":[],"restaurant_offers":[]},{"id":80,"name":"Yauatcha","description":"Pan-Asian Delicacies, Trending this Week","restaurant_type":null,"restaurant_url":null,"restaurant_facebook_url":null,"restaurant_google_url":null,"restaurant_zomato_url":"https://www.zomato.com/mumbai/yauatcha-bandra-kurla-complex","average_ratings":"4.8","profile_image_file_name":null,"profile_image_content_type":null,"cover_image_file_name":null,"cover_image_content_type":null,"establishment_type":"Fine Dining","cost":"2400","cuisine":"Chinese, Asian","timing":"12 Noon to 1 AM","extras":"Celebrate the Dragon Boat Festival with an exclusive limited edition menu, which will be available to order a la carte until 30th June.","phone_numbers":[{"id":104,"restaurant_id":80,"number":"+91 9222222800","created_at":"2016-07-25T07:01:20.627-04:00","updated_at":"2016-07-25T07:01:20.627-04:00"}],"image_url":null,"menus":[],"restaurant_offers":[{"id":57,"text":"Taste of Yauatcha,Yam Sing @ Rs. 988 + Taxes,Dim sum Trail @ Rs. 2000 A.I.,Tan Cha @ Rs. 350 + Taxes,Endless Martini or Wines paired with Dim sum @ Rs. 1788 + Taxes,Endless Beer paired with Dim sum @ Rs. 1288 + Taxes,Complimentary Dessert","offer_link":"https://www.dineout.co.in/mumbai/yauatcha-bandra-east-western-suburbs-5031","resource":"dineout"},{"id":58,"text":"\"A free dessert platter per table\"","offer_link":"https://www.eazydiner.com//mumbai/yauatcha-bandra-kurla-complex-223080","resource":"eazydiner"}]},{"id":581,"name":"B Merwan","description":"Irani Cafés","restaurant_type":null,"restaurant_url":null,"restaurant_facebook_url":null,"restaurant_google_url":null,"restaurant_zomato_url":"https://www.zomato.com/mumbai/b-merwan-grant-road","average_ratings":"4.8","profile_image_file_name":null,"profile_image_content_type":null,"cover_image_file_name":null,"cover_image_content_type":null,"establishment_type":"Quick Bites,Dessert Parlor","cost":"100","cuisine":"Bakery, Fast Food, Parsi, Desserts","timing":"5:30 AM to 5:30 PM","extras":null,"phone_numbers":[{"id":788,"restaurant_id":581,"number":"022 23093321","created_at":"2016-07-25T07:01:24.939-04:00","updated_at":"2016-07-25T07:01:24.939-04:00"}],"image_url":null,"menus":[],"restaurant_offers":[]},{"id":133,"name":"Masala Library","description":"Insta-Worthy","restaurant_type":null,"restaurant_url":null,"restaurant_facebook_url":null,"restaurant_google_url":null,"restaurant_zomato_url":"https://www.zomato.com/mumbai/masala-library-bandra-kurla-complex","average_ratings":"4.8","profile_image_file_name":null,"profile_image_content_type":null,"
cover_image_file_name":null,"cover_image_content_type":null,"establishment_type":"Fine Dining","cost":"5000","cuisine":"North Indian, South Indian","timing":"12 Noon to 2:30 PM, 7 PM to 11 PM","extras":null,"phone_numbers":[{"id":177,"restaurant_id":133,"number":"022 66424142","created_at":"2016-07-25T07:01:21.083-04:00","updated_at":"2016-07-25T07:01:21.083-04:00"},{"id":178,"restaurant_id":133,"number":" +91 8452900900","created_at":"2016-07-25T07:01:21.085-04:00","updated_at":"2016-07-25T07:01:21.085-04:00"}],"image_url":null,"menus":[],"restaurant_offers":[{"id":94,"text":"\"A free glass of wine/mocktail per person\"","offer_link":"https://www.eazydiner.com//mumbai/masala-library-bandra-kurla-complex-223029","resource":"eazydiner"}]}]
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        Movie movie = movieList.get(position);
        // retrieve from movie whatever you want
        movie.getName();
        Toast.makeText(getApplicationContext(),"Name: "+movie.getName(),Toast.LENGTH_LONG).show();
        // creaet intent and add data to it.
        Intent intent = new Intent(MainActivity.this,SecondActivity.class); 
        intent.putExtra("name",movie.getName()); 
        startActivity(intent);
     }
});
// get info from intent
Bundle bundle = getIntent().getExtras();
String name = bundle.getString("name");