{"id":2976,"date":"2014-03-13T00:00:07","date_gmt":"2014-03-13T00:00:07","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/13\/androidjmdnsrelated-issues-collection-of-common-programming-errors\/"},"modified":"2014-03-13T00:00:07","modified_gmt":"2014-03-13T00:00:07","slug":"androidjmdnsrelated-issues-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/13\/androidjmdnsrelated-issues-collection-of-common-programming-errors\/","title":{"rendered":"android,jmdnsRelated issues-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/af71f16ab6f9b3ea889fd65429734650?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nBjarke Freund-Hansen<br \/>\nandroid android-source<br \/>\nIf you have downloaded any android source code, you would see a test folder present for almost all applications and base framework.I wanted to know whether we build the test code too while building the sdk from source code, or is it just for our reference.If it is for the latter, what is the best way to use it? Please post me the exact use of tests present in android source code.<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/865fb3b93425441ac256161229c43cc9?s=32&amp;d=identicon&amp;r=PG&amp;f=1\" \/><br \/>\nReallyGoodPie<br \/>\nandroid<br \/>\nHi i basically just started building apps for android, and i have been following some tutorials just to get started, but my apps won&#8217;t run in 4.2. I get the message &#8220;Unfrotunatley, your app has closed&#8230;&#8221;. So i created a android 2.2 emulator, and ran it fine, but in eclipse, it just shows &#8220;x&#8221; next to the 2.2 emulator, yet the 4.2 emulator displays perfectly.How do i get the 2.2 emulator to work on eclipse, i have the SDK and all that, it just won&#8217;t give me the option to run it. It works fine whe<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/c9bfbf0c8cd58684c624b3130e9f6d63?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nmkyong<br \/>\njava android button countdown<br \/>\nQuick question here, I have the following code working for the most part, but I would like for the button to go back to it&#8217;s original state if it is clicked during the countdown. Any suggestions?button.setOnClickListener(new OnClickListener() {@Overridepublic void onClick(View v) {new CountDownTimer(4000, 1000) {@Overridepublic void onFinish() {button.setText(&#8220;SENT&#8221;); }@Overridepublic void onTick(long sec) {button.setText(&#8220;CANCEL (&#8221; + sec \/ 1000 + &#8220;)&#8221;);button.setOnClickListener(n<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/976d0f9652561e49997a445245c65bc6?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nHadi Eskandari<br \/>\nandroid preferences<br \/>\nI have a PreferencesScreen, that has some Preferences and a sub-screen. It looks like this:&lt;PreferenceScreen android:key=&#8221;root&#8221;&gt;&lt;Preference android:key=&#8221;first&#8221; \/&gt;&lt;PreferenceScreen android:key=&#8221;subScreen&#8221; \/&gt;&lt;Preference android:key=&#8221;second&#8221; \/&gt;&lt;Preference android:key=&#8221;third&#8221; \/&gt;&lt;\/PreferenceScreen&gt;&lt;\/PreferenceScreen&gt;When user clicks the subscreen, he is moved to the subscreen view. Now I want to redirect the user to &#8220;root&#8221; preference screen when he clicks on<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/478d1d4a854615cf1c7436755c14a97a?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nMatija Lukic<br \/>\nandroid xml layout<br \/>\nIam developing a HTML5 Android app, and Iam stucked at basic xml layout of Android app. When I run my app in emulator and on my Android smartphone I have unexpected blank space on the right side.http:\/\/i.stack.imgur.com\/c3emH.pngHere is code form activity_main.xml file &lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;utf-8&#8243;?&gt; &lt;LinearLayout xmlns:android=&#8221;http:\/\/schemas.android.com\/apk\/res\/android&#8221; android:orientation=&#8221;vertical&#8221; android:layout_width=&#8221;fill_parent&#8221; android:layout_height=&#8221;fill_parent&#8221; &amp;<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/2c43a46da2e699c6ea7e39ba5fc2b6ed?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nhoss<br \/>\nandroid tree project gradle android-studio<br \/>\nI can&#8217;t seem to find the project files in to the newer version of Android Studio. In the screenshot below you can see that it doesn&#8217;t display the entire project tree. http:\/\/i.stack.imgur.com\/ts172.pngThe solution offered in this post doesn&#8217;t fix my problem.<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/7147138fc22fbd2b9d71611506c93701?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nThinkDo<br \/>\nandroid android-layout android-xml android-studio<br \/>\nAfter doing a lot of research, and not finding anything&#8230; quick question, does anybody has an idea why Android Studio is not taking the Map tag? The code below is a fragment of the maps sample in the SDK. Already added google play services lib and support, but nothing. It&#8217;s showing the errorUnexpected namespace prefix &#8220;map&#8221; found for tag fragment.Thanks a lot in advance!&lt;fragmentxmlns:map=&#8221;http:\/\/schemas.android.com\/apk\/res-auto&#8221;android:id=&#8221;@+id\/map&#8221;android:layout_width=&#8221;match_parent&#8221;androi<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/05eb1a75467975d114393531e800d20c?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nArthur<br \/>\nandroid activity android-manifest android-button<br \/>\nI&#8217;ve built a test app to demonstrate the problem.I have an Android app which has a couple of buttons with semi-transparent gradient background.The problem is &#8211; when the button is pressed, the space under the button turns black (screenshot provided).After a long time of searching for the cause i&#8217;ve found, that the problem is caused by this entry in the AndroidManifest.xml:&lt;supports-screensandroid:anyDensity=&#8221;false&#8221;android:largeScreens=&#8221;true&#8221;android:normalScreens=&#8221;true&#8221;android:resizeable=&#8221;true&#8221;<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/pQqNS.jpg?s=32&amp;g=1\" \/><br \/>\nVituel<br \/>\nandroid webview android-webview android-viewpager pager<br \/>\nMy pager has one webview inside each fragment. The webviews themselves don&#8217;t scroll, i.e. their content fit entirely in them.The problem is the scrolling of the pager doesn&#8217;t behave as expected. The webview content only follows the scrolling when going through the right edge of the screen (i.e. moving out\/in to\/from the right). When a webview is going through the left edge though it&#8217;s content stays still (so that it looks like the next page is sliding over it, like cards).I tried having other co<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/8b1ce1316ac244cd7be19e4e92f2c3f3?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nYanny<br \/>\nandroid xml centering horizontalscrollview<br \/>\nI need create something like this in xml, but it is not possible to center inner object in scrollView with child horizontalScrollView.here is code example:&lt;ScrollViewandroid:id=&#8221;@+id\/scrollView1&#8243;android:layout_width=&#8221;fill_parent&#8221;android:layout_height=&#8221;0dp&#8221;android:layout_weight=&#8221;5&#8243;android:fillViewport=&#8221;true&#8221; &gt;&lt;HorizontalScrollViewandroid:id=&#8221;@+id\/horizontalScrollView1&#8243;android:layout_width=&#8221;fill_parent&#8221;android:layout_height=&#8221;fill_parent&#8221; &gt;&lt;RelativeLayoutandroid:layout_width=&#8221;fill_pa<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/ebcf6ffdb52f7bc6cf56c7554fd35f37?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nHyunwoo Nam<br \/>\nandroid eclipse jmdns<br \/>\nMy code worked but it does not work suddenly. The code is as follows.public class AndroidDnssdDiscoveryTestActivity extends Activity { \/** Called when the activity is first created. *\/android.net.wifi.WifiManager.MulticastLock lock; android.os.Handler handler = new android.os.Handler(); final Context context = this; AlertDialog alert=null;public void onCreate(Bundle savedInstanceState) {\/** StrictMode.ThreadPolicy was introduced since API Level 9 and the default thread policy had been changed si<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/b66c479cd8053b791b5266f29407c817?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nuser268397<br \/>\nandroid jmdns<br \/>\nI&#8217;m trying to list some JmDNS services that I discover in my Android app and whenever I call this method my app crashes in the emulator? I tried commenting out blocks of code and code inside methods and it still crashes on the emulator. Anybody have any ideas? import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/cac178ad32ea3fba1f594303b778010e?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nyorkw<br \/>\njava android jar classpath jmdns<br \/>\nHopefully my issue isn&#8217;t too silly but I&#8217;m having the following problem&#8230;I&#8217;m importing a jar which contains the library JmDNS into my project. My project sets up to handle JmDNS like this&#8230;setUp();try {peer = new PublicPeer(&#8220;Aidan&#8221;,6666,6667,this);} catch (IOException e) {\/\/ TODO Auto-generated catch blocke.printStackTrace();}private void setUp(){android.net.wifi.WifiManager wifi =(android.net.wifi.WifiManager)getSystemService(android.content.Context.WIFI_SERVICE);lock = wifi.createMulticastLo<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/59e365b07967fb19f5da67cb62a24f81?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nmizo<br \/>\nandroid jmdns<br \/>\nFor some reason it doesn&#8217;t like the getInetAddresses() method in the lines:Enumeration additions = (Enumeration) ev.getInfo().getInetAddresses(); if (ev.getInfo().getInetAddresses() != null &amp;&amp; ev.getInfo().getInetAddresses().length &gt; 0) {additions = ev.getInfo().getInetAddresses()[0].getHostAddress(); }import java.io.IOException; import java.net.InetAddress; import java.net.NetworkInterface; import java.util.Enumeration;import javax.jmdns.JmDNS; import javax.jmdns.ServiceEvent; impor<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/a80763a819054a644d6ada112f37a4ad?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nSeva Alekseyev<br \/>\nandroid dependency-management jmdns<br \/>\nI&#8217;ve added jmDNS 3.4.1 to my Android project. Copied the JAR under lib, then under &#8220;Java BuildPath&#8221;\/Libraries added a reference.Now my build fails with the following message in Console:[2012-07-27 22:59:07 &#8211; Yarxi] Dx UNEXPECTED TOP-LEVEL EXCEPTION: java.lang.IllegalArgumentException: already added: Lcom\/strangeberry\/jmdns\/tools\/Browser$1; at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)at com.android.dx.dex.file.DexFile.add(DexFile.java:163)at com.android.dx.command.d<\/li>\n<\/ul>\n<p>Web site is in building<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Bjarke Freund-Hansen android android-source If you have downloaded any android source code, you would see a test folder present for almost all applications and base framework.I wanted to know whether we build the test code too while building the sdk from source code, or is it just for our reference.If it is for the latter, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2976","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2976","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=2976"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2976\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=2976"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=2976"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=2976"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}