Re: [android-developers] Re: How to get only one restaurant when I press click button one click

2016-06-09 Thread TreKing
On Wed, Jun 8, 2016 at 3:32 PM, abeer shlby  wrote:

> I write this lines of code under button but it not working why


"it not working" is useless information for someone trying to help you
solve a problem.

http://www.catb.org/esr/faqs/smart-questions.html

-
TreKing  - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/CANCScgheYv44_WW%2BZpRqo-0-yNaMF%2BOBJcc551hvni8pgT4WuA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [android-developers] Re: How to get only one restaurant when I press click button one click

2016-06-08 Thread abeer shlby
I write this lines of code under button but it not working why
can you help me in this code
You could storage the parsed ArrayList, make a global variable for counting
the number of times that the button has been clicked.
ArrayList venuesList; Button btn; int clickCount; //
ArrayList allResults; List shownResults = new
ArrayList(); ArrayAdapter  myAdapter; @Override protected
void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
new fourquare().execute(); btn=(Button) findViewById(R.id.button);
btn.setonclickListener(new View.onclickListener() { @Override public void
onclick(View v) { String name = venuesList.get(clickCount).getName();
String cat = venuesList.get(clickCount).getCategory(); String city =
venuesList.get(clickCount).getCity(); shownResults.add(name + "," + "cat" +
"" + city); clickCount++; myAdapter.notifyDataSetChanged(); } }); }

On Wed, Jun 8, 2016 at 12:42 AM, TreKing  wrote:

>
> On Mon, Jun 6, 2016 at 9:07 AM,  wrote:
>
>> Can you help me customizing code
>>>
>> i do as following
>>
>
> I already gave you a break down of what you need to do. What part
> specifically are you having trouble with?
>
>
> -
> TreKing  - Chicago
> transit tracking app for Android-powered devices
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Android Developers" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/android-developers/QbNLketf7S4/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> android-developers+unsubscr...@googlegroups.com.
> To post to this group, send email to android-developers@googlegroups.com.
> Visit this group at https://groups.google.com/group/android-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/android-developers/CANCScgj%3DpCAcsBO7moXe9G%3DDaS99pg7qOnn1W-TsYx_Nh7xS2Q%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/CAH%3Da90z%2Bq%2B34%2BY%3Doma8u4qUhYBt2iTvR06d2K-_RkVQCqWs5uQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [android-developers] Re: How to get only one restaurant when I press click button one click

2016-06-07 Thread TreKing
On Mon, Jun 6, 2016 at 9:07 AM,  wrote:

> Can you help me customizing code
>>
> i do as following
>

I already gave you a break down of what you need to do. What part
specifically are you having trouble with?

-
TreKing  - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/CANCScgj%3DpCAcsBO7moXe9G%3DDaS99pg7qOnn1W-TsYx_Nh7xS2Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] Re: How to get only one restaurant when I press click button one click

2016-06-06 Thread abeer . shlby
Can any one help me

On Sunday, June 5, 2016 at 1:35:33 AM UTC+2, abeer...@gmail.com wrote:
>
> I have app inside it only one activity (main activity) and layout XML of 
> main activity have only 
> list view .this app get restaurants near from my location and display it 
> in list view 
> What i need to do is add button to the main activity layout when i press 
> on button get to me list of restaurant item by item
> from json file and display it in list view but not display all restaurants 
> in one click but show item by item
> every click get restaurant
> suppose i have 3 restaurant in json file
> when i click on button for first click get me first restaurant
> when i click on button for second click get me second restaurant
> when i click on button for third click get me third restaurant 
> How to customize this code to accept get item by item restaurant from json 
> file
> My code include class and activity and code is working success  
> my class is FoursquareVenue
> package com.foodsmap_project_app.foodsmap_project_app;
> public class FoursquareVenue
> {
> private String name;
> private String city;
>
> private String category;
>
> public FoursquareVenue() {
> this.name = "";
> this.city = "";
> this.setCategory("");
> }
>
> public String getCity() {
> if (city.length() > 0) {
> return city;
> }
> return city;
> }
>
> public void setCity(String city) {
> if (city != null) {
> this.city = city.replaceAll("\\(", "").replaceAll("\\)", "");
> ;
> }
> }
>
> public void setName(String name) {
> this.name = name;
> }
>
> public String getName() {
> return name;
> }
>
> public String getCategory() {
> return category;
> }
>
> public void setCategory(String category) {
> this.category = category;
> }
>
> }
> MainActivity.java
> public class MainActivity extends ListActivity {
> ArrayList venuesList;
>final String CLIENT_ID = 
> "SVIBXYYXOEARXHDI4FWAHXGO5ZXOY204TCF1QJFXQLY5FPV4";
> final String CLIENT_SECRET = 
> "BAAJO1KXRWESGTJJGVON4W3WUFHAQDAJPLRIYJJ5OPHFQ5VI";
>final String latitude = "30.435665153239377";
>final String longtitude = "31.3280148";
> ArrayAdapter  myAdapter;
>
> @Override
> protected void onCreate(Bundle savedInstanceState)
> {
> super.onCreate(savedInstanceState);
> setContentView(R.layout.activity_main);
> new fourquare().execute();
>
> }
> private class fourquare extends AsyncTask {
>
> String temp;
>
> @Override
> protected String doInBackground(View... urls) {
>
>
> temp = makeCall("
> https://api.foursquare.com/v2/venues/search?client_id=; + CLIENT_ID + 
> "_secret=" + CLIENT_SECRET + 
> "=20130815=30.435665153239377,31.144435908398464" + 
> "=resturant");
>
>
> return "";
> }
>
> @Override
> protected void onPreExecute() {
>
> }
>
> @Override
> protected void onPostExecute(String result) {
> if (temp == null) {
>
> } else {
>
> venuesList = (ArrayList) 
> parseFoursquare(temp);
>
> List listTitle = new ArrayList();
>
> for (int i = 0; i < venuesList.size(); i++) {
>
> listTitle.add(i, venuesList.get(i).getName() + ", " + 
> venuesList.get(i).getCategory() + "" + venuesList.get(i).getCity());
> }
>
>
> myAdapter = new ArrayAdapter(MainActivity.this, 
> R.layout.row_layout, R.id.listText, listTitle);
> setListAdapter(myAdapter);
> }
> }
> }
> public static String makeCall(String url) {
>
>
> StringBuffer buffer_string = new StringBuffer(url);
> String replyString = "";
>
>
> HttpClient httpclient = new DefaultHttpClient();
>
> HttpGet httpget = new HttpGet(buffer_string.toString());
>
> try {
>
> HttpResponse response = httpclient.execute(httpget);
> InputStream is = response.getEntity().getContent();
>
>
> BufferedInputStream bis = new BufferedInputStream(is);
> ByteArrayBuffer baf = new ByteArrayBuffer(20);
> int current = 0;
> while ((current = bis.read()) != -1) {
> baf.append((byte) current);
> }
>
> replyString = new String(baf.toByteArray());
> } catch (Exception e) {
> e.printStackTrace();
> }
>
> return replyString.trim();
> }
> private static ArrayList parseFoursquare(final String 
> response) {
>
> ArrayList temp = new ArrayList();
> try {
>
>
> JSONObject jsonObject = new JSONObject(response);
>
>
> if (jsonObject.has("response")) {
> if