[android-developers] Stop receiving notification to specific program in my mobile android code

2016-06-14 Thread abeer . shlby
Suppose i work in my mobile and I need to stop any notification come from 
gmail or Facebook or any other app from receiving in my mobile
How to hide notification or not receive in my mobile by using code
I try to search in google but not get any result
what idea and what is code

-- 
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/2d484d00-6478-49cb-89b7-b316051c7a25%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] Null Pointer Exception In Method Boolean.Org.Json.Jsonobject Do in background async task

2016-06-22 Thread abeer . shlby
I designed app to make order for pizza food restaurant
I show userid,menu id ,address,longtiude,latitude then press on button make 
order
Error show after I press button and found in async task doin background
It give me fatal exception error 
An error occurred while executing doInBackground()
and it show to me two lines have proplem
AddNewOrder.doInBackground(Summary.java:113)
AddNewOrder.doInBackground(Summary.java:77)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 
'boolean org.json.JSONObject.getBoolean(java.lang.String)' on a null object 
reference
package com.pizza_final_project_app.pizza_final_project;

import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

public class Summary extends Activity {
SharedPreferences preferences;
private ProgressDialog pDialog;
//JSONParser jsonParser = new JSONParser();
boolean errorFound;
TextView textaddress;
TextView textlongtiude;
TextView textlatitude;
TextView text2;
TextView textuser;
Button btnorder;
private static final String TAG_SUCCESS = "success";
private static final String TAG = Summary.class.getSimpleName();

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_summary);
text2=(TextView)findViewById(R.id.textView3);
textaddress=(TextView)findViewById(R.id.textaddress);
textuser=(TextView)findViewById(R.id.textView4);
textlongtiude=(TextView)findViewById(R.id.textlongtiude);
textlatitude=(TextView)findViewById(R.id.textlatitude);
Intent i = getIntent();
String id = i.getStringExtra("Data4");
String address = i.getStringExtra("Data8");
String longtiude = i.getStringExtra("Data9");
String latitude = i.getStringExtra("Data10");
text2.setText(id);
textaddress.setText(address);
textlongtiude.setText(longtiude);
textlatitude.setText(latitude);
preferences= 
PreferenceManager.getDefaultSharedPreferences(getApplicationContext());

String email=preferences.getString("email","");
textuser.setText(email);
pDialog = new ProgressDialog(this);
pDialog.setCancelable(false);
btnorder=(Button)findViewById(R.id.button2);
btnorder.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v)
{
addOrder(textuser.getText().toString().trim(), 
text2.getText().toString().trim(),
textaddress.getText().toString().trim(), 
textlongtiude.getText().toString().trim(),
textlatitude.getText().toString().trim());

}
});


}
//line 77
class AddNewOrder extends AsyncTask {

@Override
protected void onPreExecute() {
super.onPreExecute();
pDialog = new ProgressDialog(Summary.this);
pDialog.setMessage("Making Order...");
pDialog.setIndeterminate(false);
pDialog.setCancelable(true);
pDialog.show();
}

protected String doInBackground(String... args) {
final JSONParser jsonParser = new JSONParser();
// Building Parameters
List params = new ArrayList();
params.add(new BasicNameValuePair("userID", args[0]));
params.add(new BasicNameValuePair("menuID", args[1]));
params.add(new BasicNameValuePair("address", args[2]));
params.add(new BasicNameValuePair("longitude", args[3]));
params.add(new BasicNameValuePair("latitude", args[4]));


JSONObject jObj = jsonParser.makeHttpRequest(AppConfig.URL_Order,
"POST", params);

try {
//Line 113
boolean error = jObj.getBoolean("error"); 
if (!error) {

errorFound=false;
} else {
errorFound=true;

}
} catch (JSONException e) {
e.printStackTrace();
}

return null;
}
protected void onPostExecute(String file_url) {
if (pDialog.isShowing()) {
pDialog.dismiss();
if (!errorFound){
Toast.makeText(getApplicationContext(), "User successfully registered. Try 
login now!", Toast.LENGTH_LONG).show();


Intent intent = new Intent(
Summary.this,
FinalResult.class);
startActivity(intent);
finish();
}
else{
Toast.makeText(getApplicationContext(), "An Error occoured!", 
Toast.LENGTH_LONG).show();

}
}
}

}
*/
private void addOrder(final String userID, final String menuID, final 
String address,
final String longitude, final String latitude) {

new AddNewOrder().execute(userID, menuID, address, longitude, latitude);

}

}



Class AppConfig
package com.pizza_final_project_app.pizza_final_project;

public class AppConfig {

public static String URL_Order = "
http://amit-learning.com/myPizza/Api_v2.php?functi... 
";

json parser
package com.pizza_final_project_app.pizza_final_project;

import android.util.Log;

imp

[android-developers] Re: Null Pointer Exception In Method Boolean.Org.Json.Jsonobject Do in background async task

2016-06-25 Thread Abeer Shlby

>
> I get this error End of input at character 0 of 
> after i run code below as you mention before
>
 try {
jObj = new JSONObject(json);
} catch (JSONException e) {
Log.e("JSON Parser", "Error parsing data " + e.toString());
}

-- 
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/630cb522-4892-44b8-8aab-8aa008a9170f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] How to call QR CODE reader from my app in android

2016-05-16 Thread abeer . shlby

--
I need to create button scan QR this button will call qr reader program to 
check image and then retrieve message as url to web activity page
when i press in button
it will search for qr reader is installed in my mobile or not
IF qr reader installed in my mobile
open camera and check the image and then send the result 
to web page activity as URL
IF qr reader not installed open google play to search and install in it
How i do that by code please help me
*What i need actually by code*
call program QR reader from my app
IF it is installed in my mobile
check image as this link 
HTTP://WWW-code-generator.com/ 
and send result words to web activity page as URL
IF it is not installed
go to google play to install it
can you help me in that by code

-- 
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/6fd9d44e-f851-4e60-a08a-9cff1ae50210%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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

2016-06-04 Thread abeer . shlby
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 + "&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) 
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 (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.get

[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 + 
> "&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) 
> 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 (jsonObject.getJSONObject

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.