Android: Unterschied zwischen den Versionen

Aus wiki
Wechseln zu: Navigation, Suche
(Android Button Selector Snippet)
Zeile 46: Zeile 46:
  
 
=== Android Button Selector Snippet ===
 
=== Android Button Selector Snippet ===
  adb uninstall ch.christofbuechi.xyz
+
   
 +
button_sel.xml
 +
 
 +
<shape xmlns:android="http://schemas.android.com/apk/res/android"
 +
      android:shape="rectangle">
 +
    <gradient android:startColor="@color/azulado"
 +
              android:endColor="@color/azulBrillante"
 +
              android:angle="270" />
 +
    <corners android:radius="@dimen/corner_radius" />
 +
    <stroke android:width="2px"
 +
            android:color="@color/blanco" />
 +
</shape>
 +
button_unsel.xml
 +
 
 +
<shape xmlns:android="http://schemas.android.com/apk/res/android"
 +
      android:shape="rectangle">
 +
    <gradient android:startColor="@color/botonesD"
 +
              android:endColor="@color/botones"
 +
              android:angle="270" />
 +
    <corners android:radius="@dimen/corner_radius" />
 +
    <stroke android:width="2px"
 +
            android:color="@color/blanco" />
 +
</shape>

Version vom 29. Juli 2015, 11:51 Uhr

Exclude "TAG" from LogCat (Eclipse-View)

tag:^(?!(TAG))

Uninstall Application from CLI

adb uninstall ch.christofbuechi.xyz

delete just user-data from application

adb shell pm clear ch.christofbuechi.xyz

non-root: extract database from application

adb backup -f /tmp/data.ab -noapk ch.christofbuechi.tuningeventsschweiz (you have to agree on the device itself)
cat /tmp/data.ab | (dd bs=24 count=0 skip=1; cat) | zlib-flate -uncompress > appbackup.tar
tar xvf appbackup.tar
(show files in explorer, database is in "db"-folder)

setBackground for View in onViewCreated

view.setBackgroundColor(view.getContext().getResources().getColor(android.R.color.white ));

Reader to String code

Reader read = response.body().charStream();
int intValueOfChar;
String targetString = "";
while ((intValueOfChar = read.read()) != -1) {
targetString += (char) intValueOfChar;
}
read.close();
Log.d(this.getClass().getName(), targetString);


Let Android Studio fetch the sources with gradle

add:

apply plugin: 'idea'

idea {
   module {
       // if you hate browsing Javadoc
       downloadJavadoc = false

       // and love reading sources :)
       downloadSources = true
   }
}

source: http://gradle.org/docs/current/dsl/org.gradle.plugins.ide.idea.model.IdeaModule.html

Android Button Selector Snippet

button_sel.xml

<shape xmlns:android="http://schemas.android.com/apk/res/android" 
      android:shape="rectangle">
   <gradient android:startColor="@color/azulado" 
             android:endColor="@color/azulBrillante"
             android:angle="270" />
    <corners android:radius="@dimen/corner_radius" />
    <stroke android:width="2px" 
            android:color="@color/blanco" />
</shape>

button_unsel.xml

<shape xmlns:android="http://schemas.android.com/apk/res/android" 
      android:shape="rectangle">
   <gradient android:startColor="@color/botonesD" 
             android:endColor="@color/botones"
             android:angle="270" />
   <corners android:radius="@dimen/corner_radius" />
   <stroke android:width="2px" 
           android:color="@color/blanco" />
</shape>