[android-developers] How to implement Yelp Api inside onPerformSyn

2016-08-07 Thread e-reflex Memory


Could you guys give me a little push here. I'm stuck trying to run the yelp api 
inside the onPerformSyn.

How can I possible do this. I'm getting the error below.

Please help is appreciated. 

 

public class SyncAdapter extends AbstractThreadedSyncAdapter{
public final String LOG_TAG = SyncAdapter.class.getSimpleName();
public static final int SYNC_INTERVAL = 4;//60 * 180;
public static final int SYNC_FLEXTIME = SYNC_INTERVAL/3;
private static final long DAY_IN_MILLIS = 1000;//1000 * 60 * 60 * 24;
private static final int WEATHER_NOTIFICATION_ID = 3004;

private GoogleApiClient mGoogleApiClient;
private YelpAPI yelpAPI;
private Location mLastLocation;

public SyncAdapter(Context context, boolean autoInitialize) {
super(context, autoInitialize);

//YelpAPIFactory apiFactory = new 
YelpAPIFactory(BuildConfig.YELP_CONSUMER_KEY, BuildConfig.YELP_CONSUMER_SECRET, 
BuildConfig.YELP_TOKEN, BuildConfig.YELP_TOKEN_SECRET);
//yelpAPI = apiFactory.createAPI();
}


@Override
public void onPerformSync(Account account, Bundle extras, String authority, 
ContentProviderClient provider, SyncResult syncResult) {


class YelpApi2 extends DefaultApi10a {

@Override
public String getAccessTokenEndpoint() {
return null;
}

@Override
public String getAuthorizationUrl(Token arg0) {
return null;
}

@Override
public String getRequestTokenEndpoint() {
return null;
}

}

class Yelp {
OAuthService service;
Token accessToken;
public Yelp(String consumerKey, String consumerSecret, String 
token, String tokenSecret) {
this.service = new 
ServiceBuilder().provider(YelpApi2.class).apiKey(consumerKey).apiSecret(consumerSecret).build();
this.accessToken = new Token(token, tokenSecret);
}

public String search(String term, double latitude, double 
longitude) {
OAuthRequest request = new OAuthRequest(Verb.GET, 
"http://api.yelp.com/v2/search;);
request.addQuerystringParameter("term", term);
request.addQuerystringParameter("ll", latitude + "," + 
longitude);
this.service.signRequest(this.accessToken, request);
Response response = request.send();
return response.getBody();
}

}



Yelp yelp = new Yelp(BuildConfig.YELP_CONSUMER_KEY, 
BuildConfig.YELP_CONSUMER_SECRET, BuildConfig.YELP_TOKEN, 
BuildConfig.YELP_TOKEN_SECRET);
String response = yelp.search("church", 30.361471, -87.164326);

System.out.println(response);

}



Error I'm getting

=

FATAL EXCEPTION: SyncAdapterThread-1
Process: mem.edu.joshua, PID: 14149
org.scribe.exceptions.OAuthException: Error while creating the Api object
at org.scribe.builder.ServiceBuilder.createApi(ServiceBuilder.java:59)
at org.scribe.builder.ServiceBuilder.provider(ServiceBuilder.java:45)
at mem.edu.joshua.sync.SyncAdapter$1Yelp.(SyncAdapter.java:99)
at mem.edu.joshua.sync.SyncAdapter.onPerformSync(SyncAdapter.java:116)
at 
android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:259)

Caused by: java.lang.InstantiationException: can't instantiate class 
mem.edu.joshua.sync.SyncAdapter$1YelpApi2; no empty constructor
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1208)

-- 
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/69d490ab-ce17-4ae9-899f-056b3ad4719d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] Problem to start AVD on Android Studio 2.1 running on Linux Mint

2016-08-07 Thread Tiago Santos de Santana
Hi!

I'm trying develop some apps in Android Studio 2.1, but I've got a problem 
to start the AVD to test my application.

I'm running the Adroid Stuido on Linux Mint. When I start the AVD, the 
prompt is opened but this just stay in load screen: 



Below, there are some logs about the AVD that I get on the Android Studio:

Run Tab:

/home/windxlum/Android/Sdk/tools/emulator -netdelay none -netspeed full 
-avd Nexus_7_2012_API_19
emulator: WARNING: VM heap size set below hardware specified minimum of 96MB
emulator: WARNING: Setting VM heap size to 256MB
console on port 5554, ADB on port 
emulator: ERROR: _factory_client_recv: Invalid format in query 
'list�xE�pH�Ӆ �Tb�� ף��H��H���xE�pH�Ӆ �Tb�� H��H���xE�pH�Ӆ �Tb�H��H���8N�p� 
� ib���$�'
emulator: ERROR: _factory_client_recv: Unknown camera factory query name in 
''

Android Monitor tab:

