{"id":3252,"date":"2014-03-20T21:07:10","date_gmt":"2014-03-20T21:07:10","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/20\/androidandroid-xmlradial-gradientsshapedrawablerelated-issues-collection-of-common-programming-errors\/"},"modified":"2014-03-20T21:07:10","modified_gmt":"2014-03-20T21:07:10","slug":"androidandroid-xmlradial-gradientsshapedrawablerelated-issues-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/20\/androidandroid-xmlradial-gradientsshapedrawablerelated-issues-collection-of-common-programming-errors\/","title":{"rendered":"android,android-xml,radial-gradients,shapedrawableRelated issues-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/5A12b.jpg?s=32&amp;g=1\" \/><br \/>\nBarbie Smile<br \/>\nandroid<br \/>\nWhen I try to run my App by HTC phone(ver 4.0.4) my App don&#8217;t have any problem, but when I use REGZA (ver 2.2.2) it&#8217;s cannot boot. 10-31 08:54:27.430: I\/ActivityManager(158): Process *package name* (pid 29204) has died. 10-31 08:54:27.440: W\/InputManagerService(158): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@3075bec0 10-31 08:54:27.460: I\/UsageStats(158): Unexpected resume of com.android.settings while already resumed in *package name<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/ece7719349e65af8158e442b518426f3?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nmacman<br \/>\nandroid dropbox fuse distributed-filesystem<br \/>\nI&#8217;m trying to develop a serverless distributed file system for android OS(a feature like Dropbox but serverless). I&#8217;m looking for suggestions on how I approach it. I have seen about FUSE on android but didn&#8217;t get a clear picture on how it would help my cause. I saw an existing system called mobiDFS but didn&#8217;t get any information about it. Please provide me some tutorials,papers or existing solutions to get me started. Thanks.<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/961d292373c8bda31790e8bddd6894cc?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nAlex belek<br \/>\nandroid<br \/>\nhere a full code asyntask to Send Data Httpprivate class MyAsyncTaskPupuk extends AsyncTask&lt;Void,Object ,Void&gt; {boolean bNodata=false; boolean bError=false; @Override protected Void doInBackground(Void&#8230; arg0) {bNodata=false;bError=false;recordCount=cursorSend.getCount();if (recordCount&lt;=0){\/\/bNodata=true;return null;}cursorSend.moveToFirst();publishProgress(0,&#8221;Sending data started&#8221;);\/\/SystemClock.sleep(1000);CHamaRecord rec=new CHamaRecord();for (int i=0; i&lt;recordCount; i++){if (is<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/f0be953cad99dec5a64d09d267c7cf91?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\newlung<br \/>\nandroid<br \/>\nWhen installing an app, I saw this &#8220;Phone Calls&#8221; permission most of the time:PHONE CALLSREAD PHONE STATE AND IDENTITY Allows the application to access the phone features of the device. An application with this permission can determine the phone number and serial number of this phone, whether a call is active, the number that call is connected to and the like.Is this dangerous and can be misused by rogue app?I meant, how far can it be dangerous? Especially about the &#8220;IDENTITY&#8221; part.Note that this<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/ccfb89787606e7adda6cbd1449f91d87?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nSeth Nelson<br \/>\nandroid exception time<br \/>\nI&#8217;m trying to persistently store time data. I write the time to the preferences as a string passing it the time.toString(), and then restore it from the string by using the time.parse(String) method. However, I find that the parse method is throwing a TimeFormatException, specifically:android.util.TimeFormatException: Unexpected character 0x41 at pos=15. Expected ZI use logcat to view the string i am passing to parse, and it looks normal:20110321T021030America\/Detroit(1,79,-14400,1,1300687830)C<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/07123541fba3343f9ddb5876595b99a7?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nAlex<br \/>\nandroid<br \/>\nHi i am usin XML PULL PARSER for parsing my response as the response it too large about 6mb of size. The response contains multiple name tags in it. How can i parse to attain string tags seperately for respective name tags . My response is:&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;ISO-8859-1&#8243; ?&gt; &#8211; &lt;methodResponse&gt; &#8211; &lt;params&gt; &#8211; &lt;param&gt; &#8211; &lt;value&gt; &#8211; &lt;array&gt; &#8211; &lt;data&gt; &#8211; &lt;value&gt;&lt;int&gt;7&lt;\/int&gt; &lt;\/value&gt; &#8211; &lt;value&gt; &#8211; &lt;struct&gt; &#8211; &lt;member&gt;<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/e6e74c64eb462477af2deaf79059d269?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nRobin<br \/>\niphone android html5<br \/>\nHi I have been recently exploring some of the Javascript mobile frameworks that can be used for developing mobile web apps like Sencha, JQTouch, JQuery mobile etc. I know the adv and disadvantages of both.I just need some recent stats which show the market&#8217;s adoption or opinion.<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/7IWb0.jpg?s=32&amp;g=1\" \/><br \/>\nRobert Hahn<br \/>\nandroid file-download out-of-memory<br \/>\nHttpResponse responseGet;try {responseGet = client.execute(get);switch (responseGet.getStatusLine().getStatusCode()) {case 200:File SDCardRoot = Environment.getExternalStorageDirectory();File directory = new File(SDCardRoot+ &#8220;\/OfflineDocuments\/&#8221;+ (document.getPath() == null ? &#8220;&#8221;: (document.getPath() + &#8220;\/&#8221;)));directory.mkdirs();File file = new File(directory, fileName);InputStream is = responseGet.getEntity().getContent();BufferedInputStream bis = new BufferedInputStream(is);ByteArrayBuffer baf =<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/7743702d375943bb561e227e2d2a2532?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nraychenon<br \/>\nandroid inheritance activity composition<br \/>\nThe source of wisdom &#8220;Effective Java 2nd&#8221; says &#8220;Favor composition over inheritance&#8221; (item 16). Now when it comes to Android Activities, it&#8217;s simple to extends from one but you break encapsulation and the code may break when the superclass is modified. I tried to compose . Here is the code of the component Activity:public class SimpleActivity extends Activity{public void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);TextView textview = new TextView(this);textview.setTe<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/9bcf3344f5a3c4e6507d070b982d88f3?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nVenkat<br \/>\nc# android build unity3d<br \/>\nI have developed a sample android application in unity3d.I got one unexpected error while taking build that is Win32Exception .I didn&#8217;t get any idea about this error.So Please find the error message below.Please help me.I suffer from the below error:Win32Exception: ApplicationName=&#8217;python&#8217;, CommandLine=&#8217;Assets\/Kamcord\/Editor\/KamcordAndroidProjectProcessor.pyc &#8220;C:\/Users\/Cube5\/Desktop\/VRecord1.apk&#8221; &#8220;KamcordAndroid&#8221;&#8216;, CurrentDirectory=&#8221; System.Diagnostics.Process.Start_noshell (System.Diagnostics.<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/123c8167c29c918cad205eb5446664da?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJoe Simpson<br \/>\nandroid layout android-xml<br \/>\nI&#8217;m using the AsyncImageView from GreenDroid( https:\/\/github.com\/kennydude\/GreenDroid ) and it has made my view go all strange. It&#8217;s in a TwoLineLayout (or whatever it&#8217;s called), and it&#8217;s showing me some unexpected padding which using the ddms it&#8217;s from the actual AsyncImageView itself and I can&#8217;t figure out why it&#8217;s there, because the image is correctly sized as the corners go on fine.I&#8217;ve tried using all the ScaleTypes and don&#8217;t like how Matrix zooms everything in. Here&#8217;s the XML currently: ht<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/7b01d11a271fb5d9b62efc98656a5d38?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nnikmin<br \/>\nandroid xml-parsing sax android-xml saxparseexception<br \/>\nI have a string that&#8217;s has xml content in it like this:String xml = &#8220;&lt;item_list&gt;&#8221; +&#8221;&lt;category id=&#8217;2&#8242; name=&#8217;categoryName&#8217;&gt;&#8221; +&#8221;&lt;item id=&#8217;41&#8217; name=&#8217;item1&#8242; \/&gt;&#8221; +&#8221;&lt;\/category&gt;&#8221; +&#8221;&lt;\/item_list&gt;)&#8221;;I want to convert this to an Document object. Here my code for doing this:Document doc = null; DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); StringReader sr = new StringReader(xml); InputSource is = ne<\/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\/3f0adaec35ae1dcfb0ba64a94be15de3?s=32&amp;d=identicon&amp;r=PG&amp;f=1\" \/><br \/>\nuser3376774<br \/>\nandroid android-xml android-gridlayout<br \/>\nWhat could be the problem here? I have tried removing the xmlns but it is still giving me an error.&lt;LinearLayout xmlns:android=&#8221;http:\/\/schemas.android.com\/apk\/res\/android&amp;#8221; android:layout_width=&#8221;fill_parent&#8221; android:layout_height=&#8221;fill_parent&#8221; android:orientation=&#8221;vertical&#8221; android:background=&#8221;@color\/white&#8221; &gt; &lt;GridViewandroid:id=&#8221;@+id\/videoGrdVw&#8221;android:numColumns=&#8221;auto_fit&#8221;android:gravity=&#8221;center&#8221;android:columnWidth=&#8221;80dp&#8221;android:stretchMode=&#8221;columnWidth&#8221;android:verticalSpacin<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/Qbpdy.jpg?s=32&amp;g=1\" \/><br \/>\nDragon warrior<br \/>\nandroid android-xml android-theme<br \/>\nI am developing an android application. I want to add a feature to let the user to change the application&#8217;s theme at the runtime.I try to use the following statement in my main activity.setTheme(android.R.style.Theme_Black);However, it merely change the dialog to black background with white text.What can I do to change all the componenets&#8217; theme to Black including the action bar and fragment?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/764f1cef4862ffac48685215afef4d71?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nuser1571299<br \/>\nandroid android-layout android-xml<br \/>\nI have created a UI that requires some font adjustment for small screens. From what I understand, in order to achieve such scaling, I must create a &#8220;diemen.xml&#8221; inside both values-normal and values-small directories. The syntax seems pretty straight forward but what I dont understand is how does Android know where to get the correct values from. Is there a Java code that needs to be added?For an exmaple:android:layout_height=&#8221;@dimen\/textview_height&#8221;How would it know if it&#8217;s normal sized screen<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/0d5066609433192376777b307462c1b3?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nnathan<br \/>\nandroid android-xml shape<br \/>\nI&#8217;d like to create a rectangle shape with two solid colors (horizontally) to achieve something like this:I heard about layer-list, i though i could use it to contains two rectangle with a different color but it seems that it only lays shapes vertically.Is there a way to achieve this using lalyer-list or should i use something totally different? I&#8217;d like to keep it simple with ability to change the shape colors at runtime.Thanks.<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/250ee9b184d487728c80c6766d4dd758?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nDavid_D<br \/>\njava android xml string android-xml<br \/>\nI have a variable settings in this way:String result = &#8221; Non in carica&#8221;; String resultusb = &#8221; No&#8221;;&#8211; &#8211;if (isCharging) {result = &#8221; In carica&#8221;; } if (usbCharge){resultusb = &#8221; Si&#8221;; } The variable result or resultusb assuming two values depending on the situation..there is no TextView only this, Only one variable with more values. I need translate them so i have to put them in the strings.xml.. How can i do it? How can i translate them?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/877a5d3310a923d6bae5518b2e95d385?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nandroverso<br \/>\nandroid xml constants android-xml<br \/>\nI&#8217;m currently programming an android app. There I am stuck with xml-layout. Is it possible to assign a value to an xml-tag using a variable (constant) defined in a class?i have a class called Constants.java for all my program constants. i do this for better maintainability. now i would like to use one of this constants, e.g. VAL as defined below as value for an ui-widged.public class Constants { public static final int VAL = 10; &#8230; }in my case, the widget is a progressbar (horizontal style) and<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/graph.facebook.com\/633641379\/picture?type=large\" \/><br \/>\nshaylh<br \/>\nandroid android-xml radial-gradients shapedrawable<br \/>\nI&#8217;m trying to create a shape drawable with radial gradient background, with radius that will adjust to the screen size (take a look at the relevant documentation).This is my code:&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;utf-8&#8243;?&gt; &lt;shape xmlns:android=&#8221;http:\/\/schemas.android.com\/apk\/res\/android&#8221;android:shape=&#8221;rectangle&#8221; &gt;&lt;gradientandroid:endColor=&#8221;#000&#8243;android:gradientRadius=&#8221;50%p&#8221;android:startColor=&#8221;#5d2456&#8243;android:type=&#8221;radial&#8221; \/&gt; &lt;\/shape&gt;But it doens&#8217;t seem to work. if I remove the<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/graph.facebook.com\/633641379\/picture?type=large\" \/><br \/>\nshaylh<br \/>\nandroid android-xml radial-gradients shapedrawable<br \/>\nI&#8217;m trying to create a shape drawable with radial gradient background, with radius that will adjust to the screen size (take a look at the relevant documentation).This is my code:&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;utf-8&#8243;?&gt; &lt;shape xmlns:android=&#8221;http:\/\/schemas.android.com\/apk\/res\/android&#8221;android:shape=&#8221;rectangle&#8221; &gt;&lt;gradientandroid:endColor=&#8221;#000&#8243;android:gradientRadius=&#8221;50%p&#8221;android:startColor=&#8221;#5d2456&#8243;android:type=&#8221;radial&#8221; \/&gt; &lt;\/shape&gt;But it doens&#8217;t seem to work. if I remove the<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/graph.facebook.com\/633641379\/picture?type=large\" \/><br \/>\nshaylh<br \/>\nandroid android-xml radial-gradients shapedrawable<br \/>\nI&#8217;m trying to create a shape drawable with radial gradient background, with radius that will adjust to the screen size (take a look at the relevant documentation).This is my code:&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;utf-8&#8243;?&gt; &lt;shape xmlns:android=&#8221;http:\/\/schemas.android.com\/apk\/res\/android&#8221;android:shape=&#8221;rectangle&#8221; &gt;&lt;gradientandroid:endColor=&#8221;#000&#8243;android:gradientRadius=&#8221;50%p&#8221;android:startColor=&#8221;#5d2456&#8243;android:type=&#8221;radial&#8221; \/&gt; &lt;\/shape&gt;But it doens&#8217;t seem to work. if I remove the<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/2f0086aee0bbb0aaa6545e8a80969494?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nDixieFlatline<br \/>\nandroid widget remoteview shapedrawable<br \/>\nI receive color for my texview&#8217;s background from my backend. Then i create shapedrawable with rounded corners like this (in my activity):float[] outerR = new float[] { 7, 7, 7, 7, 7, 7, 7, 7 }; ShapeDrawable sd = new ShapeDrawable(new RoundRectShape( outerR, null, null)); sd.getPaint().setColor(Color.parseColor(myObjectFromBackend.getColor())); myTextView.setBackgroundDrawable(sd);Now i want to do this in my widget, but i cant find the right method.The closest one that i found is:row.setInt(R.id<\/li>\n<\/ul>\n<p>Web site is in building<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Barbie Smile android When I try to run my App by HTC phone(ver 4.0.4) my App don&#8217;t have any problem, but when I use REGZA (ver 2.2.2) it&#8217;s cannot boot. 10-31 08:54:27.430: I\/ActivityManager(158): Process *package name* (pid 29204) has died. 10-31 08:54:27.440: W\/InputManagerService(158): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@3075bec0 10-31 08:54:27.460: I\/UsageStats(158): Unexpected [&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-3252","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3252","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=3252"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3252\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3252"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3252"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3252"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}