|
I'm looking for a good, active Android discussion forum. I've been posting questions to Stack Overflow but traffic for Android is a lot slower there than, say, for Windows programming so many of my questions get no response. (e.g., )[This question about advancing the Month in CalendarView)]
This forum on codeproject only seems to average less than 1 new question a day. Android is such a dominant platform with so many developers, where do they all hang out?
NB that the Google+ "Android Developers" forum suggested in the Google documentation is very low traffic probably because it's swamped by spam and totally unmoderated (the have a moderator but he hasn't been there in a long time).
modified 10-Jun-16 12:34pm.
|
|
|
|
|
Most people hang out here because they think CodeProject is a great place, so they tend not to care too much about what other forums exist. If you want to research alternatives then Google is the tool of choice.
Or, you could just post a proper question.
|
|
|
|
|
A Google search is how I found this. So far, using Google, I haven't found much else but given how many apps are written for Android, they must be somewhere.
I included a link to my post on Stack Overflow in my question but since it's already been viewed there 21 times in the last 20 hours with no answers, and this is a lower-traffic forum, I wasn't optimistic about posting it here. But at your suggestion I'll try it.
|
|
|
|
|
Stackoverflow has a decent level of response for issues with code. For general assistance on Android - I personally use the Google+ communities feature as this is where the Google Android devs and experts appear to be most active. Some specific technologies are more organised and have a slack channel (e.g. firebase), but I have not found one better than Google+.
|
|
|
|
|
I have app in side 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<foursquarevenue> venuesList;
final String CLIENT_ID = "SVIBXYYXOEARXHDI4FWAHXGO5ZXOY204TCF1QJFXQLY5FPV4";
final String CLIENT_SECRET = "BAAJO1KXRWESGTJJGVON4W3WUFHAQDAJPLRIYJJ5OPHFQ5VI";
final String latitude = "30.435665153239377";
final String longtitude = "31.3280148";
ArrayAdapter <string> myAdapter;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
new fourquare().execute();
}
private class fourquare extends AsyncTask<view, void,="" string=""> {
String temp;
@Override
protected String doInBackground(View... urls) {
temp = makeCall("https://api.foursquare.com/v2/venues/search?client_id=" + CLIENT_ID + "&client_secret=" + CLIENT_SECRET + "&v=20130815&ll=30.435665153239377,31.144435908398464" + "&query=resturant");
return "";
}
@Override
protected void onPreExecute() {
}
@Override
protected void onPostExecute(String result) {
if (temp == null) {
} else {
venuesList = (ArrayList<foursquarevenue>) parseFoursquare(temp);
List<string> listTitle = new ArrayList<string>();
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<string>(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<foursquarevenue> parseFoursquare(final String response) {
ArrayList<foursquarevenue> temp = new ArrayList<foursquarevenue>();
try {
JSONObject jsonObject = new JSONObject(response);
if (jsonObject.has("response")) {
if (jsonObject.getJSONObject("response").has("venues")) {
JSONArray jsonArray = jsonObject.getJSONObject("response").getJSONArray("venues");
for (int i = 0; i < jsonArray.length(); i++) {
FoursquareVenue poi = new FoursquareVenue();
if (jsonArray.getJSONObject(i).has("name")) {
poi.setName(jsonArray.getJSONObject(i).getString("name"));
if (jsonArray.getJSONObject(i).has("location")) {
if (jsonArray.getJSONObject(i).getJSONObject("location").has("address")) {
if (jsonArray.getJSONObject(i).getJSONObject("location").has("city")) {
poi.setCity(jsonArray.getJSONObject(i).getJSONObject("location").getString("city"));
}
if (jsonArray.getJSONObject(i).has("categories")) {
if (jsonArray.getJSONObject(i).getJSONArray("categories").length() > 0) {
if (jsonArray.getJSONObject(i).getJSONArray("categories").getJSONObject(0).has("icon")) {
poi.setCategory(jsonArray.getJSONObject(i).getJSONArray("categories").getJSONObject(0).getString("name"));
}
}
}
temp.add(poi);
}
}
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
return new ArrayList<foursquarevenue>();
}
return temp;
}
}
|
|
|
|
|
ahmed_sa wrote: 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 Read the JSON file once into a container of some sort. When responding to a button click, read next item from container and add to listview's adapter.
ahmed_sa wrote: and code is working success So what's the problem?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
so that How to customize or modify this code to
Read the JSON file once into a container of some sort.by code
|
|
|
|
|
I already suggested this in your question below, including the sort of container you might consider to hold the JSON data.
|
|
|
|
|
Who can help me in customize that
please tell me site or forum
i will try to ask him
|
|
|
|
|
|
Are you a developer?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Yes but im beginner for development in android
|
|
|
|
|
But creating, or using, a container (i.e., data structure) to hold data that you download from a JSON file has nothing to do with Android.
If the code you've shown is entirely of your making, then you shouldn't be having trouble.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
I modify my code above as following
I storage the parsed ArrayList, make a global variable for counting the number of times that the button has been clicked.
public class MainActivity extends ListActivity {
ArrayList<foursquarevenue> venuesList;
Button btn;
int clickCount;
// ArrayList<foursquarevenue> allResults;
List<string> shownResults = new ArrayList<string>();
final String CLIENT_ID = "SVIBXYYXOEARXHDI4FWAHXGO5ZXOY204TCF1QJFXQLY5FPV4";
final String CLIENT_SECRET = "BAAJO1KXRWESGTJJGVON4W3WUFHAQDAJPLRIYJJ5OPHFQ5VI";
final String latitude = "30.435665153239377";
final String longtitude = "31.3280148";
ArrayAdapter <string> 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();
new fourquare().execute();
}
});
}
what is wrong in my code
|
|
|
|
|
ahmed_sa wrote:
what is wrong in my code I don't know, you tell us. What's it (not) doing? What's is (not) supposed to do? Is an exception being thrown? I obviously can't know these things.
I do know you don't need to call notifyDataSetChanged() since neither the array nor the adapter are changing in the onClick() method.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Why my android is not connecting with the
mobile phone..???
when m run my programme it dont show
in the cell phone
|
|
|
|
|
Could be any of a hundred different reasons. Good luck.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
HI all.I am new beginer to android.I Want to write an android app.
WHat do I Need now.I Have read some books but may be it is out of date so I ask here.
First I need to install Java JDK to my PC.
Second I need Android Studio.
Is that all now???
THanks.
|
|
|
|
|
hmanhha wrote:
First I need to install Java JDK to my PC.
Second I need Android Studio. Both of which can be done from here.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
|
Yes.After installing android studio, you need to install the required sdk pacakages for which version you want your android app to run.
|
|
|
|
|
Hi
I make one app have only one activity is main activity and it have
button
textview
linear layout
the json file i connect to it is
public static String URL_GET_Place = "https://api.foursquare.com/v2/venues/search?client_id=SVIBXYYXOEARXHDI4FWAHXGO5ZXOY204TCF1QJFXQLY5FPV4&client_secret=BAAJO1KXRWESGTJJGVON4W3WUFHAQDAJPLRIYJJ5OPHFQ5VI&v=20130815&ll=30.1136286,31.3280148&query=resturant";
what i need is get all items from this file item by item
based on three atributes and every click get next item
name,id,location
when i press the fab button to first time get first item
when i press the fab button to second time get second item
when i press the fab button to third time get third item
when i press the fab button to four time get four item
until i get all items in json file based on three attributs id,name,location
How i make that by code if possible help me
|
|
|
|
|
ahmed_sa wrote: How i make that by code if possible help me Exactly what do you need help with, processing the file, responding to button clicks, populating a listview? What code have you put together so far? What is it (not) doing?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
My code is
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_eating);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
card1 = (LinearLayout) findViewById(R.id.card_one);
card2 = (LinearLayout) findViewById(R.id.card_two);
card3 = (LinearLayout) findViewById(R.id.card_three);
tvTitle1 = (TextView) findViewById(R.id.tv_title1);
tvTitle2 = (TextView) findViewById(R.id.tv_title2);
tvTitle3 = (TextView) findViewById(R.id.tv_title3);
tvDetails1 = (TextView) findViewById(R.id.tv_details1);
tvDetails2 = (TextView) findViewById(R.id.tv_details2);
tvDetails3 = (TextView) findViewById(R.id.tv_details3);
card1.setonclickListener(this);
card2.setonclickListener(this);
card3.setonclickListener(this);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setonclickListener(new View.onclickListener() {
@Override
public void onclick(View view) {
if (count < 3) {
new GetPlace().execute();
}
}
});
}
class GetPlace extends AsyncTask<Void, Void, Void> {
@Override
protected void onPreExecute() {
super.onPreExecute();
pDialog = new ProgressDialog(EatingActivity.this);
pDialog.setMessage("Picking an Item...");
pDialog.setIndeterminate(false);
pDialog.setCancelable(true);
}
protected Void doInBackground(Void... args) {
try {
List<NameValuePair> dataList = new ArrayList<NameValuePair>();
JSONObject json = jsonParser.
makeHttpRequest(AppConfig.URL_GET_Place, "GET", dataList);
JSONObject meta = json.getJSONObject("meta");
success = meta.getInt("code");
JSONObject response = json.getJSONObject("response");
JSONArray venues = response.getJSONArray("venues");
for (int i = 0; i < venues.length(); i++) {
selectedPlace = new Place();
JSONObject object = venues.getJSONObject(i);
selectedPlace.setTitle(object.getString("name"));
selectedPlace.setId(object.getString("id"));
JSONObject location = object.getJSONObject("location");
JSONArray formattedAddress=location.getJSONArray("formattedAddress");
Log.d("length",formattedAddress.length()+"");
String currentLocation="";
for (int j=0;j<formattedAddress.length();j++)
{
currentLocation+=formattedAddress.getString(j)+", ";
Log.d("address",currentLocation);
}
selectedPlace.setAddress(currentLocation);
selectedPlace.setLat(location.getDouble("lat"));
selectedPlace.setLng(location.getDouble("lng"));
Log.d("name", selectedPlace.getTitle());
places.add(selectedPlace);
}
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
protected void onPostExecute(Void args) {
if (!pDialog.isShowing()) {
pDialog.dismiss();
if (success == 200) {
if (count == 0) {
card1.setVisibility(View.VISIBLE);
tvTitle1.setText(places.get(count).getTitle());
tvDetails1.setText(places.get(count).getAddress());
} else if (count == 1) {
card2.setVisibility(View.VISIBLE);
tvTitle2.setText(places.get(count).getTitle());
tvDetails2.setText(places.get(count).getAddress());
} else if (count == 2) {
card3.setVisibility(View.VISIBLE);
tvTitle3.setText(places.get(count).getTitle());
tvDetails3.setText(places.get(count).getAddress());
}
count++;
} else {
Toast.makeText(EatingActivity.this, "Couldn't find any nearby places", Toast.LENGTH_LONG).show();
}
}
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home)
finish();
return super.onOptionsItemSelected(item);
}
@Override
public void onclick(View view) {
int index = 0;
if (view.getId() == card1.getId()) {
index = 0;
} else if (view.getId() == card2.getId()) {
index = 1;
} else if (view.getId() == card3.getId()) {
index = 2;
}
String strUri = "http://maps.google.com/maps?q=loc:"
+ places.get(index).getLat() + "," + places.get(index).getLng() +
"(" + places.get(index).getTitle() + ")";
Log.d("url",strUri);
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(strUri));
startActivity(intent);
}
}
|
|
|
|
|
What i need is when click fab button
on first time show first item
on second time click show second item
until it get all items in json file
meaning i need to customize code above
to show all items not three items but based on fab click
every click show item
|
|
|
|