<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic how to fix error “Cannot call this method in this context when use query.setMaxFeatures(20); in ArcGIS Runtime SDK for Android Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/how-to-fix-error-cannot-call-this-method-in-this/m-p/517632#M3530</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if i use "query.setMaxFeatures(&lt;SPAN style="color: #0000ff;"&gt;20&lt;/SPAN&gt;);" my code show error&amp;nbsp;Cannot call this method in this context&lt;/P&gt;&lt;P&gt;if i not use&amp;nbsp;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;query.setMaxFeatures(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;20&lt;/SPAN&gt;&lt;SPAN&gt;);"&lt;SPAN&gt;&amp;nbsp;working.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;how to select top record by use&amp;nbsp;setMaxFeatures method&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;final &lt;/SPAN&gt;QueryParameters query = &lt;SPAN style="color: #000080; font-weight: bold;"&gt;new &lt;/SPAN&gt;QueryParameters(); &lt;SPAN style="color: #808080;"&gt;// 
&lt;/SPAN&gt;query.setWhereClause(&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"upper(name) LIKE '%" &lt;/SPAN&gt;+ &lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;strSearch&lt;/SPAN&gt;.toUpperCase() + &lt;SPAN style="color: #008000; font-weight: bold;"&gt;"%'"&lt;/SPAN&gt;);
query.setReturnGeometry(&lt;SPAN style="color: #000080; font-weight: bold;"&gt;false&lt;/SPAN&gt;);
query.setMaxFeatures(&lt;SPAN style="color: #0000ff;"&gt;20&lt;/SPAN&gt;);

&lt;SPAN style="color: #000080; font-weight: bold;"&gt;final &lt;/SPAN&gt;ListenableFuture&amp;lt;FeatureQueryResult&amp;gt; future = &lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;ServiceFeature&lt;/SPAN&gt;.queryFeaturesAsync(query, ServiceFeatureTable.QueryFeatureFields.&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;LOAD_ALL&lt;/SPAN&gt;);&lt;SPAN style="color: #808000;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808000;"&gt;    &lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;public void &lt;/SPAN&gt;run() {
        &lt;SPAN style="color: #000080; font-weight: bold;"&gt;try &lt;/SPAN&gt;{
            &lt;SPAN style="color: #000080; font-weight: bold;"&gt;final &lt;/SPAN&gt;FeatureQueryResult result = &lt;SPAN style="color: #660e7a;"&gt;future&lt;/SPAN&gt;.get(); &lt;SPAN style="color: #808080;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;            &lt;/SPAN&gt;Iterator&amp;lt;Feature&amp;gt; iterator = result.iterator();
            &lt;SPAN style="color: #000080; font-weight: bold;"&gt;int &lt;/SPAN&gt;count = &lt;SPAN style="color: #0000ff;"&gt;0&lt;/SPAN&gt;;
            ...
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;...

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 22:34:38 GMT</pubDate>
    <dc:creator>lasinh</dc:creator>
    <dc:date>2021-12-11T22:34:38Z</dc:date>
    <item>
      <title>how to fix error “Cannot call this method in this context when use query.setMaxFeatures(20);</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/how-to-fix-error-cannot-call-this-method-in-this/m-p/517632#M3530</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if i use "query.setMaxFeatures(&lt;SPAN style="color: #0000ff;"&gt;20&lt;/SPAN&gt;);" my code show error&amp;nbsp;Cannot call this method in this context&lt;/P&gt;&lt;P&gt;if i not use&amp;nbsp;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;query.setMaxFeatures(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;20&lt;/SPAN&gt;&lt;SPAN&gt;);"&lt;SPAN&gt;&amp;nbsp;working.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;how to select top record by use&amp;nbsp;setMaxFeatures method&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;final &lt;/SPAN&gt;QueryParameters query = &lt;SPAN style="color: #000080; font-weight: bold;"&gt;new &lt;/SPAN&gt;QueryParameters(); &lt;SPAN style="color: #808080;"&gt;// 
&lt;/SPAN&gt;query.setWhereClause(&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"upper(name) LIKE '%" &lt;/SPAN&gt;+ &lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;strSearch&lt;/SPAN&gt;.toUpperCase() + &lt;SPAN style="color: #008000; font-weight: bold;"&gt;"%'"&lt;/SPAN&gt;);
query.setReturnGeometry(&lt;SPAN style="color: #000080; font-weight: bold;"&gt;false&lt;/SPAN&gt;);
query.setMaxFeatures(&lt;SPAN style="color: #0000ff;"&gt;20&lt;/SPAN&gt;);

&lt;SPAN style="color: #000080; font-weight: bold;"&gt;final &lt;/SPAN&gt;ListenableFuture&amp;lt;FeatureQueryResult&amp;gt; future = &lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;ServiceFeature&lt;/SPAN&gt;.queryFeaturesAsync(query, ServiceFeatureTable.QueryFeatureFields.&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;LOAD_ALL&lt;/SPAN&gt;);&lt;SPAN style="color: #808000;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808000;"&gt;    &lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;public void &lt;/SPAN&gt;run() {
        &lt;SPAN style="color: #000080; font-weight: bold;"&gt;try &lt;/SPAN&gt;{
            &lt;SPAN style="color: #000080; font-weight: bold;"&gt;final &lt;/SPAN&gt;FeatureQueryResult result = &lt;SPAN style="color: #660e7a;"&gt;future&lt;/SPAN&gt;.get(); &lt;SPAN style="color: #808080;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;            &lt;/SPAN&gt;Iterator&amp;lt;Feature&amp;gt; iterator = result.iterator();
            &lt;SPAN style="color: #000080; font-weight: bold;"&gt;int &lt;/SPAN&gt;count = &lt;SPAN style="color: #0000ff;"&gt;0&lt;/SPAN&gt;;
            ...
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;...

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:34:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/how-to-fix-error-cannot-call-this-method-in-this/m-p/517632#M3530</guid>
      <dc:creator>lasinh</dc:creator>
      <dc:date>2021-12-11T22:34:38Z</dc:date>
    </item>
  </channel>
</rss>