08-04 23:36:35.673 2677-2677/? E/System: 
**
08-04 23:36:35.673 2677-2677/? E/System:  Failure starting 
system services
java.lang.RuntimeException: There must be one required installer
at 
com.android.server.pm.PackageManagerService.getRequiredInstallerLPr(PackageManagerService.java:2421)
at 
com.android.server.pm.PackageManagerService.(PackageManagerService.java:2327)
at 
com.android.server.pm.PackageManagerService.main(PackageManagerService.java:1764)
at 
com.android.server.SystemServer.startBootstrapServices(SystemServer.java:366)
at com.android.server.SystemServer.run(SystemServer.java:268)
at com.android.server.SystemServer.main(SystemServer.java:168)
at java.lang.reflect.Method.invoke(Native Method)
at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
08-04 23:36:35.673 2677-2677/? D/AndroidRuntime: Shutting down VM
08-04 23:36:35.673 2677-2677/? E/AndroidRuntime: *** FATAL EXCEPTION IN 
SYSTEM PROCESS: main
java.lang.RuntimeException: There must be one required installer
at 
com.android.server.pm.PackageManagerService.getRequiredInstallerLPr(PackageManagerService.java:2421)
at 
com.android.server.pm.PackageManagerService.(PackageManagerService.java:2327)
at 
com.android.server.pm.PackageManagerService.main(PackageManagerService.java:1764)
at 
com.android.server.SystemServer.startBootstrapServices(SystemServer.java:366)
at com.android.server.SystemServer.run(SystemServer.java:268)
at com.android.server.SystemServer.main(SystemServer.java:168)
at java.lang.reflect.Method.invoke(Native Method)
at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
08-04 23:36:35.674 2677-2677/? E/AndroidRuntime: Error reporting crash
java.lang.NullPointerException: Attempt to invoke interface method 'void 
android.app.IActivityManager.handleApplicationCrash(android.os.IBinder, 
android.app.ApplicationErrorReport$CrashInfo)' on a null object reference
at 
com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:90)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)

Please, could someone help me with this error?

Thank you! 

-- 
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/cfc6632a-9627-4495-accf-f39a49037ead%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] HOTLIST

2016-08-07 Thread Madhu Sudhan
Hi,

Below are the available consultants,

Let me know if you have any requirements,

You can reach me at *630-(923)-6952* or *madhu.usitrecrui...@gmail.com*


*Name*

*Skill*

*Location*

*Relocation*

*D B*

*Sr. SAP BW/BOBJ/HANA Lead **(8 years)*

*PA*

*Open*

*R T*

*Sr. SAP BW BO HANA Lead Consultant (12 years)*

*GA*

*Open*

*N N*

*Sr. SAP HANA/BW/BO/BODS LEAD CONSULTANT (15 years)*

*IL*

*Open*

*T R*

*Sr. SAP SCM APO ERP Program Manager**  (15 years)*

*IL*

*Open*

*V V*

*Sr. Oracle PL/SQL ETL INFORMATICA Developer **(15 years)*

*MD*

*MD, VA, PA, TX*

*G G*

*Sr. ETL QA Tester (8 years)*

*CT*

*CT*

*S V*

*Sr. Tableau Developer (8 years)*

*TX*

*Open*

*R J*

*Sr. SQL Server Lead Developer (14 years)*

*CA*

*Open*

*B S*

*Sr. SAS/SQL Server Developer (10 years)*

*PA*

*Open*

*B G*

*Sr. Business System Data Analyst (8 years)*

*CT*

*CT*

-- 
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/CACBpGyJC7yHF%2B2vsWtZJH5M%2B4VWhivmww5hraTmSgzJLR_rbug%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [android-developers] Java Error

2016-08-07 Thread Steve Gabrilowitz
You have to install the JDK before it will work!

On Aug 7, 2016 11:47 AM, "Matthew F Photo"  wrote:

> Hi,
>
> I just downloaded Android Studio and in the Setup Wizard it says "We
> could not detect a Java Development Kit (JDK) v7 or newer on your system.
> Please browse to its path if known:"
> and then it gives me a link to download a kit from Oracle. When I download
> software from that Java link and point it to there, it doesn't work. Then,
> I took the advice and made an environmental variable pointing towards it
> and it still doesn't work.
> Are there any tips to get me the right software kit so I can use the
> app? I am on Windows 8.1 (in case that helps).
>
> Thanks,
> Matthew
>
> --
> 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/1576f1f3-780e-4c51-abb9-
> 4e2336a681d4%40googlegroups.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/CABfabRhPwNNm2-m49Uj%2BhFP32kMdzp1g%3DM2VEmJvSuyeewGYhQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] Java Error

2016-08-07 Thread Matthew F Photo
Hi,

I just downloaded Android Studio and in the Setup Wizard it says "We 
could not detect a Java Development Kit (JDK) v7 or newer on your system. 
Please browse to its path if known:"
and then it gives me a link to download a kit from Oracle. When I download 
software from that Java link and point it to there, it doesn't work. Then, 
I took the advice and made an environmental variable pointing towards it 
and it still doesn't work. 
Are there any tips to get me the right software kit so I can use the 
app? I am on Windows 8.1 (in case that helps).

Thanks,
Matthew

-- 
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/1576f1f3-780e-4c51-abb9-4e2336a681d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [android-developers] button onClick handler retrieve custom attribute value declared in activity_main.xml

2016-08-07 Thread Steve Gabrilowitz
toString() returns a string representation of an object which is not
necessarily the value of the object.  your view.getTag() returns an object
which is already a String so all you have to do is cast it to string rather
than using toString() on it

String buttStr = (String) view.getTag(); is what you need

On Aug 7, 2016 3:35 AM, "Thomas Fazekas"  wrote:

Dear all,

here is what I want to do : declare a whole bunch of buttons in the
activity_main.xml each of them having one custom tag (in this case it's
called "tag").
All the buttons would share the same onClick handler, where I would use
this custom property value to construct some strings (a URL actually).

Code excerpt :

activity_main.xml










and then in the ActivityMain.java I would use this value :

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}

public void sendLed(View view){
...
String buttStr = view.getTag().toString();
...
}
}

Now , is that in anyway possible ?
The above construct gets me an NPE.

I am aware that I could use a switch statement (to compare the view.getId()
with the individual ids of the buttons) but that seems a lot of comparisons
for nothing (I would use that additional value "blindly", i.e. it doesn't
matter which button has been pressed)

-- 
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/fa4ae215-281e-4fcf-b929-
005b59f2ef2f%40googlegroups.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/CABfabRgeWAZaagA%3DPCZoTDjvp9t8B_U_FxM6e%2Bbn3BgN0VwiQw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] button onClick handler retrieve custom attribute value declared in activity_main.xml

2016-08-07 Thread Thomas Fazekas
Dear all,

here is what I want to do : declare a whole bunch of buttons in the 
activity_main.xml each of them having one custom tag (in this case it's 
called "tag").
All the buttons would share the same onClick handler, where I would use 
this custom property value to construct some strings (a URL actually).

Code excerpt :

activity_main.xml










and then in the ActivityMain.java I would use this value :

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}

public void sendLed(View view){
...
String buttStr = view.getTag().toString();
...
}
}

Now , is that in anyway possible ?
The above construct gets me an NPE.

I am aware that I could use a switch statement (to compare the view.getId() 
with the individual ids of the buttons) but that seems a lot of comparisons 
for nothing (I would use that additional value "blindly", i.e. it doesn't 
matter which button has been pressed) 

-- 
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/fa4ae215-281e-4fcf-b929-005b59f2ef2f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] button onClick handler retrieve custom attribute value declared in activity_main.xml

2016-08-07 Thread Thomas Fazekas
Dear all,

here is what I want to do : declare a whole bunch of buttons in 
the activity_main.xml each of them having one custom tag (in this case it's 
called "tag").
All the buttons would share the same onClick handler, where I would use 
this custom property value to construct some strings (a URL actually).

Code excerpt :

actiity_main.xml













and then in the I would use this value :


public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}

public void sendLed(View view){
...




urlText.setText("http://"+hostText.getText().toString()+":"+portText.getText().toString()+"/"+view.getId());
}
}

-- 
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/85e842f5-c237-46be-b283-35a7bde7c300%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] Multi-locale doesn't work in Android N emulator

2016-08-07 Thread Eric Chiang
>From my experiment in Android N emulator, Locale.getDefault() method always 
get the first preference in user's locale list.
No matter the first preference locale exist in my apps or not ,the result 
always the same.
If the apps do not have resources for the first locale , the app would not 
choose the second one  or others in the locale list but the "default" 
locale!
Not like the website( 
https://developer.android.com/preview/features/multilingual-support.html 
,https://developer.android.com/reference/android/os/LocaleList.html )said:

   *Table 3.* Resource resolution when the app only matches the user's 
   second-preferred locale setting.
   User SettingsApp ResourcesResource Resolution
   1. fr_CH
  2. it_CH
   default (en)
   de_DE
   es_ES
   it_IT
   Try fr_CH => Fail
   Try fr => Fail
   Try children of fr => Fail
   Try it_CH => Fail
   Try it => Fail
   Try children of it => it_IT
   Use it_IT
   
   The user still gets a language they understand, even though the app 
   doesn’t support French.
   

getDefault
Added in API level 24 


LocaleList  
getDefault ()

The result is guaranteed to include the default Locale returned by 
Locale.getDefault(), but not necessarily at the top of the list. The 
default locale not being at the top of the list is an indication that the 
system has set the default locale to one of the user's other preferred 
locales, having concluded that the primary preference is not supported but 
a secondary preference is.

Note that the default LocaleList would change if Locale.setDefault() is 
called. This method takes that into account by always checking the output 
of Locale.getDefault() and recalculating the default LocaleList if needed.


Returns
LocaleList 

May I ask why this happen? Do I need to set any further settings for apps 
to enable multi-locale? Thanks!

Best Regard
Eric Chiang

-- 
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/41770cb4-a7b8-4f66-bf6a-b25905621cd3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.