tag:blogger.com,1999:blog-44790533001632346852024-02-29T21:40:03.403-08:00Android Tutorialimportant android tutorialAnonymoushttp://www.blogger.com/profile/16161990470673049263noreply@blogger.comBlogger232125tag:blogger.com,1999:blog-4479053300163234685.post-83425898441485107282016-10-18T21:40:00.002-07:002016-10-18T21:40:36.705-07:00Image re-sizer <div dir="ltr" style="text-align: left;" trbidi="on">
<a href="http://www.reduceimages.com/">http://www.reduceimages.com</a><br />
<br />
<a href="http://webresizer.com/resizer/">http://webresizer.com/resizer/</a></div>
Anonymoushttp://www.blogger.com/profile/16161990470673049263noreply@blogger.com1tag:blogger.com,1999:blog-4479053300163234685.post-76246779909905974452016-10-11T22:25:00.006-07:002016-10-11T22:34:01.657-07:00Text curve clockwise and anticlockwise in android<div dir="ltr" style="text-align: left;" trbidi="on">
<pre style="color: #333333; line-height: 16.25px;"><span style="color: #008800; font-weight: bold;">
</span></pre>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfQG-WER8jgAJstYNIBv7xiMz_bAqzJkOtQ8acrbj4dktxLtJpVq1FBoFc2XmBQ6OwSaH9phfwCG2XNUQ1Jdlc6StNp-Zn146KfEDbrPi7wdcNYCa1hWvNfA_UKXZwa-wfF3p4d8OLuOMe/s1600/screen_1.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfQG-WER8jgAJstYNIBv7xiMz_bAqzJkOtQ8acrbj4dktxLtJpVq1FBoFc2XmBQ6OwSaH9phfwCG2XNUQ1Jdlc6StNp-Zn146KfEDbrPi7wdcNYCa1hWvNfA_UKXZwa-wfF3p4d8OLuOMe/s400/screen_1.png" width="225" /></a></div>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidukiF_9fJewT-e7OenQe5ebD1ro8V27MyvspPGvd96p6utJvUagnScSRTRlPHfp4GGZaMgQ7LfyWKfmfjBbzM5Im0S5c60J5gH4AQA5lcPOrZHGoJLnXIjiPBjtXJWUSujz28vEJW6G5d/s1600/screen_2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidukiF_9fJewT-e7OenQe5ebD1ro8V27MyvspPGvd96p6utJvUagnScSRTRlPHfp4GGZaMgQ7LfyWKfmfjBbzM5Im0S5c60J5gH4AQA5lcPOrZHGoJLnXIjiPBjtXJWUSujz28vEJW6G5d/s400/screen_2.png" width="225" /></a><br />
<pre style="color: #333333; line-height: 16.25px;"><span style="color: #008800; font-weight: bold;">
</span></pre>
<pre style="color: #333333; line-height: 16.25px;"><span style="color: #008800; font-weight: bold;">
</span></pre>
<pre style="color: #333333; line-height: 16.25px;"><pre><span style="color: #008800; font-weight: bold;">
import</span> <span style="color: #0e84b5; font-weight: bold;">android.annotation.SuppressLint</span>;
<span style="color: #008800; font-weight: bold;">import</span> <span style="color: #0e84b5; font-weight: bold;">android.app.Activity</span>;
<span style="color: #008800; font-weight: bold;">import</span> <span style="color: #0e84b5; font-weight: bold;">android.content.Context</span>;
<span style="color: #008800; font-weight: bold;">import</span> <span style="color: #0e84b5; font-weight: bold;">android.graphics.Canvas</span>;
<span style="color: #008800; font-weight: bold;">import</span> <span style="color: #0e84b5; font-weight: bold;">android.graphics.Color</span>;
<span style="color: #008800; font-weight: bold;">import</span> <span style="color: #0e84b5; font-weight: bold;">android.graphics.Paint</span>;
<span style="color: #008800; font-weight: bold;">import</span> <span style="color: #0e84b5; font-weight: bold;">android.graphics.Path</span>;
<span style="color: #008800; font-weight: bold;">import</span> <span style="color: #0e84b5; font-weight: bold;">android.graphics.RectF</span>;
<span style="color: #008800; font-weight: bold;">import</span> <span style="color: #0e84b5; font-weight: bold;">android.os.Build</span>;
<span style="color: #008800; font-weight: bold;">import</span> <span style="color: #0e84b5; font-weight: bold;">android.os.Bundle</span>;
<span style="color: #008800; font-weight: bold;">import</span> <span style="color: #0e84b5; font-weight: bold;">android.support.annotation.RequiresApi</span>;
<span style="color: #008800; font-weight: bold;">import</span> <span style="color: #0e84b5; font-weight: bold;">android.util.Log</span>;
<span style="color: #008800; font-weight: bold;">import</span> <span style="color: #0e84b5; font-weight: bold;">android.view.View</span>;
<span style="color: #008800; font-weight: bold;">import</span> <span style="color: #0e84b5; font-weight: bold;">android.widget.LinearLayout</span>;
<span style="color: #008800; font-weight: bold;">import</span> <span style="color: #0e84b5; font-weight: bold;">android.widget.SeekBar</span>;
<span style="color: #008800; font-weight: bold;">import</span> <span style="color: #0e84b5; font-weight: bold;">com.ob.virtualproject.R</span>;
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #008800; font-weight: bold;">class</span> <span style="color: #bb0066; font-weight: bold;">AndroidDrawActivity</span> <span style="color: #008800; font-weight: bold;">extends</span> Activity <span style="color: #008800; font-weight: bold;">implements</span> SeekBar.<span style="color: #0000cc;">OnSeekBarChangeListener</span> {
<span style="color: #888888;">// http://stackoverflow.com/questions/19043452/how-to-alter-the-output-of-android-canvas-drawtextonpath</span>
<span style="color: #008800; font-weight: bold;">private</span> <span style="color: #008800; font-weight: bold;">static</span> <span style="color: #008800; font-weight: bold;">final</span> String TAG = AndroidDrawActivity.<span style="color: #0000cc;">class</span>.<span style="color: #0000cc;">getName</span>();
<span style="color: #333399; font-weight: bold;">int</span> mRadius;
<span style="color: #008800; font-weight: bold;">private</span> LinearLayout llMainFrame;
<span style="color: #008800; font-weight: bold;">private</span> MyView myView;
<span style="color: #008800; font-weight: bold;">private</span> <span style="color: #333399; font-weight: bold;">boolean</span> mIsClock = <span style="color: #008800; font-weight: bold;">true</span>;
<span style="color: #008800; font-weight: bold;">private</span> <span style="color: #333399; font-weight: bold;">int</span> rotation_degree = <span style="color: #0000dd; font-weight: bold;">180</span>;
<span style="color: #555555; font-weight: bold;">@Override</span>
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #333399; font-weight: bold;">void</span> <span style="color: #0066bb; font-weight: bold;">onCreate</span>(Bundle savedInstanceState) {
<span style="color: #008800; font-weight: bold;">super</span>.<span style="color: #0000cc;">onCreate</span>(savedInstanceState);
setContentView(R.<span style="color: #0000cc;">layout</span>.<span style="color: #0000cc;">text_curver_layout</span>);
SeekBar seekBar = (SeekBar) findViewById(R.<span style="color: #0000cc;">id</span>.<span style="color: #0000cc;">seekBar</span>);
seekBar.<span style="color: #0000cc;">setOnSeekBarChangeListener</span>(<span style="color: #008800; font-weight: bold;">this</span>);
mRadius = seekBar.<span style="color: #0000cc;">getProgress</span>();
llMainFrame = (LinearLayout) findViewById(R.<span style="color: #0000cc;">id</span>.<span style="color: #0000cc;">tcl_llMainFrame</span>);
myView = <span style="color: #008800; font-weight: bold;">new</span> MyView(<span style="color: #008800; font-weight: bold;">this</span>);
myView.<span style="color: #0000cc;">setDrawParams</span>();
llMainFrame.<span style="color: #0000cc;">addView</span>(myView);
}
<span style="color: #555555; font-weight: bold;">@SuppressLint</span>(<span style="background-color: #fff0f0;">"LongLogTag"</span>)
<span style="color: #555555; font-weight: bold;">@Override</span>
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #333399; font-weight: bold;">void</span> <span style="color: #0066bb; font-weight: bold;">onProgressChanged</span>(SeekBar seekBar, <span style="color: #333399; font-weight: bold;">int</span> progress, <span style="color: #333399; font-weight: bold;">boolean</span> fromUser) {
Log.<span style="color: #0000cc;">d</span>(TAG, <span style="background-color: #fff0f0;">"onProgressChanged:progress= "</span>+progress);
<span style="color: #888888;">// mRadius = seekBar.getProgress();</span>
mRadius = seekBar.<span style="color: #0000cc;">getProgress</span>() - <span style="color: #0000dd; font-weight: bold;">360</span>;
<span style="color: #008800; font-weight: bold;">if</span>(mRadius<=<span style="color: #0000dd; font-weight: bold;">0</span> && mRadius>=-<span style="color: #0000dd; font-weight: bold;">8</span>){
mRadius = -<span style="color: #0000dd; font-weight: bold;">8</span>;
}
}
<span style="color: #555555; font-weight: bold;">@Override</span>
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #333399; font-weight: bold;">void</span> <span style="color: #0066bb; font-weight: bold;">onStartTrackingTouch</span>(SeekBar seekBar) {
}
<span style="color: #555555; font-weight: bold;">@Override</span>
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #333399; font-weight: bold;">void</span> <span style="color: #0066bb; font-weight: bold;">onStopTrackingTouch</span>(SeekBar seekBar) {
llMainFrame.<span style="color: #0000cc;">removeAllViews</span>();
myView.<span style="color: #0000cc;">setDrawParams</span>();
llMainFrame.<span style="color: #0000cc;">addView</span>(myView);
}
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #008800; font-weight: bold;">class</span> <span style="color: #bb0066; font-weight: bold;">MyView</span> <span style="color: #008800; font-weight: bold;">extends</span> View {
<span style="color: #008800; font-weight: bold;">private</span> <span style="color: #333399; font-weight: bold;">int</span> left;
<span style="color: #008800; font-weight: bold;">private</span> <span style="color: #333399; font-weight: bold;">int</span> top;
<span style="color: #008800; font-weight: bold;">private</span> <span style="color: #333399; font-weight: bold;">int</span> right;
<span style="color: #008800; font-weight: bold;">private</span> <span style="color: #333399; font-weight: bold;">int</span> bottom;
<span style="color: #008800; font-weight: bold;">private</span> RectF oval;
<span style="color: #008800; font-weight: bold;">private</span> Path mArc;
<span style="color: #008800; font-weight: bold;">private</span> Paint mPaintText;
<span style="color: #888888;">// private String message ="Hemant Vitthalbhai Patel Android Developer at Office beacon, Vadodara";</span>
<span style="color: #008800; font-weight: bold;">private</span> String message =<span style="background-color: #fff0f0;">"Hemant Vitthalbhai Patel Android "</span>;
<span style="color: #008800; font-weight: bold;">private</span> Path textPath;
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #0066bb; font-weight: bold;">MyView</span>(Context context) {
<span style="color: #008800; font-weight: bold;">super</span>(context);
}
<span style="color: #008800; font-weight: bold;">public</span> <span style="color: #333399; font-weight: bold;">void</span> <span style="color: #0066bb; font-weight: bold;">setDrawParams</span>(){
Log.<span style="color: #0000cc;">d</span>(TAG, <span style="background-color: #fff0f0;">"mRadius: "</span>+ mRadius);
Log.<span style="color: #0000cc;">d</span>(TAG, <span style="background-color: #fff0f0;">"right: "</span>+right);
Log.<span style="color: #0000cc;">d</span>(TAG, <span style="background-color: #fff0f0;">"bottom: "</span>+bottom);
mPaintText = <span style="color: #008800; font-weight: bold;">new</span> Paint(Paint.<span style="color: #0000cc;">ANTI_ALIAS_FLAG</span>);
mPaintText.<span style="color: #0000cc;">setStyle</span>(Paint.<span style="color: #0000cc;">Style</span>.<span style="color: #0000cc;">FILL_AND_STROKE</span>);
mPaintText.<span style="color: #0000cc;">setColor</span>(Color.<span style="color: #0000cc;">RED</span>);
mPaintText.<span style="color: #0000cc;">setTextSize</span>(<span style="color: #0000dd; font-weight: bold;">50</span>f);
}
<span style="color: #555555; font-weight: bold;">@RequiresApi</span>(api = Build.<span style="color: #0000cc;">VERSION_CODES</span>.<span style="color: #0000cc;">LOLLIPOP</span>)
<span style="color: #555555; font-weight: bold;">@Override</span>
<span style="color: #008800; font-weight: bold;">protected</span> <span style="color: #333399; font-weight: bold;">void</span> <span style="color: #0066bb; font-weight: bold;">onDraw</span>(Canvas canvas) {
<span style="color: #008800; font-weight: bold;">super</span>.<span style="color: #0000cc;">onDraw</span>(canvas);
textPath = <span style="color: #008800; font-weight: bold;">new</span> Path();
Paint tmpPaint = <span style="color: #008800; font-weight: bold;">new</span> Paint();
Paint tmpStrokePaint = <span style="color: #008800; font-weight: bold;">new</span> Paint();
<span style="color: #333399; font-weight: bold;">int</span> offsetX = <span style="color: #0000dd; font-weight: bold;">0</span>;
<span style="color: #333399; font-weight: bold;">int</span> offsetY = <span style="color: #0000dd; font-weight: bold;">0</span>;
<span style="color: #333399; font-weight: bold;">int</span> x = offsetX;
<span style="color: #333399; font-weight: bold;">int</span> y = offsetY;
String t;
<span style="color: #333399; font-weight: bold;">float</span> kerning = <span style="color: #6600ee; font-weight: bold;">1.0f</span>;
<span style="color: #333399; font-weight: bold;">float</span> scale = <span style="color: #6600ee; font-weight: bold;">1.0f</span>;
<span style="color: #333399; font-weight: bold;">float</span> kerningValue;
<span style="color: #333399; font-weight: bold;">int</span> textOffsetX = x;
<span style="color: #333399; font-weight: bold;">int</span> textOffsetY = y;
<span style="color: #333399; font-weight: bold;">float</span> innerOffsetX = <span style="color: #6600ee; font-weight: bold;">0.0f</span>;
<span style="color: #333399; font-weight: bold;">float</span> innerOffsetY = <span style="color: #6600ee; font-weight: bold;">0.0f</span>;
<span style="color: #333399; font-weight: bold;">float</span> totalWidth = ((<span style="color: #333399; font-weight: bold;">float</span>) getWidth()) * scale;
tmpPaint.<span style="color: #0000cc;">setAntiAlias</span>(<span style="color: #008800; font-weight: bold;">true</span>);
tmpPaint.<span style="color: #0000cc;">setColor</span>(Color.<span style="color: #0000cc;">BLACK</span>);
tmpPaint.<span style="color: #0000cc;">setTextSize</span>(<span style="color: #0000dd; font-weight: bold;">50</span> * scale);
tmpPaint.<span style="color: #0000cc;">setStyle</span>(Paint.<span style="color: #0000cc;">Style</span>.<span style="color: #0000cc;">FILL</span>);
tmpPaint.<span style="color: #0000cc;">setShader</span>(<span style="color: #008800; font-weight: bold;">null</span>);
tmpStrokePaint.<span style="color: #0000cc;">setAntiAlias</span>(<span style="color: #008800; font-weight: bold;">true</span>);
tmpStrokePaint.<span style="color: #0000cc;">setTextSize</span>(tmpPaint.<span style="color: #0000cc;">getTextSize</span>());
tmpStrokePaint.<span style="color: #0000cc;">setTypeface</span>(tmpPaint.<span style="color: #0000cc;">getTypeface</span>());
tmpStrokePaint.<span style="color: #0000cc;">setTextAlign</span>(tmpPaint.<span style="color: #0000cc;">getTextAlign</span>());
tmpStrokePaint.<span style="color: #0000cc;">setColor</span>(Color.<span style="color: #0000cc;">RED</span>);
tmpStrokePaint.<span style="color: #0000cc;">setStrokeWidth</span>(<span style="color: #0000dd; font-weight: bold;">2</span> * scale);
<span style="color: #333399; font-weight: bold;">int</span> startAngle;
t = message.<span style="color: #0000cc;">replace</span>(<span style="background-color: #fff0f0;">"\n"</span>, <span style="background-color: #fff0f0;">" "</span>);
<span style="color: #333399; font-weight: bold;">int</span> aCurvingAngle = mRadius + <span style="color: #0000dd; font-weight: bold;">6</span>;
<span style="color: #008800; font-weight: bold;">if</span> (mRadius >= <span style="color: #0000dd; font-weight: bold;">360</span>) {
aCurvingAngle = <span style="color: #0000dd; font-weight: bold;">359</span>;
} <span style="color: #008800; font-weight: bold;">else</span> <span style="color: #008800; font-weight: bold;">if</span> (mRadius <= -<span style="color: #0000dd; font-weight: bold;">360</span>) {
aCurvingAngle = -<span style="color: #0000dd; font-weight: bold;">359</span>;
}
kerningValue = <span style="color: #6600ee; font-weight: bold;">0.0f</span>;
<span style="color: #008800; font-weight: bold;">if</span> (kerning != <span style="color: #6600ee; font-weight: bold;">0.0f</span>) {
kerningValue = ((kerning * <span style="color: #6600ee; font-weight: bold;">20.0f</span>) * scale) / ((<span style="color: #333399; font-weight: bold;">float</span>) (t.<span style="color: #0000cc;">length</span>() - <span style="color: #0000dd; font-weight: bold;">1</span>));
}
<span style="color: #333399; font-weight: bold;">float</span> hOffset = <span style="color: #6600ee; font-weight: bold;">0.0f</span>;
<span style="color: #333399; font-weight: bold;">float</span> lineWidth = tmpPaint.<span style="color: #0000cc;">measureText</span>(t) + (((<span style="color: #333399; font-weight: bold;">float</span>) (t.<span style="color: #0000cc;">length</span>() - <span style="color: #0000dd; font-weight: bold;">1</span>)) * kerningValue);
<span style="color: #008800; font-weight: bold;">if</span> (tmpStrokePaint.<span style="color: #0000cc;">getStrokeWidth</span>() > <span style="color: #6600ee; font-weight: bold;">0.0f</span>) {
lineWidth += tmpStrokePaint.<span style="color: #0000cc;">getStrokeWidth</span>() * <span style="color: #6600ee; font-weight: bold;">2.0f</span>;
hOffset = <span style="color: #6600ee; font-weight: bold;">0.0f</span> + tmpStrokePaint.<span style="color: #0000cc;">getStrokeWidth</span>();
}
<span style="color: #333399; font-weight: bold;">float</span> diameter = (<span style="color: #333399; font-weight: bold;">float</span>) (((<span style="color: #333399; font-weight: bold;">double</span>) ((<span style="color: #6600ee; font-weight: bold;">360.0f</span> * lineWidth) / ((<span style="color: #333399; font-weight: bold;">float</span>) Math.<span style="color: #0000cc;">abs</span>(aCurvingAngle)))) / <span style="color: #6600ee; font-weight: bold;">3.141592653589793d</span>);
textOffsetX = offsetX;
textOffsetY = offsetY;
<span style="color: #333399; font-weight: bold;">int</span> baseWidth = <span style="color: #0000dd; font-weight: bold;">1</span>;
<span style="color: #333399; font-weight: bold;">int</span> baseHeight = <span style="color: #0000dd; font-weight: bold;">1</span>;
innerOffsetX = (((<span style="color: #333399; font-weight: bold;">float</span>) (getWidth() - baseWidth)) * <span style="color: #6600ee; font-weight: bold;">0.5f</span>) * scale;
innerOffsetY = (((<span style="color: #333399; font-weight: bold;">float</span>) (getHeight() - baseHeight)) * <span style="color: #6600ee; font-weight: bold;">0.5f</span>) * scale;
textOffsetX += (<span style="color: #333399; font-weight: bold;">int</span>) innerOffsetX;
textOffsetY += (<span style="color: #333399; font-weight: bold;">int</span>) innerOffsetY;
<span style="color: #333399; font-weight: bold;">float</span> left = ((<span style="color: #333399; font-weight: bold;">float</span>) textOffsetX) + (((totalWidth - (<span style="color: #6600ee; font-weight: bold;">2.0f</span> * innerOffsetX)) - diameter) / <span style="color: #6600ee; font-weight: bold;">2.0f</span>);
<span style="color: #333399; font-weight: bold;">float</span> top = (<span style="color: #333399; font-weight: bold;">float</span>) textOffsetY;
<span style="color: #888888;">// aCurvingAngle = aCurvingAngle * (-1); // Reverse curve</span>
<span style="color: #008800; font-weight: bold;">if</span> (aCurvingAngle > <span style="color: #0000dd; font-weight: bold;">0</span>) {
startAngle = <span style="color: #0000dd; font-weight: bold;">270</span>;
} <span style="color: #008800; font-weight: bold;">else</span> {
top += (((((<span style="color: #333399; font-weight: bold;">float</span>) getHeight()) * scale) - (<span style="color: #6600ee; font-weight: bold;">2.0f</span> * innerOffsetY)) - diameter) - <span style="color: #0000dd; font-weight: bold;">10</span>;
<span style="color: #008800; font-weight: bold;">if</span> (tmpStrokePaint.<span style="color: #0000cc;">getStrokeWidth</span>() > <span style="color: #6600ee; font-weight: bold;">0.0f</span>) {
top -= tmpStrokePaint.<span style="color: #0000cc;">getStrokeWidth</span>();
}
startAngle = <span style="color: #0000dd; font-weight: bold;">90</span>;
}
<span style="color: #008800; font-weight: bold;">this</span>.<span style="color: #0000cc;">textPath</span>.<span style="color: #0000cc;">reset</span>();
Paint paint = <span style="color: #008800; font-weight: bold;">new</span> Paint();
paint.<span style="color: #0000cc;">setColor</span>(Color.<span style="color: #0000cc;">YELLOW</span>);
canvas.<span style="color: #0000cc;">drawRect</span>(<span style="color: #008800; font-weight: bold;">new</span> RectF(left, top, left + diameter, top + diameter),paint);
RectF rectf = <span style="color: #008800; font-weight: bold;">new</span> RectF(left, top, left + diameter, top + diameter);
<span style="color: #008800; font-weight: bold;">this</span>.<span style="color: #0000cc;">textPath</span>.<span style="color: #0000cc;">addArc</span>(rectf, (<span style="color: #333399; font-weight: bold;">float</span>) (startAngle - (aCurvingAngle / <span style="color: #0000dd; font-weight: bold;">2</span>)), (<span style="color: #333399; font-weight: bold;">float</span>) aCurvingAngle);
canvas.<span style="color: #0000cc;">drawTextOnPath</span>(t, <span style="color: #008800; font-weight: bold;">this</span>.<span style="color: #0000cc;">textPath</span>, hOffset, <span style="color: #6600ee; font-weight: bold;">0.0f</span>, tmpPaint);
<span style="color: #888888;">/*int j;</span>
<span style="color: #888888;"> for (j = 0; j < t.length(); j++) {</span>
<span style="color: #888888;"> String c = t.substring(j, j + 1);</span>
<span style="color: #888888;"> if (tmpStrokePaint.getStrokeWidth() > 0.0f) {</span>
<span style="color: #888888;"> // canvas.drawTextOnPath(c, this.textPath, hOffset, 0.0f, tmpStrokePaint);</span>
<span style="color: #888888;"> }</span>
<span style="color: #888888;"> canvas.drawTextOnPath(c, this.textPath, hOffset, 0.0f, tmpPaint);</span>
<span style="color: #888888;"> hOffset += tmpPaint.measureText(c, 0, 1) + kerningValue;</span>
<span style="color: #888888;"> }*/</span>
}
}
}</pre>
</pre>
<pre style="color: #333333; line-height: 16.25px;"></pre>
<pre style="color: #333333; line-height: 16.25px;">// Text curve xml file </pre>
<pre style="color: #333333; line-height: 16.25px;"></pre>
<pre style="color: #333333; line-height: 16.25px;"></pre>
<pre style="color: #333333; line-height: 16.25px;"><pre><span style="color: #557799;"><?xml version="1.0" encoding="utf-8"?></span>
<span style="color: #007700;"><LinearLayout</span> <span style="color: #0000cc;">xmlns:android=</span><span style="background-color: #fff0f0;">"http://schemas.android.com/apk/res/android"</span>
<span style="color: #0000cc;">android:orientation=</span><span style="background-color: #fff0f0;">"vertical"</span> <span style="color: #0000cc;">android:layout_width=</span><span style="background-color: #fff0f0;">"match_parent"</span>
<span style="color: #0000cc;">android:layout_height=</span><span style="background-color: #fff0f0;">"match_parent"</span><span style="color: #007700;">></span>
<span style="color: #007700;"><LinearLayout</span>
<span style="color: #0000cc;">android:layout_margin=</span><span style="background-color: #fff0f0;">"20dp"</span>
<span style="color: #0000cc;">android:id=</span><span style="background-color: #fff0f0;">"@+id/tcl_llMainFrame"</span>
<span style="color: #0000cc;">android:layout_width=</span><span style="background-color: #fff0f0;">"match_parent"</span>
<span style="color: #0000cc;">android:layout_height=</span><span style="background-color: #fff0f0;">"400dp"</span>
<span style="color: #0000cc;">android:orientation=</span><span style="background-color: #fff0f0;">"horizontal"</span><span style="color: #007700;">></span>
<span style="color: #007700;"></LinearLayout></span>
<span style="color: #888888;"><!--<Button</span>
<span style="color: #888888;"> android:layout_width="wrap_content"</span>
<span style="color: #888888;"> android:layout_height="wrap_content"</span>
<span style="color: #888888;"> android:onClick="startReverse"</span>
<span style="color: #888888;"> android:text="Reverse"</span>
<span style="color: #888888;"> />--></span>
<span style="color: #007700;"><SeekBar</span>
<span style="color: #0000cc;">android:layout_width=</span><span style="background-color: #fff0f0;">"match_parent"</span>
<span style="color: #0000cc;">android:layout_height=</span><span style="background-color: #fff0f0;">"wrap_content"</span>
<span style="color: #0000cc;">android:id=</span><span style="background-color: #fff0f0;">"@+id/seekBar"</span>
<span style="color: #0000cc;">android:max=</span><span style="background-color: #fff0f0;">"720"</span>
<span style="color: #0000cc;">android:progress=</span><span style="background-color: #fff0f0;">"50"</span>
<span style="color: #0000cc;">android:background=</span><span style="background-color: #fff0f0;">"@color/blue_semi_transparent"</span>
<span style="color: #007700;">/></span>
<span style="color: #007700;"></LinearLayout></span></pre>
</pre>
<pre style="color: #333333; line-height: 16.25px;"></pre>
<pre style="color: #333333; line-height: 16.25px;"></pre>
</div>
Anonymoushttp://www.blogger.com/profile/16161990470673049263noreply@blogger.com3tag:blogger.com,1999:blog-4479053300163234685.post-49179354335155500902016-07-03T21:50:00.000-07:002016-07-03T21:50:36.263-07:00UX Design for Mobile Developers?<div dir="ltr" style="text-align: left;" trbidi="on">
Ux design android app video tutorial.<br />
<a href="https://classroom.udacity.com/courses/ud849/lessons/1613818915/concepts/15818485420923">https://classroom.udacity.com/courses/ud849/lessons/1613818915/concepts/15818485420923</a><br />
<br />
<br /></div>
Anonymoushttp://www.blogger.com/profile/16161990470673049263noreply@blogger.com0tag:blogger.com,1999:blog-4479053300163234685.post-56341323873318628882016-06-30T06:18:00.001-07:002016-07-03T21:48:36.316-07:00Android studio shortcut<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="main-content" role="main" style="box-sizing: border-box;">
<div itemscope="" itemtype="http://schema.org/SoftwareSourceCode" style="box-sizing: border-box;">
<div data-pjax-container="" id="js-repo-pjax-container" style="box-sizing: border-box;">
<div class="container new-discussion-timeline experiment-repo-nav" style="box-sizing: border-box; margin-left: auto; margin-right: auto; width: 980px;">
<div class="repository-content" style="box-sizing: border-box;">
<div class="wiki-wrapper page" id="wiki-wrapper" style="box-sizing: border-box;">
<div class="gh-header" style="box-sizing: border-box;">
<div class="gh-header-show" style="box-sizing: border-box;">
<h1 class="gh-header-title instapaper_title" style="box-sizing: border-box; font-size: 30px; font-weight: normal; line-height: 1.1; margin: 0px 150px 0px 0px; word-wrap: break-word;">
Analyze Stacktrace</h1>
<div class="gh-header-meta" style="border-bottom-color: rgb(238, 238, 238); border-bottom-style: solid; border-bottom-width: 1px; box-sizing: border-box; color: #767676; font-size: 14px; line-height: 20px; margin-top: 6px; padding-bottom: 15px;">
pavlospt edited this page <relative-time datetime="2014-09-22T16:20:31Z" style="box-sizing: border-box;" title="Sep 22, 2014, 9:50 PM GMT+5:30">on Sep 22, 2014</relative-time> · <a class="history" href="https://github.com/pavlospt/Android-Studio-Tips-by-Philippe-Breault/wiki/Analyze-Stacktrace/_history" style="box-sizing: border-box; text-decoration: none;">2 revisions</a></div>
</div>
</div>
<div class="wiki-content" id="wiki-content" style="box-sizing: border-box; clear: both;">
<div class="has-rightbar" style="box-sizing: border-box;">
<br /><div class="wiki-body gollum-markdown-content instapaper_body" id="wiki-body" style="box-sizing: border-box; margin-right: 280px; margin-top: 20px;">
<div class="markdown-body" style="box-sizing: border-box; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; line-height: 1.6; margin: 0px -30px; padding: 0px 30px; word-break: break-word; word-wrap: break-word;">
<div style="box-sizing: border-box; margin-bottom: 16px;">
Additional tip:</div>
<ul style="box-sizing: border-box; margin-bottom: 16px; margin-top: 0px; padding-left: 2em;">
<li style="box-sizing: border-box;">You can also analyze a proguarded stack trace using the "ProGuard Unscramble Plugin"</li>
</ul>
<div style="box-sizing: border-box; margin-bottom: 16px;">
Shortcut : There is no shortcut for this...</div>
<ul style="box-sizing: border-box; margin-bottom: 16px; margin-top: 0px; padding-left: 2em;">
<li style="box-sizing: border-box;">Menu: <span style="box-sizing: border-box; font-weight: bolder;">Analyze → Analyze Stacktrace</span></li>
<li style="box-sizing: border-box;">Find action: <span style="box-sizing: border-box; font-weight: bolder;">analyze stacktrace</span></li>
</ul>
<div style="box-sizing: border-box;">
<img alt="" data-canonical-src="https://lh3.googleusercontent.com/-ud2l1QdHTow/VCAEACCK1bI/AAAAAAAANmY/5a3od9nIm2E/w676-h392/30-analyzestacktrace.gif" src="https://camo.githubusercontent.com/c85ace7958f610a21016c86ac3412cd62f2229d0/68747470733a2f2f6c68332e676f6f676c6575736572636f6e74656e742e636f6d2f2d7564326c31516448546f772f564341454143434b3162492f41414141414141414e6d592f3561336f64396e496d32452f773637362d683339322f33302d616e616c797a65737461636b74726163652e676966" style="background-color: white; border-style: none; box-sizing: content-box; max-width: 100%;" /></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="container site-footer-container" style="box-sizing: border-box; margin-left: auto; margin-right: auto; max-width: 1020px; padding-left: 20px; padding-right: 20px; width: auto;">
<div class="site-footer" role="contentinfo" style="border-top-color: rgb(238, 238, 238); border-top-style: solid; border-top-width: 1px; box-sizing: border-box; margin-top: 40px; padding-bottom: 40px; padding-top: 40px; position: relative;">
<span style="color: #767676; font-family: "helvetica" , "arial" , "nimbussansl" , "liberationsans" , "freesans" , "clean" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol"; font-size: 12px;"><span style="background-color: white; line-height: 16px;">source: </span></span><span style="color: #767676; font-family: "helvetica" , "arial" , "nimbussansl" , "liberationsans" , "freesans" , "clean" , sans-serif , "apple color emoji" , "segoe ui emoji" , "segoe ui symbol";"><span style="font-size: 12px; line-height: 16px;"><a href="https://github.com/pavlospt/Android-Studio-Tips-by-Philippe-Breault/wiki/Analyze-Stacktrace"><span style="background-color: white;"></span>https://github.com/pavlospt/Android-Studio-Tips-by-Philippe-Breault/wiki/Analyze-Stacktrace</a></span></span></div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/16161990470673049263noreply@blogger.com0tag:blogger.com,1999:blog-4479053300163234685.post-43071735668252592792016-06-28T21:02:00.002-07:002016-06-28T21:02:32.291-07:00Tips And Tools For Optimizing Android Apps<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Android devices have a lot of cores, so writing smooth apps is a simple task for anyone, right? Wrong. As everything on Android can be done in a lot of different ways, picking the best option can be tough. If you want to choose the most efficient method, you have to know what’s happening under the hood. Luckily, you don’t have to rely on your feelings or sense of smell, since there’s a lot of tools out there that can help you find bottlenecks by measuring and describing what’s going on. Properly optimized and smooth apps greatly improve the user experience, and also drain less battery.</div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Let’s see some numbers first to consider how important optimization really is. According to a <a href="http://blog.nimbledroid.com/2015/09/03/why-you-should-care-about-app-performance.html" rel="noopener noreferrer" style="border: 0px; box-sizing: border-box; color: #3976cb; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" target="_blank">Nimbledroid post</a>, 86% of users (including me) have uninstalled apps after using them only once due to poor performance. If you’re loading some content, you have less than 11 seconds to show it to the user. Only every third user will give you more time. You might also get a lot of bad reviews on Google Play because of it.</div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<img alt="Build Better Apps: Android Performance Patterns" src="https://assets.toptal.io/uploads/blog/image/92697/toptal-blog-image-1467009710151-d6420655098bd2288784e4fba601f331.png" style="border: 0px; box-sizing: border-box; display: block; margin: 0px auto 7px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" /></div>
<div class="pop_out_box is-full_width is-big" style="background: rgb(250, 250, 250); border: 0px; box-sizing: border-box; color: #505050; float: none; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.3em; line-height: 1.5em; margin: 0px 30px 15px 0px; min-height: 0px; min-width: 0px; overflow: hidden; padding: 1em 1.5em; text-align: center; vertical-align: baseline; width: 864px;">
Testing your users’ patience is a shortcut to uninstallation.</div>
<div class="tweet_this" style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 15px; line-height: 20px; margin: -10px 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; text-align: center; vertical-align: baseline;">
<iframe allowtransparency="true" class="twitter-share-button twitter-share-button-rendered twitter-tweet-button" data-url="https://www.toptal.com/android/android-performance-patterns" frameborder="0" id="twitter-widget-0" scrolling="no" src="https://platform.twitter.com/widgets/tweet_button.b7de008f493a5185d8df1aedd62d77c6.en.html#dnt=false&id=twitter-widget-0&lang=en&original_referer=https%3A%2F%2Fwww.toptal.com%2Fandroid%2Fandroid-performance-tips-tools&size=m&text=Testing%20your%20users%E2%80%99%20patience%20is%20a%20shortcut%20to%20uninstallation.&time=1467171634614&type=share&url=https%3A%2F%2Fwww.toptal.com%2Fandroid%2Fandroid-performance-patterns" style="border-style: initial; border-width: 0px; box-sizing: border-box; height: 20px; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; position: static; vertical-align: baseline; visibility: visible; width: 61px;" title="Twitter Tweet Button"></iframe></div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
The first thing every user notices over and over is the app’s startup time. According to <a href="http://blog.nimbledroid.com/2016/02/17/cold-start-times-of-top-apps.html" rel="noopener noreferrer" style="border: 0px; box-sizing: border-box; color: #3976cb; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" target="_blank">another Nimbledroid post</a>, out of the 100 top apps, 40 start in under 2 seconds, and 70 start in under 3 seconds. So if possible, you should generally display some content as soon as possible and delay the background checks and updates a bit.</div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Always remember, premature optimization is the root of all evil. You should also not waste too much time with micro optimization. You will see the most benefit of optimizing code that runs often. For example, this includes the <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">onDraw()</code> function, which runs every frame, ideally 60 times per second. Drawing is the slowest operation out there, so try redrawing only what you have to. More about this will come later.</div>
<h2 id="performance-tips" style="background-color: white; border: 0px; box-sizing: border-box; color: #3863a0; font-family: 'Proxima Nova', Arial, sans-serif; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Performance Tips</h2>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Enough theory, here is a list of some of the things you should consider if performance matters to you.</div>
<h3 id="string-vs-stringbuilder" style="background-color: white; border: 0px; box-sizing: border-box; color: #3863a0; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.3em; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
1. String vs StringBuilder</h3>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Let’s say that you have a String, and for some reason you want to append more Strings to it 10 thousand times. The code could look something like this.</div>
<pre style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-size: 15px; line-height: 20px; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-java hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">String string = <span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"hello"</span>;
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">for</span> (<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">int</span> i = <span class="hljs-number" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">0</span>; i < <span class="hljs-number" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">10000</span>; i++) {
string += <span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">" world"</span>;
}
</code></pre>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
You can see on the Android Studio Monitors how inefficient some String concatenation can be. There’s tons of Garbage Collections (GC) going on.</div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<img alt="String vs StringBuilder" src="https://assets.toptal.io/uploads/blog/image/92698/toptal-blog-image-1467009787238-3e67c7b77e47a6cd285671735a783915.png" style="border: 0px; box-sizing: border-box; display: block; margin: 0px auto 7px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" /></div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
This operation takes around 8 seconds on my fairly good device, which has Android 5.1.1. The more efficient way of achieving the same goal is using a StringBuilder, like this.</div>
<pre style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-size: 15px; line-height: 20px; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-java hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">StringBuilder sb = <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">new</span> StringBuilder(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"hello"</span>);
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">for</span> (<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">int</span> i = <span class="hljs-number" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">0</span>; i < <span class="hljs-number" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">10000</span>; i++) {
sb.append(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">" world"</span>);
}
String string = sb.toString();
</code></pre>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
On the same device this happens almost instantly, in less than 5ms. The CPU and Memory visualizations are almost totally flat, so you can imagine how big this improvement is. Notice though, that for achieving this difference, we had to append 10 thousand Strings, which you probably don’t do often. So in case you are adding just a couple Strings once, you will not see any improvement. By the way, if you do:</div>
<pre style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-size: 15px; line-height: 20px; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-java hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">String string = <span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"hello"</span> + <span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">" world"</span>;
</code></pre>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
It gets internally converted to a StringBuilder, so it will work just fine.</div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
You might be wondering, why is concatenating Strings the first way so slow? It is caused by the fact that Strings are immutable, so once they are created, they cannot be changed. Even if you think you are changing the value of a String, you are actually creating a new String with the new value. In an example like:</div>
<pre style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-size: 15px; line-height: 20px; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-java hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">String myString = <span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"hello"</span>;
myString += <span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">" world"</span>;
</code></pre>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
What you will get in memory is not 1 String “hello world”, but actually 2 Strings. The String myString will contain “hello world”, as you would expect. However, the original String with the value “hello” is still alive, without any reference to it, waiting to be garbage collected. This is also the reason why you should store passwords in a char array instead of a String. If you store a password as a String, it will stay in the memory in human-readable format until the next GC for an unpredictable length of time. Back to the immutability described above, the String will stay in the memory even if you assign it another value after using it. If you, however, empty the char array after using the password, it will disappear from everywhere.</div>
<h3 id="picking-the-correct-data-type" style="background-color: white; border: 0px; box-sizing: border-box; color: #3863a0; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.3em; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
2. Picking the Correct Data Type</h3>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Before you start writing code, you should decide what data types you will use for your collection. For example, should you use a <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">Vector</code> or an <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">ArrayList</code>? Well, it depends on your usecase. If you need a thread-safe collection, which will allow only one thread at once to work with it, you should pick a <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">Vector</code>, as it is synchronized. In other cases you should probably stick to an <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">ArrayList</code>, unless you really have a specific reason to use vectors.</div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
How about the case when you want a collection with unique objects? Well, you should probably pick a <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">Set</code>. They cannot contain duplicates by design, so you will not have to take care of it yourself. There are multiple types of sets, so pick one that fits your use case. For a simple group of unique items, you can use a <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">HashSet</code>. If you want to preserve the order of items in which they were inserted, pick a <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">LinkedHashSet</code>. A <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">TreeSet</code>sorts items automatically, so you will not have to call any sorting methods on it. It should also sort the items efficiently, without you having to think of sorting algorithms.</div>
<div class="pop_out_box is-full_width is-big" style="background: rgb(250, 250, 250); border: 1px solid rgb(223, 225, 228); box-sizing: border-box; color: #505050; float: none; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.1em; font-style: italic; line-height: 1.5em; margin: 0px 30px 15px 0px; min-height: 0px; min-width: 0px; overflow: hidden; padding: 1em 1.5em; text-align: center; vertical-align: baseline; width: 864px;">
Data dominates. If you've chosen the right data structures and organized things well, the algorithms will almost always be self-evident. Data structures, not algorithms, are central to programming.<br style="box-sizing: border-box;" />— Rob Pike's 5 Rules of Programming</div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Sorting integers or strings is pretty straightforward. However, what if you want to sort a class by some property? Let’s say you are writing a list of meals you eat, and store their names and timestamps. How would you sort the meals by timestamp from the lowest to highest? Luckily, it’s pretty simple. It’s enough to implement the <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">Comparable</code> interface in the <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">Meal</code> class and override the <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">compareTo()</code> function. To sort the meals by lowest timestamp to highest, we could write something like this.</div>
<pre style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-size: 15px; line-height: 20px; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-java hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;"><span class="hljs-annotation" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">@Override</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">int</span> <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">compareTo</span>(Object object) {
Meal meal = (Meal) object;
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">if</span> (<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">this</span>.timestamp < meal.getTimestamp()) {
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> -<span class="hljs-number" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">1</span>;
} <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">else</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">if</span> (<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">this</span>.timestamp > meal.getTimestamp()) {
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> <span class="hljs-number" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">1</span>;
}
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">return</span> <span class="hljs-number" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">0</span>;
}
</code></pre>
<h3 id="location-updates" style="background-color: white; border: 0px; box-sizing: border-box; color: #3863a0; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.3em; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
3. Location Updates</h3>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
There are a lot of apps out there which collect the user’s location. You should use the Google Location Services API for that purpose, which contains a lot of useful functions. There is a <a href="https://www.toptal.com/android/android-developers-guide-to-google-location-services-api" style="border: 0px; box-sizing: border-box; color: #3976cb; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">separate article</a> about using it, so I will not repeat it.</div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
I’d just like to stress some important points from a performance perspective.</div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
First of all, use only the most precise location as you need. For example, if you are doing some weather forecasting, you don’t need the most accurate location. Getting just a very rough area based on the network is faster, and more battery efficient. You can achieve it by setting the priority to <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">LocationRequest.PRIORITY_LOW_POWER</code>.</div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
You can also use a function of <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">LocationRequest</code> called <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">setSmallestDisplacement()</code>. Setting this in meters will cause your app to not be notified about location change if it was smaller than the given value. For example, if you have a map with nearby restaurants around you, and you set the smallest displacement to 20 meters, the app will not be making requests for checking restaurants if the user is just walking around in a room. The requests would be useless, as there wouldn’t be any new nearby restaurant anyway.</div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
The second rule is requesting location updates only as often as you need them. This is quite self explanatory. If you are really building that weather forecast app, you do not need to request the location every few seconds, as you probably don’t have such precise forecasts (contact me if you do). You can use the <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">setInterval()</code> function for setting the required interval in which the device will be updating your app about the location. If multiple apps keep requesting the user’s location, every app will be notified at every new location update, even if you have a higher <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">setInterval()</code> set. To prevent your app from being notified too often, make sure to always set a fastest update interval with <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">setFastestInterval()</code>.</div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
And finally, the third rule is requesting location updates only if you need them. If you are displaying some nearby objects on the map every x seconds and the app goes in background, you do not need to know the new location. There is no reason to update the map if the user cannot see it anyway. Make sure to stop listening for location updates when appropriate, preferably in <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">onPause()</code>. You can then resume the updates in <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">onResume()</code>.</div>
<h3 id="network-requests" style="background-color: white; border: 0px; box-sizing: border-box; color: #3863a0; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.3em; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
4. Network Requests</h3>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
There is a high chance that your app is using the internet for downloading or uploading data. If it is, you have several reasons to pay attention to <a href="https://developer.android.com/training/efficient-downloads/efficient-network-access.html" rel="noopener noreferrer" style="border: 0px; box-sizing: border-box; color: #3976cb; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" target="_blank">handling network requests</a>. One of them is mobile data, which is very limited to a lot of people and you shouldn’t waste it.</div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
The second one is battery. Both WiFi and mobile networks can consume quite a lot of it if they are used too much. Let’s say that you want to download 1 kb. To make a network request, you have to wake up the cellular or WiFi radio, then you can download your data. However, the radio will not fall asleep immediately after the operation. It will stay in a fairly active state for about 20-40 more seconds, depending on your device and carrier.</div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<img alt="Network Requests" src="https://assets.toptal.io/uploads/blog/image/92699/toptal-blog-image-1467011031215-510eb91b7d609ec7b89e7fb569331a53.png" style="border: 0px; box-sizing: border-box; display: block; margin: 0px auto 7px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" /></div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
So, what can you do about it? Batch. To avoid waking up the radio every couple seconds, prefetch things that the user might need in the upcoming minutes. The proper way of batching is highly dynamic depending on your app, but if it is possible, you should download the data the user might need in the next 3-4 minutes. One could also edit the batch parameters based on the user’s internet type, or charging state. For example, if the user is on WiFi while charging, you can prefetch a lot more data than if the user is on mobile internet with low battery. Taking all these variables into account can be a tough thing, which only few people would do. Luckily though, there is GCM Network Manager to the rescue!</div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
GCM Network Manager is a really helpful class with a lot of customizable attributes. You can easily schedule both repeating and one-off tasks. At repeating tasks you can set the lowest, as well as the highest repeat interval. This will allow batching not only your requests, but also requests from other apps. The radio has to be woken up only once per some period, and while it’s up, all apps in the queue download and upload what they are supposed to. This Manager is also aware of the device’s network type and charging state, so you can adjust accordingly. You can find more details and samples in <a href="https://www.bignerdranch.com/blog/optimize-battery-life-with-androids-gcm-network-manager/" rel="noopener noreferrer" style="border: 0px; box-sizing: border-box; color: #3976cb; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" target="_blank">this article</a>, I urge you to check it out. An example task looks like this:</div>
<pre style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-size: 15px; line-height: 20px; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-java hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">Task task = <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">new</span> OneoffTask.Builder()
.setService(CustomService.class)
.setExecutionWindow(<span class="hljs-number" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">0</span>, <span class="hljs-number" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">30</span>)
.setTag(LogService.TAG_TASK_ONEOFF_LOG)
.setUpdateCurrent(<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">false</span>)
.setRequiredNetwork(Task.NETWORK_STATE_CONNECTED)
.setRequiresCharging(<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">false</span>)
.build();
</code></pre>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
By the way, since Android 3.0, if you do a network request on the main thread, you will get a <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">NetworkOnMainThreadException</code>. That will definitely warn you not to do that again.</div>
<h3 id="reflection" style="background-color: white; border: 0px; box-sizing: border-box; color: #3863a0; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.3em; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
5. Reflection</h3>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Reflection is the ability of classes and objects to examine their own constructors, fields, methods, and so on. It is used usually for backward compatibility, to check if a given method is available for a particular OS version. If you have to use reflection for that purpose, make sure to cache the response, as using reflection is pretty slow. Some widely used libraries use Reflection too, like Roboguice for dependency injection. That’s the reason why you should prefer Dagger 2. For more details about reflection, you can check a <a href="http://blog.nimbledroid.com/2016/02/23/slow-Android-reflection.html" rel="noopener noreferrer" style="border: 0px; box-sizing: border-box; color: #3976cb; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" target="_blank">separate post</a>.</div>
<h3 id="autoboxing" style="background-color: white; border: 0px; box-sizing: border-box; color: #3863a0; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.3em; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
6. Autoboxing</h3>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Autoboxing and unboxing are processes of converting a primitive type to an Object type, or vice versa. In practice it means converting an int to an Integer. For achieving that, the compiler uses the <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">Integer.valueOf()</code> function internally. Converting is not just slow, Objects also take a lot more memory than their primitive equivalents. Let’s look at some code.</div>
<pre style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-size: 15px; line-height: 20px; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-java hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">Integer total = <span class="hljs-number" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">0</span>;
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">for</span> (<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">int</span> i = <span class="hljs-number" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">0</span>; i < <span class="hljs-number" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">1000000</span>; i++) {
total += i;
}
</code></pre>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
While this takes 500ms on average, rewriting it to avoid autoboxing will speed it up drastically.</div>
<pre style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-size: 15px; line-height: 20px; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-java hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">int</span> total = <span class="hljs-number" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">0</span>;
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">for</span> (<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">int</span> i = <span class="hljs-number" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">0</span>; i < <span class="hljs-number" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">1000000</span>; i++) {
total += i;
}
</code></pre>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
This solution runs at around 2ms, which is 25 times faster. If you don’t believe me, test it out. The numbers will be obviously different per device, but it should still be a lot faster. And it’s also a really simple step to optimize.</div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Okay, you probably don’t create a variable of type Integer like this often. But what about the cases when it is more difficult to avoid? Like in a map, where you have to use Objects, like <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">Map<Integer, Integer></code>? Look at the solution many people use.</div>
<pre style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-size: 15px; line-height: 20px; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-java hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">Map<Integer, Integer> myMap = <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">new</span> HashMap<>();
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">for</span> (<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">int</span> i = <span class="hljs-number" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">0</span>; i < <span class="hljs-number" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">100000</span>; i++) {
myMap.put(i, random.nextInt());
}
</code></pre>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Inserting 100k random ints in the map takes around 250ms to run. Now look at the solution with SparseIntArray.</div>
<pre style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-size: 15px; line-height: 20px; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-java hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">SparseIntArray myArray = <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">new</span> SparseIntArray();
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">for</span> (<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">int</span> i = <span class="hljs-number" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">0</span>; i < <span class="hljs-number" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">100000</span>; i++) {
myArray.put(i, random.nextInt());
}
</code></pre>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
This takes a lot less, roughly 50ms. It’s also one of the easier methods for improving performance, as nothing complicated has to be done, and the code also stays readable. While running a clear app with the first solution took 13MB of my memory, using primitive ints took something under 7MB, so just the half of it.</div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
SparseIntArray is just one of the cool collections that can help you avoid autoboxing. A map like <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">Map<Integer, Long></code> could be replaced by <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">SparseLongArray</code>, as the value of the map is of type <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">Long</code>. If you look at the <a href="https://github.com/android/platform_frameworks_base/blob/master/core/java/android/util/SparseLongArray.java#L45" rel="noopener noreferrer" style="border: 0px; box-sizing: border-box; color: #3976cb; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" target="_blank">source code</a> of <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">SparseLongArray</code>, you will see something pretty interesting. Under the hood, it is basically just a pair of arrays. You can also use a <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">SparseBooleanArray</code> similarly.</div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
If you read the source code, you might have noticed a note saying that <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">SparseIntArray</code> can be slower than <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">HashMap</code>. I’ve been experimenting a lot, but for me <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">SparseIntArray</code> was always better both memory and performance wise. I guess it’s still up to you which you choose, experiment with your use cases and see which fits you the most. Definitely have the <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">SparseArrays</code> in your head when using maps.</div>
<h3 id="ondraw" style="background-color: white; border: 0px; box-sizing: border-box; color: #3863a0; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.3em; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
7. OnDraw</h3>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
As I’ve said above, when you are optimizing performance, you will probably see the most benefit in optimizing code which runs often. One of the functions running a lot is <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">onDraw()</code>. It may not surprise you that it’s responsible for drawing views on the screen. As the devices usually run at 60 fps, the function is run 60 times per second. Every frame has 16 ms to be fully handled, including its preparation and drawing, so you should really avoid slow functions. Only the main thread can draw on the screen, so you should avoid doing expensive operations on it. If you freeze the main thread for several seconds, you might get the infamous Application Not Responding (ANR) dialog. For resizing images, database work, etc., use a background thread.</div>
<div class="pop_out_box is-full_width is-big" style="background: rgb(250, 250, 250); border: 0px; box-sizing: border-box; color: #505050; float: none; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.3em; line-height: 1.5em; margin: 0px 30px 15px 0px; min-height: 0px; min-width: 0px; overflow: hidden; padding: 1em 1.5em; text-align: center; vertical-align: baseline; width: 864px;">
If you think your users won't notice that drop in frame rate, you are wrong!</div>
<div class="tweet_this" style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 15px; line-height: 20px; margin: -10px 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; text-align: center; vertical-align: baseline;">
<iframe allowtransparency="true" class="twitter-share-button twitter-share-button-rendered twitter-tweet-button" data-url="https://www.toptal.com/android/android-performance-patterns" frameborder="0" id="twitter-widget-1" scrolling="no" src="https://platform.twitter.com/widgets/tweet_button.b7de008f493a5185d8df1aedd62d77c6.en.html#dnt=false&id=twitter-widget-1&lang=en&original_referer=https%3A%2F%2Fwww.toptal.com%2Fandroid%2Fandroid-performance-tips-tools&size=m&text=If%20you%20think%20your%20users%20won%27t%20notice%20that%20drop%20in%20frame%20rate%2C%20you%20are%20wrong!&time=1467171634616&type=share&url=https%3A%2F%2Fwww.toptal.com%2Fandroid%2Fandroid-performance-patterns" style="border-style: initial; border-width: 0px; box-sizing: border-box; height: 20px; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; position: static; vertical-align: baseline; visibility: visible; width: 61px;" title="Twitter Tweet Button"></iframe></div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
I’ve seen some people trying to shorten their code, thinking that it will be more efficient that way. That definitely isn’t the way to go, as shorter code totally doesn’t mean faster code. Under no circumstances should you measure the quality of code by the number of lines.</div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
One of the things you should avoid in <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">onDraw()</code> is allocating objects like Paint. Prepare everything in the constructor, so it’s ready when drawing. Even if you have <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">onDraw()</code> optimized, you should call it only as often as you have to. What is better than calling an optimized function? Well, not calling any function at all. In case you want to draw text, there is a pretty neat helper function called <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">drawText()</code>, where you can specify things like the text, coordinates, and the text color.</div>
<h3 id="viewholders" style="background-color: white; border: 0px; box-sizing: border-box; color: #3863a0; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.3em; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
8. ViewHolders</h3>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
You probably know this one, but I cannot skip it. The Viewholder design pattern is a way of making scrolling lists smoother. It is a kind of view caching, which can seriously reduce the calls to <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">findViewById()</code> and inflating views by storing them. It can look something like this.</div>
<pre style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-size: 15px; line-height: 20px; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-java hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">static</span> class ViewHolder {
TextView title;
TextView text;
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">ViewHolder</span>(View view) {
title = (TextView) view.findViewById(R.id.title);
text = (TextView) view.findViewById(R.id.text);
}
}
</code></pre>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Then, inside the <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">getView()</code> function of your adapter, you can check if you have a useable view. If not, you create one.</div>
<pre style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-size: 15px; line-height: 20px; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-java hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">ViewHolder viewHolder;
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">if</span> (convertView == <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">null</span>) {
convertView = inflater.inflate(R.layout.list_item, viewGroup, <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">false</span>);
viewHolder = <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">new</span> ViewHolder(convertView);
convertView.setTag(viewHolder);
} <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">else</span> {
viewHolder = (ViewHolder) convertView.getTag();
}
viewHolder.title.setText(<span class="hljs-string" style="border: 0px; box-sizing: border-box; color: #2aa198; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">"Hello World"</span>);
</code></pre>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
You can find a lot of useable info about this pattern around the internet. It can also be used in cases when your list view has multiple different types of elements in it, like some section headers.</div>
<div class="embeddable_form-wrapper for-post" data-role="blog_subscribe" data-view="blog_subscribe#form" style="background-color: white; border-radius: 6px; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 15px; line-height: 20px; margin: 0px; min-height: 0px; min-width: 0px; padding: 30px 0px; vertical-align: baseline;">
<form action="https://www.toptal.com/blog/subscription" class="embeddable_form" data-entity="blog_subscription" data-remote="" data-view="form#form" method="post" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<div class="embeddable_form-step is-email_form is-current" style="border: 0px; box-sizing: border-box; display: flex; flex-wrap: wrap; height: auto; margin: 0px; min-height: 0px; min-width: 0px; overflow: visible; padding: 0px; vertical-align: baseline;">
<div class="embeddable_form-row is-label" style="border: 0px; box-sizing: border-box; margin: 0px 0px 10px; min-height: 0px; min-width: 0px; padding: 0px; position: relative; vertical-align: baseline;">
<div class="embeddable_form-label_title" style="border: 0px; box-sizing: border-box; color: #2557a1; display: inline-block; font-size: 17px; font-weight: 700; line-height: 23px; margin: 0px 10px 0px 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Like what you're reading?</div>
<div class="embeddable_form-label" style="border: 0px; box-sizing: border-box; color: #313131; display: inline-block; font-size: 17px; font-style: italic; line-height: 19px; margin: 0px 10px 0px 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Get the latest updates first.</div>
</div>
<div class="embeddable_form-row form-field is-email_field" style="border: 0px; box-sizing: border-box; flex-basis: 100%; margin: 0px 0px 10px; min-height: 0px; min-width: 0px; padding: 0px; position: relative; vertical-align: baseline;">
<input autocomplete="off" class="input is-medium" data-role="email" name="blog_subscription[email]" placeholder="Enter your email address..." style="-webkit-appearance: none; background: rgb(250, 250, 250); border-radius: 4px; border: 1px solid rgb(238, 238, 238); color: #3c3c3c; font-family: proxima-nova, Arial, sans-serif; font-size: 14px; margin-bottom: 0px; margin-top: 0px; padding: 15px 12px; transition: all 0.2s; width: 864px;" type="text" /></div>
<div class="embeddable_form-row is-submit" style="-webkit-box-flex: 1; -webkit-box-ordinal-group: 4; border: 0px; box-sizing: border-box; flex-grow: 1; margin: 0px; min-height: 0px; min-width: 0px; order: 3; padding: 0px; position: relative; vertical-align: baseline;">
<input class="button is-green_candy is-default is-full_width" data-loader-text="Subscribing..." data-role="submit" style="-webkit-appearance: none; background-attachment: initial; background-clip: initial; background-image: linear-gradient(rgb(67, 198, 146), rgb(57, 184, 133)); background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-radius: 4px; border: 1px solid rgb(31, 124, 87); box-shadow: rgb(79, 211, 170) 0px 1px inset; color: white; cursor: pointer; font-size: 14px; font-weight: 600; padding: 15px 20px; position: relative; text-shadow: rgb(28, 143, 61) 0px 1px 0px; transition: background 150ms; width: 552.672px;" type="submit" value="Get Exclusive Updates" /></div>
<div class="embeddable_form-row is-privacy" style="border: 0px; box-sizing: border-box; margin: 0px 20px 0px 0px; min-height: 0px; min-width: 0px; padding: 0px; position: relative; vertical-align: baseline;">
<div class="embeddable_form-privacy" style="-webkit-box-align: center; align-items: center; border: 0px; box-sizing: border-box; color: #9a9a9a; display: flex; font-size: 12px; line-height: 50px; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<div class="embeddable_form-privacy_icon" style="background: url("/assets/front/static/public/primitives/icon/lock_ed584f.png") no-repeat; border: 0px; box-sizing: border-box; display: inline-block; flex-shrink: 0; height: 11.5px; margin: 0px 15px 0px 0px; min-height: 0px; min-width: 0px; padding: 0px; position: relative; top: -2px; vertical-align: baseline; width: 9.5px;">
</div>
<div class="embeddable_form-privacy_text" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
No spam. Just great engineering and design posts.</div>
</div>
</div>
</div>
<div class="embeddable_form-step is-confirmation" data-place="@blog_subscribe" data-role="confirmation" style="border: 0px; box-sizing: border-box; height: 0px; margin: 0px; min-height: 0px; min-width: 0px; overflow: hidden; padding: 0px; vertical-align: baseline;">
<div class="embeddable_form-row is-label is-success" style="border: 0px; box-sizing: border-box; margin: 0px 0px 10px; min-height: 0px; min-width: 0px; padding: 0px; position: relative; vertical-align: baseline; width: 864px;">
<div class="embeddable_form-label_title" style="border: 0px; box-sizing: border-box; color: #2557a1; display: inline-block; font-size: 17px; font-weight: 700; line-height: 23px; margin: 0px 10px 0px 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
</div>
<div class="embeddable_form-label" style="border: 0px; box-sizing: border-box; color: #313131; display: inline-block; font-size: 17px; font-style: italic; line-height: 19px; margin: 0px 10px 0px 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
</div>
</div>
<div class="embeddable_form-row is-success" style="border: 0px; box-sizing: border-box; margin: 0px 0px 10px; min-height: 0px; min-width: 0px; padding: 0px; position: relative; vertical-align: baseline; width: 864px;">
<div class="embeddable_form-label is-header" style="border: 0px; box-sizing: border-box; color: #313131; display: inline-block; font-size: 17px; font-style: italic; line-height: 19px; margin: 0px 10px 0px 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
</div>
<div class="embeddable_form-label" style="border: 0px; box-sizing: border-box; color: #313131; display: inline-block; font-size: 17px; font-style: italic; line-height: 19px; margin: 0px 10px 0px 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<a data-role="preferences_link" href="https://www.toptal.com/android/android-performance-tips-tools#" style="border: 0px; box-sizing: border-box; color: #3976cb; display: inline; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; text-decoration: none; transition: color 150ms, transform, text-shadow, -webkit-transform; vertical-align: baseline;"></a></div>
</div>
<div class="embeddable_form-row is-success" style="border: 0px; box-sizing: border-box; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; position: relative; vertical-align: baseline; width: 864px;">
<ul class="social_share is-horizontal is-loaded" data-rss-url="https://www.toptal.com/developers/blog.rss" data-twitter-username="@toptalllc" data-url="https://www.toptal.com/developers/blog" data-view="layout#social_share" data-youtube-channel-url="https://www.youtube.com/channel/UCNqm_euTHZz3o5OnKhUS-oA" style="-webkit-box-direction: normal; -webkit-box-orient: horizontal; -webkit-box-pack: start; border: 0px; box-sizing: border-box; display: flex; flex-direction: row; font-size: 1.2em; justify-content: flex-start; list-style: none; margin: 0px; max-width: 300px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<li class="social_share-item is-counter" style="background-color: #3863a0; border-bottom-color: rgb(236, 236, 236); border-bottom-style: solid; border-left-color: rgb(236, 236, 236); border-left-style: solid; border-radius: 4px 0px 0px 4px; border-right-color: rgb(56, 99, 160) !important; border-top-color: rgb(236, 236, 236); border-top-style: solid; border-width: 1px 0px 1px 1px; box-sizing: border-box; color: white; flex-shrink: 0; height: 50px; line-height: 15px; list-style-type: disc; margin-bottom: 0.75em; margin-left: 30px; margin-right: 0px !important; margin-top: 0px !important; min-height: 0px; min-width: 0px; padding: 10px 0px; position: relative; text-align: center; text-shadow: rgba(0, 0, 0, 0.498039) 0px 1px 2px; transition: box-shadow 0.2s; vertical-align: baseline; width: 50px;" title="Total number of shares"><span class="social_share-item_num" data-role="counter_num" style="border: 0px; box-sizing: border-box; display: block; font-size: 14px; margin: 0px; min-height: 0px; min-width: 0px; opacity: 1; padding: 0px; transition: opacity 0.3s; vertical-align: baseline;"></span><span class="social_share-item_text" data-role="counter_text" style="border: 0px; box-sizing: border-box; display: block; font-size: 9px; margin: 0px; min-height: 0px; min-width: 0px; opacity: 1; padding: 0px; text-transform: uppercase; transition: opacity 0.3s; vertical-align: baseline;"></span></li>
<li class="social_share-item" style="border-bottom-color: rgb(236, 236, 236); border-bottom-style: solid; border-left-color: rgb(236, 236, 236); border-left-style: solid; border-top-color: rgb(236, 236, 236); border-top-style: solid; border-width: 1px 0px 1px 1px; box-sizing: border-box; flex-shrink: 0; height: 50px; line-height: 1.5em; list-style-type: disc; margin-bottom: 0.75em; margin-left: 30px; margin-right: 0px !important; margin-top: 0px !important; min-height: 0px; min-width: 0px; padding: 0px; text-shadow: rgba(0, 0, 0, 0.498039) 0px 1px 2px; transition: box-shadow 0.2s; vertical-align: baseline; width: 50px;"><a class="social_share-item_link" data-role="link" data-type="facebook" href="https://draft.blogger.com/null" style="border: 0px; box-sizing: border-box; color: #3976cb; cursor: pointer; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" title="Share on Facebook"><img class="social_share-item_image" height="50" src="https://assets.toptal.io/assets/front/static/public/primitives/social/share_bar/facebook_dc66c9.png" style="border: 0px; box-sizing: border-box; display: block; height: 50px; margin: 0px auto 7px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline; width: 50px;" width="50" /></a></li>
<li class="social_share-item" style="border-bottom-color: rgb(236, 236, 236); border-bottom-style: solid; border-left-color: rgb(236, 236, 236); border-left-style: solid; border-top-color: rgb(236, 236, 236); border-top-style: solid; border-width: 1px 0px 1px 1px; box-sizing: border-box; flex-shrink: 0; height: 50px; line-height: 1.5em; list-style-type: disc; margin-bottom: 0.75em; margin-left: 30px; margin-right: 0px !important; margin-top: 0px !important; min-height: 0px; min-width: 0px; padding: 0px; text-shadow: rgba(0, 0, 0, 0.498039) 0px 1px 2px; transition: box-shadow 0.2s; vertical-align: baseline; width: 50px;"><a class="social_share-item_link" data-role="link" data-type="google_plus" href="https://draft.blogger.com/null" style="border: 0px; box-sizing: border-box; color: #3976cb; cursor: pointer; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" title="Share on Google Plus"><img class="social_share-item_image" height="50" src="https://assets.toptal.io/assets/front/static/public/primitives/social/share_bar/google_plus_355fb0.png" style="border: 0px; box-sizing: border-box; display: block; height: 50px; margin: 0px auto 7px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline; width: 50px;" width="50" /></a></li>
<li class="social_share-item" style="border-radius: 0px 4px 4px 0px; border: 1px solid rgb(236, 236, 236); box-sizing: border-box; flex-shrink: 0; height: 50px; line-height: 1.5em; list-style-type: disc; margin-bottom: 0px; margin-left: 30px; margin-right: 0px !important; margin-top: 0px !important; min-height: 0px; min-width: 0px; padding: 0px; text-shadow: rgba(0, 0, 0, 0.498039) 0px 1px 2px; transition: box-shadow 0.2s; vertical-align: baseline; width: 50px;"><a class="social_share-item_link" data-role="link" data-type="twitter_follow" href="https://draft.blogger.com/null" style="border: 0px; box-sizing: border-box; color: #3976cb; cursor: pointer; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" title="Follow Toptal on Twitter"><img class="social_share-item_image" height="50" src="https://assets.toptal.io/assets/front/static/public/primitives/social/share_bar/twitter_83c6d4.png" style="border: 0px; box-sizing: border-box; display: block; height: 50px; margin: 0px auto 7px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline; width: 50px;" width="50" /></a></li>
</ul>
</div>
</div>
</form>
</div>
<h3 id="resizing-images" style="background-color: white; border: 0px; box-sizing: border-box; color: #3863a0; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.3em; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
9. Resizing Images</h3>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Chances are, your app will contain some images. In case you are downloading some JPGs from the web, they can have really huge resolutions. However, the devices they will be displayed on will be a lot smaller. Even if you take a photo with the camera of your device, it needs to be downsized before displaying as the photo resolution is a lot bigger than the resolution of the display. Resizing images before displaying them is a crucial thing. If you’d try displaying them in full resolutions, you’d run out of memory pretty quickly. <a href="https://developer.android.com/training/displaying-bitmaps/index.html" rel="noopener noreferrer" style="border: 0px; box-sizing: border-box; color: #3976cb; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" target="_blank">There</a> is a whole lot written about displaying bitmaps efficiently in the Android docs, I will try summing it up.</div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
So you have a bitmap, but you don’t know anything about it. There’s a useful flag of Bitmaps called inJustDecodeBounds at your service, which allows you to find out the bitmap’s resolution. Let’s assume that your bitmap is 1024x768, and the ImageView used for displaying it is just 400x300. You should keep dividing the bitmap’s resolution by 2 until it’s still bigger than the given ImageView. If you do, it will downsample the bitmap by a factor of 2, giving you a bitmap of 512x384. The downsampled bitmap uses 4x less memory, which will help you a lot with avoiding the famous OutOfMemory error.</div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Now that you know how to do it, you should not do it. … At least, not if your app relies on images heavily, and it’s not just 1-2 images. Definitely avoid stuff like resizing and recycling images manually, use some third party libraries for that. The most popular ones are <a href="http://square.github.io/picasso/" rel="noopener noreferrer" style="border: 0px; box-sizing: border-box; color: #3976cb; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" target="_blank">Picasso</a> by Square, <a href="https://github.com/nostra13/Android-Universal-Image-Loader" rel="noopener noreferrer" style="border: 0px; box-sizing: border-box; color: #3976cb; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" target="_blank">Universal Image Loader</a>, <a href="http://frescolib.org/" rel="noopener noreferrer" style="border: 0px; box-sizing: border-box; color: #3976cb; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" target="_blank">Fresco</a> by Facebook, or my favourite, <a href="https://github.com/bumptech/glide" rel="noopener noreferrer" style="border: 0px; box-sizing: border-box; color: #3976cb; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" target="_blank">Glide</a>. There is a huge active community of developers around it, so you can find a lot of helpful people at the issues section on GitHub as well.</div>
<h3 id="strict-mode" style="background-color: white; border: 0px; box-sizing: border-box; color: #3863a0; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.3em; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
10. Strict Mode</h3>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Strict Mode is a quite useful developer tool that many people don’t know about. It’s usually used for detecting network requests or disk accesses from the main thread. You can set what <a href="https://developer.android.com/reference/android/os/StrictMode.ThreadPolicy.Builder.html#detectAll()" rel="noopener noreferrer" style="border: 0px; box-sizing: border-box; color: #3976cb; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" target="_blank">issues</a> Strict Mode should look for and what penalty it should trigger. A google sample looks like this:</div>
<pre style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-size: 15px; line-height: 20px; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-java hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;"><span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">public</span> <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">void</span> <span class="hljs-title" style="border: 0px; box-sizing: border-box; color: #268bd2; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">onCreate</span>() {
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">if</span> (DEVELOPER_MODE) {
StrictMode.setThreadPolicy(<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">new</span> StrictMode.ThreadPolicy.Builder()
.detectDiskReads()
.detectDiskWrites()
.detectNetwork()
.penaltyLog()
.build());
StrictMode.setVmPolicy(<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">new</span> StrictMode.VmPolicy.Builder()
.detectLeakedSqlLiteObjects()
.detectLeakedClosableObjects()
.penaltyLog()
.penaltyDeath()
.build());
}
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">super</span>.onCreate();
}
</code></pre>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
If you want to detect every issue Strict Mode can find, you can also use <code style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; display: inline-block; font-size: 0.8em; line-height: 1em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 2px 5px; vertical-align: text-bottom;">detectAll()</code>. As with many performance tips, you should not blindly try fixing everything Strict Mode reports. Just investigate it, and if you are sure it’s not an issue, leave it alone. Also make sure to use Strict Mode only for debugging, and always have it disabled on production builds.</div>
<h2 id="debugging-performance-the-pro-way" style="background-color: white; border: 0px; box-sizing: border-box; color: #3863a0; font-family: 'Proxima Nova', Arial, sans-serif; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Debugging Performance: The Pro Way</h2>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Let’s now see some tools that can help you find bottlenecks, or at least show that something is wrong.</div>
<h3 id="android-monitor" style="background-color: white; border: 0px; box-sizing: border-box; color: #3863a0; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.3em; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
1. Android Monitor</h3>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
This is a tool built into Android Studio. By default, you can find the Android Monitor at the bottom left corner, and you can switch between 2 tabs there. Logcat and Monitors. The Monitors section contains 4 different graphs. Network, CPU, GPU, and Memory. They are pretty self explanatory, so I will just quickly go through them. Here is a screenshot of the graphs taken while parsing some JSON as it is downloaded.</div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<img alt="Android Monitor" src="https://assets.toptal.io/uploads/blog/image/92700/toptal-blog-image-1467011361594-be875234821cc489a262f126223d5ce8.png" style="border: 0px; box-sizing: border-box; display: block; margin: 0px auto 7px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" /></div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
The Network part shows the incoming and outgoing traffic in KB/s. The CPU part displays the CPU usage in percent. The GPU monitor displays how much time it takes to render the frames of a UI window. This is the most detailed monitor out of these 4, so if you want more details about it, <a href="https://developer.android.com/studio/profile/am-gpu.html" rel="noopener noreferrer" style="border: 0px; box-sizing: border-box; color: #3976cb; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" target="_blank">read this</a>.</div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Lastly we have the <a href="https://developer.android.com/studio/profile/am-memory.html" rel="noopener noreferrer" style="border: 0px; box-sizing: border-box; color: #3976cb; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" target="_blank">Memory monitor</a>, which you will probably use the most. By default it shows the current amount of Free and Allocated memory. You can force a Garbage Collection with it too, to test if the amount of used memory drops down. It has a useful feature called Dump Java Heap, which will create a HPROF file which can be opened with the <a href="https://developer.android.com/studio/profile/am-hprof.html" rel="noopener noreferrer" style="border: 0px; box-sizing: border-box; color: #3976cb; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" target="_blank">HPROF Viewer and Analyzer</a>. That will enable you to see how many objects you have allocated, how much memory is taken by what, and maybe which objects are causing memory leaks. Learning how to use this analyzer is not the simplest task out there, but it is worth it. The next thing you can do with the Memory Monitor is do some timed Allocation Tracking, which you can start and stop as you wish. It could be useful at many cases, for example when scrolling or rotating the device.</div>
<div>
<b>source</b>: <a href="https://www.toptal.com/android/android-performance-tips-tools">https://www.toptal.com/android/android-performance-tips-tools</a></div>
</div>
Anonymoushttp://www.blogger.com/profile/16161990470673049263noreply@blogger.com3tag:blogger.com,1999:blog-4479053300163234685.post-40276947392970373452016-04-03T20:21:00.000-07:002016-04-03T20:21:06.733-07:00Mastering 2D Cameras in Unity: A Tutorial for Game Developers<div dir="ltr" style="text-align: left;" trbidi="on">
source: <a href="https://www.toptal.com/unity-unity3d/2d-camera-in-unity?utm_campaign=blog_post_2d_camera_in_unity&utm_medium=email&utm_source=blog_subscribers">https://www.toptal.com/unity-unity3d/2d-camera-in-unity?utm_campaign=blog_post_2d_camera_in_unity&utm_medium=email&utm_source=blog_subscribers</a><br />
<br />
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
For a developer, the camera is one of the cornerstones of the game development process. From just showing your game view in a chess app to masterfully directing camera movement in a 3D AAA game to obtain cinematic effects, cameras are basically used in any video game ever made, even before actually being called “cameras”.</div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
In this article I’m going to explain how to design a camera system for 2D games, and I’m also going to explain some points on how to go about implementing it in one of the most popular game engines out there, <a href="https://unity3d.com/" style="border: 0px; box-sizing: border-box; color: #3976cb; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" target="_blank">Unity</a>.</div>
<h2 id="from-2d-to-25d-an-extensible-camera-system" style="background-color: white; border: 0px; box-sizing: border-box; color: #3863a0; font-family: 'Proxima Nova', Arial, sans-serif; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
From 2D to 2.5D: An Extensible Camera System</h2>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
The camera system we are going to design together is modular and extensible. It has a basic core consisting of several components which will ensure the basic functionality, and then various components/effects that can be optionally used, depending on the situation at hand.</div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
The camera system we are building here is targeted at 2D platform games, but can easily extended to other types of 2D games, 2.5D games or even 3D games.</div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<img alt="Mastering 2D Camera in Unity: A Tutorial for Game Developers" src="https://assets.toptal.io/uploads/blog/image/92295/toptal-blog-image-1459426983370-1fc070dd29272b79bda1f255e384ff46.gif" style="border: 0px; box-sizing: border-box; display: block; margin: 0px auto 7px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" /></div>
<div class="pop_out_box is-full_width is-big" style="background: rgb(250, 250, 250); border: 0px; box-sizing: border-box; color: #505050; float: none; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.3em; line-height: 1.5em; margin: 0px 30px 15px 0px; min-height: 0px; min-width: 0px; overflow: hidden; padding: 1em 1.5em; text-align: center; vertical-align: baseline; width: 864px;">
Mastering 2D Camera in Unity: A Tutorial for Game Developers</div>
<div class="tweet_this" style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 15px; line-height: 20px; margin: -10px 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; text-align: center; vertical-align: baseline;">
<iframe allowtransparency="true" class="twitter-share-button twitter-share-button-rendered twitter-tweet-button" data-url="https://www.toptal.com/unity-unity3d/2d-camera-in-unity" frameborder="0" id="twitter-widget-3" scrolling="no" src="https://platform.twitter.com/widgets/tweet_button.64a917b4a230f163048902c783e1530f.en.html#dnt=false&id=twitter-widget-3&lang=en&original_referer=https%3A%2F%2Fwww.toptal.com%2Funity-unity3d%2F2d-camera-in-unity%3Futm_campaign%3Dblog_post_2d_camera_in_unity%26utm_medium%3Demail%26utm_source%3Dblog_subscribers&size=m&text=Mastering%202D%20Camera%20in%20Unity%3A%20A%20Tutorial%20for%20Game%20Developers&time=1459739663734&type=share&url=https%3A%2F%2Fwww.toptal.com%2Funity-unity3d%2F2d-camera-in-unity&via=toptalllc" style="border-style: initial; border-width: 0px; box-sizing: border-box; height: 20px; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; position: static; vertical-align: baseline; visibility: visible; width: 61px;" title="Twitter Tweet Button"></iframe></div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
I am going to split the camera functionality into two main groups: camera tracking and camera effects.</div>
<h3 id="tracking" style="background-color: white; border: 0px; box-sizing: border-box; color: #3863a0; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.3em; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Tracking</h3>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Most of the camera movement we’ll do here will be based on tracking. That is the ability of an object, in this case the camera, to track other objects as they move about in the game scene. The types of tracking that we’ll be implementing are going to solve some common scenarios encountered in 2d platform games, but they can be extended with new types of tracking for other particular scenarios you might have.</div>
<h3 id="effects" style="background-color: white; border: 0px; box-sizing: border-box; color: #3863a0; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.3em; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Effects</h3>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
We will be implementing some cool effects like camera shake, camera zoom, camera fade, and color overlay.</div>
<h2 id="getting-started" style="background-color: white; border: 0px; box-sizing: border-box; color: #3863a0; font-family: 'Proxima Nova', Arial, sans-serif; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Getting Started</h2>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Create a new 2D project in Unity and import standard assets, especially the RobotBoy character. Next, create a ground box and add a character instance. You should be able to walk and jump with your character in your current scene. Make sure the camera is set to Orthographic mode (it is set to Perspective by default).</div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<img alt="" src="https://assets.toptal.io/uploads/blog/image/92296/toptal-blog-image-1459427126197-16574a9c6f4cf7dcb7dc8cf6e9727c39.jpg" style="border: 0px; box-sizing: border-box; display: block; margin: 0px auto 7px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" /></div>
<h2 id="tracking-a-target" style="background-color: white; border: 0px; box-sizing: border-box; color: #3863a0; font-family: 'Proxima Nova', Arial, sans-serif; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Tracking a Target</h2>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
The following script will add basic tracking behavior to our main camera. The script must be attached as a component to the main camera in your scene and it exposes a field for assigning a target object to track. Then the script ensures the x and y coordinates of the camera are the same with the object it tracks. All this processing is done during the Update step.</div>
<pre style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-size: 15px; line-height: 20px; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;"><code class="language-cs hljs" style="background: rgb(255, 255, 252); border-radius: 3px; border: 1px solid rgb(238, 238, 238); box-sizing: border-box; color: #657b83; display: inline-block; font-size: 0.9em; line-height: 1.5em; margin: 0px; max-width: 100%; min-height: 0px; min-width: 0px; overflow-x: auto; padding: 2px 5px; vertical-align: text-bottom; width: 864px;">[SerializeField]
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">protected</span> Transform trackingTarget;
<span class="hljs-comment" style="border: 0px; box-sizing: border-box; color: #93a1a1; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">// ...</span>
<span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">void</span> Update()
{
transform.position = <span class="hljs-keyword" style="border: 0px; box-sizing: border-box; color: #859900; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">new</span> Vector3(trackingTarget.position.x,
trackingTarget.position.y, transform.position.z);
}
</code></pre>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Drag the RobotBoy character from your scene hierarchy over the “Tracking Target” field exposed by our following behavior in order to enable tracking of the main character.</div>
</div>
Anonymoushttp://www.blogger.com/profile/16161990470673049263noreply@blogger.com0tag:blogger.com,1999:blog-4479053300163234685.post-72755732525413642702016-03-31T06:10:00.000-07:002016-03-31T06:10:06.622-07:00Android Build System<div dir="ltr" style="text-align: left;" trbidi="on">
source: <a href="https://ejf.io/android/build_system/">https://ejf.io/android/build_system/</a><br />
<br />
<h2 id="tips:f186876ab6b8bcf80ebd8640f1dbbf85" style="box-sizing: border-box; color: #333333; font-family: Merriweather, serif; line-height: 21.6px;">
Tips</h2>
<ul style="box-sizing: border-box; color: #333333; font-family: Merriweather, serif; line-height: 21.6px;">
<li style="box-sizing: border-box;">Use the daemon<ul style="box-sizing: border-box;">
<li style="box-sizing: border-box;"><code style="border: 1px solid rgb(234, 234, 234); box-sizing: border-box; font-family: monospace, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px;">--daemon</code> or <code style="border: 1px solid rgb(234, 234, 234); box-sizing: border-box; font-family: monospace, monospace; font-size: 12px; margin: 0px 2px; padding: 0px 5px;">org.gradle.debug = true</code></li>
</ul>
</li>
<li style="box-sizing: border-box;">Give it enough memeory</li>
<li style="box-sizing: border-box;">Control the number of threads</li>
<li style="box-sizing: border-box;">Use the latest build tools</li>
<li style="box-sizing: border-box;">Get an SSD</li>
<li style="box-sizing: border-box;">Don’t use timestamps or commit numbers in debug build files</li>
</ul>
<div style="box-sizing: border-box; color: #333333; font-family: Merriweather, serif; line-height: 21.6px;">
Try:</div>
<pre style="border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: monospace, monospace; font-size: 13px; line-height: 19px; margin-bottom: 20px; overflow: auto; padding: 6px 10px; word-wrap: break-word;"><code style="border-radius: 0px; border: 0px; box-sizing: border-box; font-family: monospace, monospace; margin: 0px; padding: 0px;">android {
dexOptions {
dexInProcess = true
}
}
</code></pre>
<div style="box-sizing: border-box; color: #333333; font-family: Merriweather, serif; line-height: 21.6px;">
Consider having a development flavor using min SDK 21, as it’s going to be faster.</div>
<pre style="border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: monospace, monospace; font-size: 13px; line-height: 19px; margin-bottom: 20px; overflow: auto; padding: 6px 10px; word-wrap: break-word;"><code style="border-radius: 0px; border: 0px; box-sizing: border-box; font-family: monospace, monospace; margin: 0px; padding: 0px;">android.productFlavors {
normal
dev {
minSdkVersion 21
}
}
</code></pre>
<h2 id="testing:f186876ab6b8bcf80ebd8640f1dbbf85" style="box-sizing: border-box; color: #333333; font-family: Merriweather, serif; line-height: 21.6px;">
Testing</h2>
<h3 id="test-dependencies:f186876ab6b8bcf80ebd8640f1dbbf85" style="box-sizing: border-box; color: #333333; font-family: Merriweather, serif; font-weight: 100; line-height: 21.6px;">
Test dependencies</h3>
<pre style="border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: monospace, monospace; font-size: 13px; line-height: 19px; margin-bottom: 20px; overflow: auto; padding: 6px 10px; word-wrap: break-word;"><code style="border-radius: 0px; border: 0px; box-sizing: border-box; font-family: monospace, monospace; margin: 0px; padding: 0px;">dependencies {
compile ".."
testCompile "junit:junit:4.12"
testCompile "org.mockito:mockito-core:1.9.5"
}
</code></pre>
<h3 id="unit-testing:f186876ab6b8bcf80ebd8640f1dbbf85" style="box-sizing: border-box; color: #333333; font-family: Merriweather, serif; font-weight: 100; line-height: 21.6px;">
Unit testing</h3>
<div style="box-sizing: border-box; color: #333333; font-family: Merriweather, serif; line-height: 21.6px;">
config:</div>
<pre style="border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: monospace, monospace; font-size: 13px; line-height: 19px; margin-bottom: 20px; overflow: auto; padding: 6px 10px; word-wrap: break-word;"><code style="border-radius: 0px; border: 0px; box-sizing: border-box; font-family: monospace, monospace; margin: 0px; padding: 0px;">unitTests.all {
jvmArgs "-XX:MaxPermSize=256m"
beforeTest { descriptor ->
logger.lifecycle("Running test: " + descriptor)
}
}
</code></pre>
<h3 id="using-a-test-project:f186876ab6b8bcf80ebd8640f1dbbf85" style="box-sizing: border-box; color: #333333; font-family: Merriweather, serif; font-weight: 100; line-height: 21.6px;">
Using a test project</h3>
<div style="box-sizing: border-box; color: #333333; font-family: Merriweather, serif; line-height: 21.6px;">
Use a separate project just for the test APK.</div>
<div style="box-sizing: border-box; color: #333333; font-family: Merriweather, serif; line-height: 21.6px;">
In main project:</div>
<pre style="border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: monospace, monospace; font-size: 13px; line-height: 19px; margin-bottom: 20px; overflow: auto; padding: 6px 10px; word-wrap: break-word;"><code style="border-radius: 0px; border: 0px; box-sizing: border-box; font-family: monospace, monospace; margin: 0px; padding: 0px;">apply plugin: 'com.android.application'
android {
...
publishNonDefault true
}
</code></pre>
<div style="box-sizing: border-box; color: #333333; font-family: Merriweather, serif; line-height: 21.6px;">
In test project:</div>
<pre style="border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: monospace, monospace; font-size: 13px; line-height: 19px; margin-bottom: 20px; overflow: auto; padding: 6px 10px; word-wrap: break-word;"><code style="border-radius: 0px; border: 0px; box-sizing: border-box; font-family: monospace, monospace; margin: 0px; padding: 0px;">apply plugin: 'com.android.test'
android {
targetProjectPath ':app'
targetVariant 'debug'
defaultConfig {
minSdkVersion 8
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
}
}
</code></pre>
<div style="box-sizing: border-box; color: #333333; font-family: Merriweather, serif; line-height: 21.6px;">
Test code then lives in the <span style="box-sizing: border-box; font-weight: 700;">main</span> source set of your <span style="box-sizing: border-box; font-weight: 700;">test project</span>.</div>
<div style="box-sizing: border-box; color: #333333; font-family: Merriweather, serif; line-height: 21.6px;">
Instrumentation tag still needs to be added to the <span style="box-sizing: border-box; font-weight: 700;">test project</span> manifest, however they’re hoping to be able to remove this step soon:</div>
<pre style="border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: monospace, monospace; font-size: 13px; line-height: 19px; margin-bottom: 20px; overflow: auto; padding: 6px 10px; word-wrap: break-word;"><code style="border-radius: 0px; border: 0px; box-sizing: border-box; font-family: monospace, monospace; margin: 0px; padding: 0px;"><manifest ...>
<instrumentation
android:name="android.support.test.runner.AndroidJUnitRunner"
android:targetPackage="com.example.app" />
</manifest>
</code></pre>
<div style="box-sizing: border-box; color: #333333; font-family: Merriweather, serif; line-height: 21.6px;">
Running task on <span style="box-sizing: border-box; font-weight: 700;">test project</span>:</div>
<pre style="border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: monospace, monospace; font-size: 13px; line-height: 19px; margin-bottom: 20px; overflow: auto; padding: 6px 10px; word-wrap: break-word;"><code style="border-radius: 0px; border: 0px; box-sizing: border-box; font-family: monospace, monospace; margin: 0px; padding: 0px;">./gradlew :testProject:connectedAndroidTest
</code></pre>
<div style="box-sizing: border-box; color: #333333; font-family: Merriweather, serif; line-height: 21.6px;">
One note on all of this is to make sure that you avoid build tools and dependency version conflicts! Main APK and Test APK need to have the same Build Tools version, and same versions for dependencies. This should be common sense (since you want to test the same versions of everything).</div>
<h2 id="native-support:f186876ab6b8bcf80ebd8640f1dbbf85" style="box-sizing: border-box; color: #333333; font-family: Merriweather, serif; line-height: 21.6px;">
Native Support</h2>
<h3 id="new-plugins:f186876ab6b8bcf80ebd8640f1dbbf85" style="box-sizing: border-box; color: #333333; font-family: Merriweather, serif; font-weight: 100; line-height: 21.6px;">
New plugins</h3>
<div style="box-sizing: border-box; color: #333333; font-family: Merriweather, serif; line-height: 21.6px;">
<a href="http://tools.android.com/tech-docs/new-build-system/gradle-experimental" style="box-sizing: border-box; color: #3d92c9; text-decoration: none;">New plugins for native (content at link may change)</a>:</div>
<ul style="box-sizing: border-box; color: #333333; font-family: Merriweather, serif; line-height: 21.6px;">
<li style="box-sizing: border-box;">com.android.model.application - <em style="box-sizing: border-box;">*.apk</em></li>
<li style="box-sizing: border-box;">com.android.model.library - <em style="box-sizing: border-box;">*.aar</em></li>
<li style="box-sizing: border-box;">com.android.model.native - <em style="box-sizing: border-box;">*.so</em></li>
</ul>
<div style="box-sizing: border-box; color: #333333; font-family: Merriweather, serif; line-height: 21.6px;">
In build.gradle:</div>
<pre style="border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: monospace, monospace; font-size: 13px; line-height: 19px; margin-bottom: 20px; overflow: auto; padding: 6px 10px; word-wrap: break-word;"><code style="border-radius: 0px; border: 0px; box-sizing: border-box; font-family: monospace, monospace; margin: 0px; padding: 0px;">apply plugin: 'com.android.model.application'
model {
android {
compileSdkVersion = 22
buildToolsVersion = "22.0.1"
ndk.with {
moduleName = "native"
// and other configurations like the following
CFlags.add("-DCUSTOM_DEFINE")
cppFlags.add("-DCUSTOM_DEFINE")
ldFlags.add("-L/custom/lib/path")
ldLibs.add("log")
stl = "stlport_static"
}
}
}
</code></pre>
<h3 id="inter-module-dependencies:f186876ab6b8bcf80ebd8640f1dbbf85" style="box-sizing: border-box; color: #333333; font-family: Merriweather, serif; font-weight: 100; line-height: 21.6px;">
Inter-module dependencies</h3>
<div style="box-sizing: border-box; color: #333333; font-family: Merriweather, serif; line-height: 21.6px;">
Inter-module dependencies for native code, using a library project for the native code:</div>
<pre style="border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: monospace, monospace; font-size: 13px; line-height: 19px; margin-bottom: 20px; overflow: auto; padding: 6px 10px; word-wrap: break-word;"><code style="border-radius: 0px; border: 0px; box-sizing: border-box; font-family: monospace, monospace; margin: 0px; padding: 0px;">apply plugin: 'com.android.model.application'
model {
android.sources {
main {
jni {
dependencies {
project ":lib"
}
}
}
}
}
</code></pre>
<div style="box-sizing: border-box; color: #333333; font-family: Merriweather, serif; line-height: 21.6px;">
Perhaps the <span style="box-sizing: border-box; font-weight: 700;">lib project</span> with native code is set up like this:</div>
<pre style="border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: monospace, monospace; font-size: 13px; line-height: 19px; margin-bottom: 20px; overflow: auto; padding: 6px 10px; word-wrap: break-word;"><code style="border-radius: 0px; border: 0px; box-sizing: border-box; font-family: monospace, monospace; margin: 0px; padding: 0px;">apply plugin: "com.android.model.native"
model {
android {
compileSdkVersion = 21
}
android.ndk {
moduleName = "hello"
}
}
</code></pre>
<h2 id="extending-the-android-plugin:f186876ab6b8bcf80ebd8640f1dbbf85" style="box-sizing: border-box; color: #333333; font-family: Merriweather, serif; line-height: 21.6px;">
Extending the Android plugin</h2>
<h3 id="afterevaluate:f186876ab6b8bcf80ebd8640f1dbbf85" style="box-sizing: border-box; color: #333333; font-family: Merriweather, serif; font-weight: 100; line-height: 21.6px;">
afterEvaluate</h3>
<div style="box-sizing: border-box; color: #333333; font-family: Merriweather, serif; line-height: 21.6px;">
Old way:</div>
<pre style="border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: monospace, monospace; font-size: 13px; line-height: 19px; margin-bottom: 20px; overflow: auto; padding: 6px 10px; word-wrap: break-word;"><code style="border-radius: 0px; border: 0px; box-sizing: border-box; font-family: monospace, monospace; margin: 0px; padding: 0px;">project.afterEvaluate {
def task = project.tasks.getByName('transformClassesWithInstantRunForDebug')
// ...
}
</code></pre>
<ul style="box-sizing: border-box; color: #333333; font-family: Merriweather, serif; line-height: 21.6px;">
<li style="box-sizing: border-box;">not part of the official API</li>
<li style="box-sizing: border-box;">no guarantee that task names will be stable</li>
<li style="box-sizing: border-box;">no guarantee that things won’t be merged or split</li>
</ul>
</div>
Anonymoushttp://www.blogger.com/profile/16161990470673049263noreply@blogger.com0tag:blogger.com,1999:blog-4479053300163234685.post-19971209739706644502016-03-31T03:34:00.002-07:002016-03-31T03:34:24.339-07:00Create Hello-JNI with Android Studio<div dir="ltr" style="text-align: left;" trbidi="on">
source: <a href="https://codelabs.developers.google.com/codelabs/android-studio-jni/index.html?index=..%2F..%2Findex#1">https://codelabs.developers.google.com/codelabs/android-studio-jni/index.html?index=..%2F..%2Findex#1</a><br />
<br />
<h2 class="style-scope google-codelab-step" id="title" style="background-color: white; font-family: Roboto, sans-serif; font-size: 28px; font-weight: 400; line-height: 1em; margin: 0px 0px 30px;">
<span class="style-scope google-codelab-step">2</span>. <span class="style-scope google-codelab-step">Create Java Sample App</span></h2>
<ol start="1" style="background-color: white; font-family: Roboto, sans-serif; font-size: 14px; line-height: 24px;">
<li style="margin: 0.5em 0px;">Find and start Android Studio on your development system:</li>
</ol>
<ul style="background-color: white; font-family: Roboto, sans-serif; font-size: 14px; line-height: 24px;">
<li style="margin: 0.5em 0px;">Linux: Run <code style="background-color: rgba(0, 0, 0, 0.0784314); border-radius: 3px; color: #333333; font-family: 'Source Code Pro', Helvetica, Arial; font-size: inherit; overflow-x: auto; padding: 0.1em 0.3em;">studio.sh</code> from your installed location</li>
<li style="margin: 0.5em 0px;">OSX: Find studio installation in Application folder, double click to start</li>
</ul>
<div class="indented" style="background-color: white; font-family: Roboto, sans-serif; font-size: 14px; line-height: 24px; margin-left: 40px;">
If this is the first time you run this version of Android Studio on this system, Android Studio will prompt to import from previous settings, just select “I do not have a previous version of Studio or I do not want to import my settings”, “Welcome to Android Studio” will be displayed.<br /><img src="https://codelabs.developers.google.com/codelabs/android-studio-jni/img/img-2.png" style="max-width: 348px; vertical-align: bottom; width: 348px;" /></div>
<ol start="2" style="background-color: white; font-family: Roboto, sans-serif; font-size: 14px; line-height: 24px;">
<li style="margin: 0.5em 0px;">Select “Start a new Android Studio project”.</li>
</ol>
<ol start="3" style="background-color: white; font-family: Roboto, sans-serif; font-size: 14px; line-height: 24px;">
<li style="margin: 0.5em 0px;">On “New Project” page, change “Application Name” to HelloAndroidJni, and leave the default values for other fields.<br /><img src="https://codelabs.developers.google.com/codelabs/android-studio-jni/img/img-3.png" style="max-width: 331px; vertical-align: bottom; width: 331px;" /></li>
<li style="margin: 0.5em 0px;">Click “Next” all the way to “Finish” to complete application creation.<br />This creates an Android “Hello World” Java app; your Android Studio looks like:<br /><img src="https://codelabs.developers.google.com/codelabs/android-studio-jni/img/img-4.png" style="max-width: 461px; vertical-align: bottom; width: 461px;" /></li>
<li style="margin: 0.5em 0px;">(Optional) Connect your Android Device with USB cable if you have device available; otherwise, create an Emulator when Android Studio prompts you in the next step.</li>
</ol>
<ol start="6" style="background-color: white; font-family: Roboto, sans-serif; font-size: 14px; line-height: 24px;">
<li style="margin: 0.5em 0px;">Sync <img src="https://codelabs.developers.google.com/codelabs/android-studio-jni/img/img-5.png" style="max-width: 22px; vertical-align: bottom; width: 22px;" />, Build <img src="https://codelabs.developers.google.com/codelabs/android-studio-jni/img/img-6.png" style="max-width: 21px; vertical-align: bottom; width: 21px;" /> and Run <img src="https://codelabs.developers.google.com/codelabs/android-studio-jni/img/img-7.png" style="max-width: 22px; vertical-align: bottom; width: 22px;" />, you will see the following on your target device or Emulator:<br /><img src="https://codelabs.developers.google.com/codelabs/android-studio-jni/img/img-8.png" style="max-width: 157px; vertical-align: bottom; width: 157px;" /></li>
<li style="margin: 0.5em 0px;">Configure the project to use gradle wrapper.<br />a) On Mac OS, menu “Android Studio” > “Preferences”.<br />b) On Linux, menu “File” > “Settings”.<br />c) Then “Build, Execution, Deployment” > “Build Tools” > “Gradle”.<br />d) Select “Use Default Gradle wrapper (recommended)”, click “OK”.<br /><img src="https://codelabs.developers.google.com/codelabs/android-studio-jni/img/img-9.png" style="max-width: 383px; vertical-align: bottom; width: 383px;" /></li>
</ol>
<ol start="8" style="background-color: white; font-family: Roboto, sans-serif; font-size: 14px; line-height: 24px;">
<li style="margin: 0.5em 0px;">Sync <img src="https://codelabs.developers.google.com/codelabs/android-studio-jni/img/img-5.png" style="max-width: 22px; vertical-align: bottom; width: 22px;" />, Build <img src="https://codelabs.developers.google.com/codelabs/android-studio-jni/img/img-6.png" style="max-width: 21px; vertical-align: bottom; width: 21px;" /> and Run <img src="https://codelabs.developers.google.com/codelabs/android-studio-jni/img/img-7.png" style="max-width: 22px; vertical-align: bottom; width: 22px;" />, you should see the same as in step 6.</li>
</ol>
</div>
Anonymoushttp://www.blogger.com/profile/16161990470673049263noreply@blogger.com0tag:blogger.com,1999:blog-4479053300163234685.post-71115221672628927212016-03-24T22:25:00.002-07:002016-03-24T22:25:40.239-07:00Top 10 Most Common Mobile App Design Mistakes<div dir="ltr" style="text-align: left;" trbidi="on">
source: <a href="https://www.toptal.com/designers/mobile/mobile-app-design-mistakes">https://www.toptal.com/designers/mobile/mobile-app-design-mistakes</a><br />
<br />
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
The mobile app market is saturated with competition. Trends turn over quickly, but no niche can last very long without several competitors jumping onto the bandwagon. These conditions result in a high failure rate across the board for the mobile app market. Only 20% of downloaded apps see users return after the first use, whereas 3% of apps remain in use after a month.</div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
If any part of an app is undesirable, or slow to get the hang of, users are more likely to install a new one, rather than stick it out with the imperfect product. Nothing is wasted for the consumer when disposing of an app - except for the efforts of the designers and developers, that is. So, why is it that so many apps fail? Is this a predictable phenomenon that <a href="https://www.toptal.com/designers/mobile" style="border: 0px; box-sizing: border-box; color: #3976cb; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">app designers</a> and <a href="https://www.toptal.com/developers" style="border: 0px; box-sizing: border-box; color: #3976cb; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">developers</a> should accept? For clients, is this success rate acceptable? What does it take to bring your designs into the top 3% of prosperous apps?</div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
The common mistakes span from failing to maintain consistency throughout the lifespan of an app, to attracting users in the first place. How can apps be designed with intuitive simplicity, without becoming repetitive and boring? How can an app offer pleasing details, without losing sight of a greater purpose? Most apps live and die in the first few days, so here are the top ten most common mistakes that designers can avoid.</div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
<img alt="Only 3% of mobile apps are in use after being downloaded." src="https://assets.toptal.io/uploads/blog/image/92275/toptal-blog-image-1458804788620-0bd03ae75c381c4cbf439008bd85ab6c.gif" style="border: 0px; box-sizing: border-box; display: block; margin: 0px auto 7px; max-width: 100%; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" /></div>
<div class="pop_out_box is-full_width is-big" style="background: rgb(250, 250, 250); border: 0px; box-sizing: border-box; color: #505050; float: none; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.3em; line-height: 1.5em; margin: 0px 30px 15px 0px; min-height: 0px; min-width: 0px; overflow: hidden; padding: 1em 1.5em; text-align: center; vertical-align: baseline; width: 864px;">
Only 3% of mobile apps are in use after being downloaded.</div>
<div class="tweet_this" style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 15px; line-height: 20px; margin: -10px 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; text-align: center; vertical-align: baseline;">
<iframe allowtransparency="true" class="twitter-share-button twitter-share-button-rendered twitter-tweet-button" data-url="https://www.toptal.com/designers/app/mobile-app-design-mistakes" frameborder="0" id="twitter-widget-4" scrolling="no" src="https://platform.twitter.com/widgets/tweet_button.64a917b4a230f163048902c783e1530f.en.html#dnt=false&id=twitter-widget-4&lang=en&original_referer=https%3A%2F%2Fwww.toptal.com%2Fdesigners%2Fmobile%2Fmobile-app-design-mistakes&size=m&text=Only%203%25%20of%20mobile%20apps%20are%20in%20use%20after%20being%20downloaded.&time=1458875839676&type=share&url=https%3A%2F%2Fwww.toptal.com%2Fdesigners%2Fapp%2Fmobile-app-design-mistakes&via=toptalllc" style="border-style: initial; border-width: 0px; box-sizing: border-box; height: 20px; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; position: static; vertical-align: baseline; visibility: visible; width: 61px;" title="Twitter Tweet Button"></iframe></div>
<h2 id="common-mistake-1-a-poor-first-impression" style="background-color: white; border: 0px; box-sizing: border-box; color: #3863a0; font-family: 'Proxima Nova', Arial, sans-serif; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Common Mistake #1: A Poor First Impression</h2>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Often the first use, or first day with an app, is the most critical period to hook a potential user. The first impression is so critical that it could be an umbrella point for the rest of this top ten. If anything goes wrong, or appears confusing or boring, potential users are quickly disinterested. Although, the proper balance for first impressions is tricky to handle. In some cases, a lengthy onboarding, or process to discover necessary features can bores users. Yet, an instantly stimulating app may disregard the need for a proper tutorial, and promote confusion. Find the balance between an app that is immediately intuitive, but also introduces the users to the most exciting, engaging features quickly. Keep in mind that when users are coming to your app, they’re seeing it for the first time. Go through a proper beta testing process to learn how others perceive your app from the beginning. What seems obvious to the design team, may not be for newcomers.</div>
<div>
<h2 id="common-mistake-2-designing-an-app-without-purpose" style="background-color: white; border: 0px; box-sizing: border-box; color: #3863a0; font-family: 'Proxima Nova', Arial, sans-serif; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Common Mistake #2: Designing an App Without Purpose</h2>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Avoid entering the design process without succinct intentions. Apps are often designed and developed in order to follow trends, rather than to solve a problem, fill a niche, or offer a distinct service. What is the ambition for the app? For the designer and their team, the sense of purpose will affect every step of a project. This sensibility will guide each decision from the branding or marketing of an app, to the wireframe format, and button aesthetic. If the purpose is clear, each piece of the app will communicate and function as a coherent whole. Therefore, have the design and development team continually consider their decisions within a greater goal. As the project progresses, the initial ambition may change. This is okay, as long as the vision remains coherent.</div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Conveying this vision to your potential users means that they will understand what value the app brings to their life. Thus, this vision is an important thing to communicate in a first impression. The question becomes how quickly can you convince users of your vision for the app? How it will improve a person’s life, or provide some sort of enjoyment or comfort. If this ambition is conveyed quickly, then as long as your app is in fact useful, it will make it into <a href="http://www.statista.com/statistics/276623/number-of-apps-available-in-leading-app-stores/" style="border: 0px; box-sizing: border-box; color: #3976cb; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;" target="_blank">the 3%</a>.</div>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Often joining a pre-existing market, or app niche, means that there are apps to study while designing your own. Thus, be careful how you choose to ‘re-purpose’ what is already out there. Study the existing app market, rather than skimming over it. Then, improve upon existing products with intent, rather than thoughtlessly imitating.</div>
<h2 id="common-mistake-3-missing-out-on-ux-design-mapping" style="background-color: white; border: 0px; box-sizing: border-box; color: #3863a0; font-family: 'Proxima Nova', Arial, sans-serif; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Common Mistake #3: Missing Out On UX Design Mapping</h2>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Be careful not to skip over a thoughtful planning of an app’s UX architecture before jumping into design work. Even before getting to a wireframing stage, the flow and structure of an app should be mapped out. Designers are often too excited to produce aesthetics and details. This results in a culture of designers who generally under appreciate UX, and the necessary logic or navigation within an app. Slow down. Sketch out the flow of the app first before worrying too much about the finer brush strokes. Often apps fail from an overarching lack of flow and organization, rather than imperfect details. However, once the design process takes off always keep the big picture in mind. The details and aesthetic should then clearly evoke the greater concept.</div>
<h2 id="common-mistake-4-disregarding-app-development-budget" style="background-color: white; border: 0px; box-sizing: border-box; color: #3863a0; font-family: 'Proxima Nova', Arial, sans-serif; line-height: 1.3em; margin: 2em 0px 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
Common Mistake #4: Disregarding App Development Budget</h2>
<div style="background-color: white; border: 0px; box-sizing: border-box; color: #303030; font-family: 'Proxima Nova', Arial, sans-serif; font-size: 1.2em; line-height: 1.5em; margin-bottom: 1em; min-height: 0px; min-width: 0px; padding: 0px; vertical-align: baseline;">
As soon as the basis of the app is sketched, this is a good time to get a budget from the development team. This way you don’t reach the end of the project and suddenly need to start cutting critical features. As your design career develops, always take note of the average costs of constructing your concepts so that your design thinking responds to economic restraints. Budgets should be useful design constraints to work within.</div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/16161990470673049263noreply@blogger.com0tag:blogger.com,1999:blog-4479053300163234685.post-16822367701116026812016-03-02T05:03:00.001-08:002016-03-02T05:03:06.318-08:00Image editing in android.<div dir="ltr" style="text-align: left;" trbidi="on">
source : <a href="http://www.shaikhhamadali.blogspot.in/p/home.html">http://www.shaikhhamadali.blogspot.in/p/home.html</a><br />
<h3 style="clear: both; color: #2c2c2c; font-size: 16px; letter-spacing: 1px; line-height: 1.4em; margin: 30px 0px 10px; text-align: center; text-transform: uppercase;">
<div>
<div class="separator" style="clear: both;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsEBAS-2yFUwHNHHqaySRh1_NdLev4QQDAKmuOB7YW-Em_6MrXzwavsRownz1xBwERrHMYIayQgU2J9y0EP9Tpo2hJHdyh6BRzIHfjkYZnaS-iHDKT0hznwPBTFcOjPXmn_wZzKDNprXg/s1600/android+basic.png" imageanchor="1" style="color: #3b8dbd; list-style: initial; margin-left: 1em; margin-right: 1em; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsEBAS-2yFUwHNHHqaySRh1_NdLev4QQDAKmuOB7YW-Em_6MrXzwavsRownz1xBwERrHMYIayQgU2J9y0EP9Tpo2hJHdyh6BRzIHfjkYZnaS-iHDKT0hznwPBTFcOjPXmn_wZzKDNprXg/s1600/android+basic.png" style="border: 0px; margin-bottom: 12px; max-width: 100%;" /></a></div>
</div>
<div class="separator" style="clear: both;">
</div>
<div>
<br /><span style="font-family: Verdana, sans-serif; font-size: x-small;"><b><a href="http://shaikhhamadali.blogspot.com/2013/10/what-is-android.html" style="color: #3b8dbd; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">WHAT IS ANDROID?</a></b></span><br /><span style="font-family: Verdana, sans-serif; font-size: x-small;"><a href="http://shaikhhamadali.blogspot.com/2014/05/android-timeline-from-2007.html" style="color: #3b8dbd; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">ANDROID TIMELINE FROM 2007 (DEVICES AND VERSIONS)</a></span></div>
<div>
<span style="color: #444444; font-family: Verdana, sans-serif; font-size: x-small; text-align: justify;"><a href="http://www.shaikhhamadali.blogspot.com/2012/11/create-first-program-hello-world-of.html" style="color: #3b8dbd; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;" target="_blank">1ST PROGRAM HELLO WORLD IN 10 STEPS</a></span><br /></div>
<span style="color: #444444; font-family: Verdana, sans-serif; text-align: justify;"></span><br /><div class="separator" style="clear: both;">
<span style="color: #444444; font-family: Verdana, sans-serif; text-align: justify;"></span></div>
<span style="color: #444444; font-family: Verdana, sans-serif; text-align: justify;"></span><br /><div>
<div class="separator" style="clear: both;">
</div>
<div class="separator" style="clear: both;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIIyjoVEqlaaF-Pc0QwOgF4OZMQhUIaGVs3c7RRyhxqi_inehbb09ne1C8W7VKgrozR2JYYrJ_qxC1_duCG9uDP6wpdI3vrxcG2A7MEWIQmutAkgeHSg9cgnJac8w8bAIHqzL7092jibQ/s1600/android+Beginners.png" imageanchor="1" style="color: #3b8dbd; list-style: initial; margin-left: 1em; margin-right: 1em; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIIyjoVEqlaaF-Pc0QwOgF4OZMQhUIaGVs3c7RRyhxqi_inehbb09ne1C8W7VKgrozR2JYYrJ_qxC1_duCG9uDP6wpdI3vrxcG2A7MEWIQmutAkgeHSg9cgnJac8w8bAIHqzL7092jibQ/s1600/android+Beginners.png" style="border: 0px; margin-bottom: 12px; max-width: 100%;" /></a></div>
</div>
<div>
<span style="font-family: Verdana, sans-serif; font-size: x-small;"><a href="http://www.shaikhhamadali.blogspot.com/2012/11/use-of-common-controls-in-android-text.html" style="color: #3b8dbd; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">INPUT CONTROLS (EDITTEXT, CHECKBOX,RADIOBUTTON,SEEKBAR AND BUTTONS )</a></span><br /><span style="font-family: Verdana, sans-serif; font-size: x-small;"><a href="http://www.shaikhhamadali.blogspot.com/2013/09/types-of-toast-android.html" style="color: #3b8dbd; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">TYPES OF TOAST</a></span><br /><span style="color: #444444; font-family: Verdana, sans-serif; font-size: x-small; text-align: left;"><a href="http://www.shaikhhamadali.blogspot.com/2013/09/types-of-dialogbox-android.html" style="color: #3b8dbd; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">TYPES OF DIALOGBOX</a></span></div>
<div>
<span style="color: #444444; font-family: Verdana, sans-serif; font-size: x-small; text-align: justify;"><a href="http://www.shaikhhamadali.blogspot.com/2013/06/how-to-apply-niccustom-format-to-edit.html" style="color: #3b8dbd; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">HOW TO APPLY NIC CUSTOM FORMAT TO EDIT TEXT</a></span><br /><span style="color: #444444; font-family: Verdana, sans-serif; font-size: x-small; text-align: left;"><a href="http://www.shaikhhamadali.blogspot.com/2013/09/auto-link-text-links-with-text-view.html" style="color: #3b8dbd; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">AUTO LINK TEXT LINKS WITH TEXT VIEW (LINKIFY)</a></span><br /><b style="font-family: Verdana, sans-serif; text-align: left;"><a href="http://www.shaikhhamadali.blogspot.com/2013/10/make-call-using-intent-android.html" style="color: #3b8dbd; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;"><span style="font-size: x-small;">MAKE CALL USING INTENT</span></a></b><br /><span style="font-family: Verdana, sans-serif; font-size: x-small;"><a href="http://shaikhhamadali.blogspot.com/2014/02/auto-complete-textview.html" style="color: #3b8dbd; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">AUTO COMPLETE TEXTVIEW / AUTOCOMPLETETEXTVIEW IN ANDROID </a></span><br /><span style="font-family: Verdana, sans-serif; font-size: x-small; font-weight: normal;"><a href="http://shaikhhamadali.blogspot.com/2014/04/list-view.html" style="color: #3b8dbd; font-weight: bold; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">LISTVIEW FROM ARRAY AND ARRAY STRINGS</a></span><br /></div>
<ol style="margin: 0px 0px 1.625em 2.5em; text-align: left;"></ol>
</h3>
<h3 style="clear: both; color: #2c2c2c; font-size: 16px; letter-spacing: 1px; line-height: 1.4em; margin: 30px 0px 10px; text-align: center; text-transform: uppercase;">
</h3>
<h3 style="clear: both; color: #2c2c2c; font-size: 16px; letter-spacing: 1px; line-height: 1.4em; margin: 30px 0px 10px; text-align: center; text-transform: uppercase;">
<div class="separator" style="clear: both;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRZCld3p3aWf2wrqvTEy7Xb8T_nW5aBx4DN92-9Sn5pMj9JE58vDbTCby97tjGO0CYqwD2DlfIwF6HwLFutDT91IV-1PE50j26GjaZlKnD32NaLvEwDgEl4uCqZl7o2Hw3V77EdNKK6gk/s1600/android+advanced.png" imageanchor="1" style="color: #3b8dbd; list-style: initial; margin-left: 1em; margin-right: 1em; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;"></a></div>
<div>
</div>
<div class="separator" style="clear: both;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSQL6gMyCKEGO7FbIgfMn55NNyFhy6ouau1nq9oDoz1_3hCny-9eiHqbrG_tRRCP_weFp64szuUJNPTzczFSbLwctsTAQD6iM2MAsRk0MxPQ0tTfeZSYNJC_MHmB9BrEn-RYTDaEaeoZY/s1600/android+advanced.png" imageanchor="1" style="color: #3b8dbd; list-style: initial; margin-left: 1em; margin-right: 1em; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSQL6gMyCKEGO7FbIgfMn55NNyFhy6ouau1nq9oDoz1_3hCny-9eiHqbrG_tRRCP_weFp64szuUJNPTzczFSbLwctsTAQD6iM2MAsRk0MxPQ0tTfeZSYNJC_MHmB9BrEn-RYTDaEaeoZY/s1600/android+advanced.png" style="border: 0px; margin-bottom: 12px; max-width: 100%;" /></a></div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
<b><span style="font-size: x-small;"><a href="http://www.shaikhhamadali.blogspot.ro/2013/06/load-imaege-from-url.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: justify; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;"><span style="color: #444444;">LOAD AN IMAGE FROM URL</span></a><span style="color: #444444; font-family: Verdana, sans-serif; text-align: justify;"> </span></span></b></div>
<div>
<a href="http://www.shaikhhamadali.blogspot.ro/2013/06/gray-scale-image-in-imageview-android.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: justify; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;"><b><span style="font-size: x-small;">INVERT THE IMAGE IN IMAGEVIEW</span></b></a></div>
<div>
<a href="http://www.shaikhhamadali.blogspot.ro/2013/08/image-rotaion-in-imageview-android.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: justify; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;"><b><span style="font-size: x-small;">IMAGE ROTAION IN IMAGEVIEW</span></b></a></div>
<div>
<a href="http://www.shaikhhamadali.blogspot.ro/2013/08/image-flipping-mirroring-in-imageview.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: justify; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;"><b><span style="font-size: x-small;">IMAGE FLIPPING (MIRRORING) IN IMAGEVIEW</span></b></a></div>
<div>
<a href="http://www.shaikhhamadali.blogspot.ro/2013/08/round-corner-image-in-imageview-android.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: justify; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;"><b><span style="font-size: x-small;">ROUND CORNER THE IMAGE IN IMAGEVIEW</span></b></a></div>
<div>
<a href="http://www.shaikhhamadali.blogspot.ro/2013/08/water-mark-image-in-imageview-android.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: justify; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;"><b><span style="font-size: x-small;">WATER MARK THE IMAGE IN IMAGEVIEW</span></b></a></div>
<div>
<a href="http://www.shaikhhamadali.blogspot.ro/2013/08/changereplacementremove-pixel-colors-in.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: justify; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;"><b><span style="font-size: x-small;">CHANGE/ REPLACEMENT/ REMOVE PIXEL COLORS IN IMAGEVIEW</span></b></a></div>
<div>
<a href="http://www.shaikhhamadali.blogspot.ro/2013/08/text-on-curve-android.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: justify; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;"><b><span style="font-size: x-small;">DRAW TEXT ON CURVE</span></b></a></div>
<div>
<a href="http://www.shaikhhamadali.blogspot.com/2013/09/types-of-toast-part-two-custom.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: left; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;"><b><span style="font-size: x-small;">TYPES OF TOAST PART TWO (CUSTOM TOAST)</span></b></a></div>
<div>
<a href="http://www.shaikhhamadali.blogspot.com/2013/09/types-of-dialogbox-part-two-custom.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: left; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;"><b><span style="font-size: x-small;">TYPES OF DIALOGBOX PART TWO (CUSTOM DIALOGBOX)</span></b></a></div>
<div>
<a href="http://shaikhhamadali.blogspot.com/2013/10/take-snapshot-of-application-android.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: left; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;"><b><span style="font-size: x-small;">TAKE SNAPSHOT OF APPLICATION</span></b></a></div>
<div>
<a href="http://shaikhhamadali.blogspot.com/2013/09/capture-images-using-intent-android.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: left; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;"><b><span style="font-size: x-small;">CAPTURE IMAGES USING INTENT</span></b></a></div>
<div>
<b style="font-family: Verdana, sans-serif; text-align: left;"><a href="http://shaikhhamadali.blogspot.com/2013/09/capture-images-and-crop-images-using.html" style="color: #3b8dbd; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;"><span style="font-size: x-small;">CAPTURE AND CROP IMAGES USING INTENT</span></a></b><br /><span style="font-family: Verdana, sans-serif; font-size: x-small;"><a href="http://shaikhhamadali.blogspot.com/2014/02/voice-recognition-web-search-using.html" style="color: #3b8dbd; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">VOICE SEARCH SPEECH RECOGNITION AND WEB SEARCH USING INTENT </a></span><br /><span style="font-family: Verdana, sans-serif; font-size: x-small;"><a href="http://shaikhhamadali.blogspot.com/2014/04/image-attachment-email-using.html" style="color: #3b8dbd; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">SEND EMAIL USING INTENT ( TEXT+SIGNATURE AND IMAGE )</a></span><br /><span style="font-family: Verdana, sans-serif; font-size: x-small;"><a href="http://shaikhhamadali.blogspot.com/2014/04/device-information.html" style="color: #3b8dbd; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">GET DEVICE INFORMATION (OS, FINGER PRINT, IP, MAC ADDRESS, MANUFACTURER, VERSION ETC).</a></span><br /><span style="font-family: Verdana, sans-serif; font-size: x-small;"><a href="http://shaikhhamadali.blogspot.com/2014/05/text-to-speech-engine.html" style="color: #3b8dbd; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">TEXT TO SPEECH ENGINE WITH PITCH AND SPEECH RATE ADJUSTMENT SETTINGS</a></span></div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
</div>
<div class="separator" style="clear: both;">
</div>
<br /><a href="https://www.blogger.com/null" name="more" style="color: #3b8dbd; list-style: initial; white-space: pre-wrap; word-wrap: break-word;"></a></h3>
<h4 style="clear: both; color: #2c2c2c; font-size: 15px; line-height: 1.4em; margin: 30px 0px 10px;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjHWeipIybIWIj9P3nZce2Z452fO8trrGJMhiPsRRYU0uB2nlrnDgOmmO8gXv4KeQHrMseASKFr1X1GQjUQKktTpApmOBK3KLuBU_kvps2FAGpm2fkRMr7nqCL6gbcPmP_pa54SvE_GH8/s1600/android+image+effects.png" imageanchor="1" style="color: #3b8dbd; list-style: initial; margin-left: 1em; margin-right: 1em; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;"><img border="0" height="100" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjHWeipIybIWIj9P3nZce2Z452fO8trrGJMhiPsRRYU0uB2nlrnDgOmmO8gXv4KeQHrMseASKFr1X1GQjUQKktTpApmOBK3KLuBU_kvps2FAGpm2fkRMr7nqCL6gbcPmP_pa54SvE_GH8/s200/android+image+effects.png" style="border: 0px; margin-bottom: 12px; max-width: 100%;" width="100" /></a> <span style="font-family: Verdana, sans-serif; font-size: medium;"><u>Image Effects:</u></span></h4>
<h3 style="clear: both; color: #2c2c2c; font-size: 16px; letter-spacing: 1px; line-height: 1.4em; margin: 30px 0px 10px; text-align: center; text-transform: uppercase;">
<div class="separator" style="clear: both;">
<br /></div>
<div class="" style="clear: both;">
<div style="text-align: left;">
</div>
<ul style="color: #333333; font-size: 15px; list-style: none; margin: 0px; padding: 0px; text-align: left;">
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><a href="http://www.shaikhhamadali.blogspot.com/2013/06/image-with-reflection-in-image-view.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: justify; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">IMAGE WITH REFLECTION IN IMAGEVIEW</a></li>
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><a href="http://www.shaikhhamadali.blogspot.ro/2013/06/highlightfocusshadow-image-in-imageview.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: justify; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">HIGHLIGHT/ FOCUS/ SHADOW THE IMAGE IN IMAGEVIEW</a></li>
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><a href="http://www.shaikhhamadali.blogspot.ro/2013/06/gray-scale-image-in-imageview-android_29.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: justify; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">GRAY SCALE THE IMAGE IN IMAGEVIEW</a></li>
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><a href="http://www.shaikhhamadali.blogspot.ro/2013/06/before-gamma-correction-after-gamma.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: justify; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">SET GAMMA OF IMAGE IN IMAGEVIEW</a></li>
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><a href="http://www.shaikhhamadali.blogspot.ro/2013/07/sepia-toning-effect-photography-of.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: justify; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">SEPIA-TONING EFFECT (PHOTOGRAPHY) OF IMAGE IN IMAGEVIEW</a></li>
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><a href="http://www.shaikhhamadali.blogspot.ro/2013/07/reducing-color-depth-of-image-in.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: justify; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">REDUCING COLOR DEPTH OF IMAGE IN IMAGEVIEW</a></li>
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><a href="http://www.shaikhhamadali.blogspot.ro/2013/07/bw-contrast-and-color-contrast-image-in.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: justify; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">B/W CONTRAST AND COLOR CONTRAST THE IMAGE IN IMAGEVIEW</a></li>
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><a href="http://www.shaikhhamadali.blogspot.ro/2013/07/set-brightness-of-imageincreasedecrease.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: justify; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">SET BRIGHTNESS OF THE IMAGE(INCREASE,DECREASE) IN IMAGEVIEW</a></li>
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><a href="http://www.shaikhhamadali.blogspot.ro/2013/07/color-boost-imagebitmap-in-imageview.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: justify; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">COLOR BOOST THE IMAGE(BITMAP) IN IMAGEVIEW</a></li>
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><a href="http://www.shaikhhamadali.blogspot.ro/2013/07/convolution-matrix-for-image-processing.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: justify; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">CONVOLUTION MATRIX FOR IMAGE PROCESSING</a></li>
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><a href="http://www.shaikhhamadali.blogspot.ro/2013/07/gaussian-blur-imagebitmap-in-imageview.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: justify; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">GAUSSIAN BLUR THE IMAGE(BITMAP) IN IMAGEVIEW</a></li>
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><a href="http://www.shaikhhamadali.blogspot.ro/2013/07/set-sharpness-of-image-in-imageview.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: justify; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">SET SHARPNESS OF THE IMAGE IN IMAGEVIEW</a></li>
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><a href="http://www.shaikhhamadali.blogspot.ro/2013/07/mean-removal-effect-on-image-in.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: justify; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">MEAN REMOVAL EFFECT ON IMAGE IN IMAGEVIEW</a></li>
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><a href="http://www.shaikhhamadali.blogspot.ro/2013/07/smooth-effect-on-image-in-imageview.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: justify; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">SMOOTH EFFECT ON IMAGE IN IMAGEVIEW</a></li>
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><a href="http://www.shaikhhamadali.blogspot.ro/2013/07/emboss-effect-on-image-in-imageview.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: justify; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">EMBOSS EFFECT ON IMAGE IN IMAGEVIEW</a></li>
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><a href="http://www.shaikhhamadali.blogspot.ro/2013/07/engraving-effect-on-image-in-imageview.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: justify; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">ENGRAVING EFFECT ON IMAGE IN IMAGEVIEW</a></li>
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><a href="http://www.shaikhhamadali.blogspot.ro/2013/07/before-hue-filter-effect-after-hue.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: justify; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">HUE FILTER EFFECT ON IMAGE IN IMAGEVIEW</a></li>
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><a href="http://www.shaikhhamadali.blogspot.ro/2013/07/saturation-filter-effect-on-image-in.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: justify; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">SATURATION FILTER EFFECT ON IMAGE IN IMAGEVIEW</a></li>
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><a href="http://www.shaikhhamadali.blogspot.ro/2013/08/shading-filter-effect-on-image-in.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: justify; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">SHADING FILTER EFFECT ON IMAGE IN IMAGEVIEW</a></li>
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><a href="http://www.shaikhhamadali.blogspot.ro/2013/08/flea-effect-noise-effect-on-image-in.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: justify; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">FLEA EFFECT (NOISE EFFECT) ON IMAGE IN IMAGEVIEW</a></li>
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><a href="http://www.shaikhhamadali.blogspot.ro/2013/08/tint-color-effect-on-image-in-imageview.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: justify; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">TINT COLOR EFFECT ON IMAGE IN IMAGEVIEW</a></li>
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><a href="http://www.shaikhhamadali.blogspot.ro/2013/08/dark-effect-on-image-in-imageview.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: justify; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">DARK EFFECT ON IMAGE IN IMAGEVIEW</a></li>
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><a href="http://www.shaikhhamadali.blogspot.ro/2013/08/snow-falling-effect-on-image-in.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: justify; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">SNOW FALLING EFFECT ON IMAGE IN IMAGEVIEW</a></li>
</ul>
</div>
<div class="separator" style="clear: both;">
<br /></div>
</h3>
<h4 style="clear: both; color: #2c2c2c; font-size: 15px; line-height: 1.4em; margin: 30px 0px 10px;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUCkA3eCvTuNSbR-669bL7xVOJQn971izn3qOsqH2xtQTZeQfqgn2S-vfP0fSc3fds80JtsR944XTu_664Ot0dnKc_AVv6bcRzkKlfimqzjaUCPR8ZLrM_H9CjfegSiZ_u-3LJzXFqv70/s1600/android+error.png" imageanchor="1" style="color: #3b8dbd; list-style: initial; margin-left: 1em; margin-right: 1em; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;"><img border="0" height="100" src="http://i1023.photobucket.com/albums/af358/shaikhhamadali/Android-errors_zps64ff396f.png" style="border: 0px; margin-bottom: 12px; max-width: 100%;" width="100" /></a><u style="font-family: Verdana, sans-serif; font-size: x-large;"><b>Android Errors:</b></u></h4>
<h3 style="clear: both; color: #2c2c2c; font-size: 16px; letter-spacing: 1px; line-height: 1.4em; margin: 30px 0px 10px; text-align: center; text-transform: uppercase;">
<div style="text-align: left;">
</div>
<div>
<span style="color: #444444; font-family: Verdana, sans-serif;"><br /></span><br /><div style="text-align: left;">
<ul style="color: #333333; font-size: 15px; list-style: none; margin: 0px; padding: 0px;">
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><span style="background-color: white; color: #404040; line-height: 18.2px;"><span style="font-family: Verdana, sans-serif; font-size: x-small;"><a href="http://shaikhhamadali.blogspot.com/2014/04/ten-common-errors-and-their-reasons.html" style="color: #3b8dbd; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">TEN COMMON EXCEPTIONS AND THEIR REASONS</a></span></span></li>
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><span style="color: #444444; font-family: Verdana, sans-serif;"><b><a href="http://www.shaikhhamadali.blogspot.com/2013/08/memory-leak-and-out-of-memory-error.html" style="color: #3b8dbd; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;" target="_blank">MEMORY LEAK AND OUT OF MEMORY ERROR</a></b></span></li>
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><span style="color: #444444; font-family: Verdana, sans-serif;"><a href="http://www.shaikhhamadali.blogspot.ro/2013/09/memory-leak-and-out-of-memory-error.html" style="color: #3b8dbd; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;" target="_blank">MEMORY LEAK AND OUT OF MEMORY ERROR USING LRU CACHE</a></span></li>
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><span style="color: #444444; font-family: Verdana, sans-serif;"><a href="http://www.shaikhhamadali.blogspot.com/2013/09/memory-leak-and-out-of-memory-error_3.html" style="color: #3b8dbd; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">MEMORY LEAK AND OUT OF MEMORY ERROR USING DISK LRU CACHE</a></span></li>
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><span style="color: #444444; font-family: Verdana, sans-serif;"><a href="http://www.shaikhhamadali.blogspot.com/2013/08/memory-leak-and-out-of-memory-error_29.html" style="color: #3b8dbd; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;" target="_blank"><span style="color: #444444;"><b>MEMORY LEAK AND OUT OF MEMORY ERROR USING LIST,LINKEDLIST AND HASHMAP</b></span></a> </span></li>
</ul>
</div>
</div>
<div class="separator" style="clear: both;">
</div>
<br /><div class="separator" style="clear: both; text-align: left;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivwRR0bn8uyK_-Gx1i1zRcG2AyRf8qcZYtfzPqQwW0uXTEao-eGFLhSmY60aHIDebyONUq0Wfu0noOaqF7JCogu4vihr5GZKn3ryMPIh-uJDwfHBAqT4SR1nfHO0OLO6cPtdCtcBzB0Sc/s1600/android+settings.png" imageanchor="1" style="color: #3b8dbd; list-style: initial; margin-left: 1em; margin-right: 1em; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;"><img border="0" height="100" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivwRR0bn8uyK_-Gx1i1zRcG2AyRf8qcZYtfzPqQwW0uXTEao-eGFLhSmY60aHIDebyONUq0Wfu0noOaqF7JCogu4vihr5GZKn3ryMPIh-uJDwfHBAqT4SR1nfHO0OLO6cPtdCtcBzB0Sc/s320/android+settings.png" style="border: 0px; margin-bottom: 12px; max-width: 100%;" width="100" /></a><u style="font-family: Verdana, sans-serif; font-size: x-large;"><b>CHANGE SETTINGS:</b></u></div>
<br /><div>
<div style="font-family: Verdana, sans-serif; text-align: left;">
</div>
<ul style="color: #333333; font-size: 15px; list-style: none; margin: 0px; padding: 0px; text-align: left;">
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-family: Verdana, sans-serif; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><a href="http://www.shaikhhamadali.blogspot.com/2013/09/enabledisable-mobile-data-gprsandroid.html" style="color: #3b8dbd; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">ENABLE/DISABLE MOBILE DATA (GPRS)</a></li>
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-family: Verdana, sans-serif; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><a href="http://www.shaikhhamadali.blogspot.com/2013/09/bluetooth-android.html" style="color: #3b8dbd; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">BLUETOOTH PART ONE</a></li>
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-family: Verdana, sans-serif; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><b style="background-color: white;"><a href="http://www.shaikhhamadali.blogspot.com/2013/09/enabledisable-bluetooth-android.html" style="color: #3b8dbd; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">BLUETOOTH PART TWO (ENABLE/ DISABLE)</a></b></li>
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><span style="font-family: Verdana, sans-serif;"><a href="http://shaikhhamadali.blogspot.com/2014/04/list-of-paired-devices.html" style="color: #3b8dbd; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">GET LIST OF PAIRED DEVICES AND THEIR MAJOR DEVICE CLASS</a></span></li>
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-family: Verdana, sans-serif; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><b><a href="http://www.shaikhhamadali.blogspot.com/2013/09/control-airplane-mode-onoff-android.html" style="color: #3b8dbd; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">CONTROL AIRPLANE MODE (ON/OFF)</a></b></li>
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><span style="font-family: Verdana, sans-serif; font-size: x-small;"><a href="http://shaikhhamadali.blogspot.com/2014/05/ringer-mode-silent-vibrate-normal.html" style="color: #3b8dbd; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">CHANGE RINGER MODE SILENT,VIBRATE AND RINGING</a></span></li>
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><a href="http://shaikhhamadali.blogspot.com/2014/05/volume-brightness-with-seekbar.html" style="color: #3b8dbd; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">CHANGE VOLUME AND BRIGHTNESS USING SEEKBAR</a></li>
</ul>
</div>
</h3>
<h4 style="clear: both; color: #2c2c2c; font-size: 15px; line-height: 1.4em; margin: 30px 0px 10px;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUGE6Ov6jQME2Y5UezwKiAbVLHBpzaJIKEbuoksX0h687rQGnOIlwWWsQJdrtnaSfctPySQU79CUiYjf3qyQH_IQpXD65Zvp3PEeiSTznh2tSMQiBGBHW2fbQjt3VqqyzkULh8wktuF78/s1600/telephony.png" imageanchor="1" style="color: #3b8dbd; list-style: initial; margin-left: 1em; margin-right: 1em; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;"><img border="0" height="100" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUGE6Ov6jQME2Y5UezwKiAbVLHBpzaJIKEbuoksX0h687rQGnOIlwWWsQJdrtnaSfctPySQU79CUiYjf3qyQH_IQpXD65Zvp3PEeiSTznh2tSMQiBGBHW2fbQjt3VqqyzkULh8wktuF78/s200/telephony.png" style="border: 0px; margin-bottom: 12px; max-width: 100%;" width="100" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjS3ETbZZ5eAW4DdJ8h8hLvIBaaZ1NhkM1BmsUXPyvfUmk9rsKrTCyMiRhnaC4r0u3T_w9oJHmGtIujt9enYP7NiqeTKZ6Yrsln-ix8Ah3zos6czH6EaCUvDK8UlfiypIptGiRTi8lgTy8/s1600/android+NFC.png" imageanchor="1" style="clear: left; color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; margin-bottom: 1em; margin-left: 1em; text-align: center; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;"><u style="text-align: left;"><b><span style="color: black; font-size: medium;">Telephony:</span></b></u></a></h4>
<h3 style="clear: both; color: #2c2c2c; font-size: 16px; letter-spacing: 1px; line-height: 1.4em; margin: 30px 0px 10px; text-align: center; text-transform: uppercase;">
<div>
<br /></div>
<div>
<div style="text-align: left;">
</div>
<ul style="color: #333333; font-size: 15px; list-style: none; margin: 0px; padding: 0px; text-align: left;">
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><a href="http://www.shaikhhamadali.blogspot.com/2013/09/send-and-track-sms-android.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">SEND AND TRACK SMS</a></li>
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><a href="http://www.shaikhhamadali.blogspot.com/2013/09/receivereadsender-numbernamemessage-sms.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">RECEIVE AND READ SMS(SENDER NUMBER + NAME,SMS)</a></li>
</ul>
<br /><div class="separator" style="clear: both; text-align: left;">
<br /></div>
</div>
</h3>
<h4 style="clear: both; color: #2c2c2c; font-size: 15px; line-height: 1.4em; margin: 30px 0px 10px;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9NkPfpX-y-129xlYSFclM-QaBPynMmjjTZZtM9ifssk_1hT6WHRQW873QXs2HHUc8z_Q8Rp0cO2uWsgNc2Bn057tdqVVlRvJ86lzfKCbiAsJI3TL1MPymXAzIpFFBsoi_y8IFjfeAedE/s1600/android+NFC.png" imageanchor="1" style="color: #3b8dbd; list-style: initial; margin-left: 1em; margin-right: 1em; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;"><img border="0" height="100" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9NkPfpX-y-129xlYSFclM-QaBPynMmjjTZZtM9ifssk_1hT6WHRQW873QXs2HHUc8z_Q8Rp0cO2uWsgNc2Bn057tdqVVlRvJ86lzfKCbiAsJI3TL1MPymXAzIpFFBsoi_y8IFjfeAedE/s200/android+NFC.png" style="border: 0px; margin-bottom: 12px; max-width: 100%;" width="100" /></a><u style="clear: left; font-family: Verdana, sans-serif; margin-bottom: 1em; margin-left: 1em;"><b><span style="color: black; font-size: medium;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjS3ETbZZ5eAW4DdJ8h8hLvIBaaZ1NhkM1BmsUXPyvfUmk9rsKrTCyMiRhnaC4r0u3T_w9oJHmGtIujt9enYP7NiqeTKZ6Yrsln-ix8Ah3zos6czH6EaCUvDK8UlfiypIptGiRTi8lgTy8/s1600/android+NFC.png" imageanchor="1" style="clear: left; color: #3b8dbd; list-style: initial; margin-bottom: 1em; margin-left: 1em; text-align: center; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;"><span style="color: black;">NFC:</span></a></span></b></u></h4>
<h3 style="clear: both; color: #2c2c2c; font-size: 16px; letter-spacing: 1px; line-height: 1.4em; margin: 30px 0px 10px; text-align: center; text-transform: uppercase;">
<div>
</div>
<ul style="color: #333333; font-size: 15px; list-style: none; margin: 0px; padding: 0px;">
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px; text-align: justify;"><a href="http://www.shaikhhamadali.blogspot.com/2013/09/near-field-communication-nfc-android.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: left; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">NEAR FIELD COMMUNICATION (NFC) PART ONE</a></li>
<li style="background-attachment: scroll; background-clip: initial; background-image: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif"); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px; text-align: justify;"><a href="http://shaikhhamadali.blogspot.com/2013/10/near-field-communication-nfc-android.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-align: left; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">NEAR FIELD COMMUNICATION (NFC) PART TWO</a></li>
</ul>
</h3>
<h4 style="clear: both; color: #2c2c2c; font-size: 15px; line-height: 1.4em; margin: 30px 0px 10px;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKCKpDLhfCYIgwiHUdKpyuT6JoeJbDbEaS73ehlplVI7PJj4xEXk7UPQP9aUL9yl5oaUt89rRUh4sIY5VyS4Wsy2yEXoiAhD76w27EG7Ti1-HJGAMceenF2t4h2I-menhh8uXaRkWv4HE/s1600/android+sensors.png" imageanchor="1" style="color: #3b8dbd; list-style: initial; margin-left: 1em; margin-right: 1em; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;"><img border="0" height="100" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKCKpDLhfCYIgwiHUdKpyuT6JoeJbDbEaS73ehlplVI7PJj4xEXk7UPQP9aUL9yl5oaUt89rRUh4sIY5VyS4Wsy2yEXoiAhD76w27EG7Ti1-HJGAMceenF2t4h2I-menhh8uXaRkWv4HE/s320/android+sensors.png" style="border: 0px; margin-bottom: 12px; max-width: 100%;" width="100" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjS3ETbZZ5eAW4DdJ8h8hLvIBaaZ1NhkM1BmsUXPyvfUmk9rsKrTCyMiRhnaC4r0u3T_w9oJHmGtIujt9enYP7NiqeTKZ6Yrsln-ix8Ah3zos6czH6EaCUvDK8UlfiypIptGiRTi8lgTy8/s1600/android+NFC.png" imageanchor="1" style="clear: left; color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; margin-bottom: 1em; margin-left: 1em; text-align: center; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;"><u style="text-align: left;"><b><span style="color: black; font-size: medium;">Sensors:</span></b></u></a></h4>
<h3 style="clear: both; color: #2c2c2c; font-size: 16px; letter-spacing: 1px; line-height: 1.4em; margin: 30px 0px 10px; text-align: center; text-transform: uppercase;">
<br style="background-color: white; font-family: Helvetica, Arial, sans-serif; line-height: 22.4px;" /><div style="background-color: white; font-family: Helvetica, Arial, sans-serif; line-height: 22.4px;">
<div style="text-align: left;">
</div>
<ul style="color: #333333; font-size: 15px; list-style: none; margin: 0px; padding: 0px; text-align: left;">
<li style="background: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif") 0px 4px no-repeat scroll transparent; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><a href="http://shaikhhamadali.blogspot.com/2013/10/android-sensorsandroid.html" style="color: #3b8dbd; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;"><span style="font-family: Verdana, sans-serif;">ANDROID SENSORS</span></a></li>
<li style="background: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif") 0px 4px no-repeat scroll transparent; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><b style="font-family: Verdana, sans-serif;"><a href="http://shaikhhamadali.blogspot.com/2013/10/list-of-sensors-availble-in-device.html" style="color: #3b8dbd; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">LIST OF SENSORS AVAILBLE IN DEVICE</a></b></li>
<li style="background: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif") 0px 4px no-repeat scroll transparent; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><b style="font-family: Verdana, sans-serif;"><a href="http://shaikhhamadali.blogspot.com/2014/02/get-details-of-sensor-gravity-sensor.html" style="color: #3b8dbd; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">GET DETAILS OF SENSORS (GRAVITY SENSOR)</a></b></li>
<li style="background: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif") 0px 4px no-repeat scroll transparent; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><b><a href="http://shaikhhamadali.blogspot.com/2013/10/android-sensors-accelerometer-android.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">ANDROID SENSOR(ACCELEROMETER)</a><span style="font-family: Verdana, sans-serif;"> </span></b></li>
<li style="background: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif") 0px 4px no-repeat scroll transparent; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><b><a href="http://shaikhhamadali.blogspot.com/2013/10/android-sensor-pressure-sensor.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">ANDROID SENSOR(PRESSURE BAROMETER)</a><span style="font-family: Verdana, sans-serif;"> </span></b></li>
<li style="background: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif") 0px 4px no-repeat scroll transparent; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><a href="http://www.shaikhhamadali.blogspot.com/2013/10/android-sensorlight-sensor.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">ANDROID SENSOR(LIGHT SENSOR)</a></li>
<li style="background: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif") 0px 4px no-repeat scroll transparent; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><a href="http://www.shaikhhamadali.blogspot.com/2013/10/android-sensor-proximity-sensor.html" style="color: #3b8dbd; font-family: Verdana, sans-serif; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">ANDROID SENSOR(PROXIMITY SENSOR)</a></li>
<li style="background: url("http://i1023.photobucket.com/albums/af358/shaikhhamadali/arrow_green_zps4a2f81f9.gif") 0px 4px no-repeat scroll transparent; color: #777777; font-size: 13px; line-height: 1.4em; list-style: none; margin: 0.3em 0px; padding: 0px 0px 0.8em 20px;"><b style="font-family: Verdana, sans-serif; line-height: 18px;"><a href="http://shaikhhamadali.blogspot.com/2013/11/android-sensor-magnetic-feild-and.html" style="color: #3b8dbd; list-style: initial; text-decoration: none; white-space: pre-wrap; word-wrap: break-word;">ANDROID SENSOR CREATE COMPAS(USING MAGNETIC FEILD/ ACCELEROMETER SENSORS )</a></b></li>
<li></li>
</ul>
</div>
<div style="background-color: white; font-family: Helvetica, Arial, sans-serif; line-height: 22.4px;">
</div>
</h3>
</div>
Anonymoushttp://www.blogger.com/profile/16161990470673049263noreply@blogger.com2tag:blogger.com,1999:blog-4479053300163234685.post-75147015183753897892016-02-26T00:33:00.004-08:002016-02-26T00:33:47.986-08:00Android app development guideline. <div dir="ltr" style="text-align: left;" trbidi="on">
source: <a href="https://github.com/codepath/android_guides/wiki">https://github.com/codepath/android_guides/wiki</a><br />
<h1 style="background-color: white; border-bottom-color: rgb(238, 238, 238); border-bottom-style: solid; border-bottom-width: 1px; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 2.25em; line-height: 1.2; margin-bottom: 16px; margin-left: 0px; margin-right: 0px; margin-top: 0px !important; padding-bottom: 0.3em;">
CodePath Android Cliffnotes</h1>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; line-height: 25.6px; margin-bottom: 16px;">
Welcome to the open-source <a href="http://codepath.com/" style="background-color: transparent; box-sizing: border-box; color: #4078c0; text-decoration: none;">CodePath</a> Android Cliffnotes! Our goal is to become the <strong style="box-sizing: border-box;">central crowdsourced resource</strong> for complete and up-to-date practical Android developer guides for any topic. <a class="internal present" href="https://github.com/codepath/android_guides/wiki/Home#getting-started" style="background-color: transparent; box-sizing: border-box; color: #4078c0; text-decoration: none;">Just take me to the notes</a>!</div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; line-height: 25.6px; margin-bottom: 16px;">
<a href="http://codepath.com/" style="background-color: transparent; box-sizing: border-box; color: #4078c0; text-decoration: none;"><img alt="CodePath" data-canonical-src="https://i.imgur.com/XgxWfyF.png" src="https://camo.githubusercontent.com/be3b1262c26ff23b3480c07c4b13ca1d01355a73/68747470733a2f2f692e696d6775722e636f6d2f586778576679462e706e67" style="border: 0px; box-sizing: content-box; max-width: 100%;" /></a></div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; line-height: 25.6px; margin-bottom: 16px;">
We have Android guides for everyone whether you are a <strong style="box-sizing: border-box;">beginner, intermediate or expert</strong>. Want to learn how to <a class="internal present" href="https://github.com/codepath/android_guides/wiki/Defining-The-ActionBar" style="background-color: transparent; box-sizing: border-box; color: #4078c0; text-decoration: none;">use the ActionBar</a> or the <a class="internal present" href="https://github.com/codepath/android_guides/wiki/Creating-and-Using-Fragments" style="background-color: transparent; box-sizing: border-box; color: #4078c0; text-decoration: none;">ins and outs of fragments</a>? We got that. Want to learn<a class="internal present" href="https://github.com/codepath/android_guides/wiki/Unit-Testing-with-Robolectric" style="background-color: transparent; box-sizing: border-box; color: #4078c0; text-decoration: none;">about automated unit testing</a> or how to <a class="internal present" href="https://github.com/codepath/android_guides/wiki/Flexible-User-Interfaces" style="background-color: transparent; box-sizing: border-box; color: #4078c0; text-decoration: none;">build flexible user interfaces for multiple devices</a>? We got you covered. We don't waste time with the "theoretical approach" you might get from a book. We cover <strong style="box-sizing: border-box;">exactly the things we use every day</strong> as we are developing apps for contracts.</div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; line-height: 25.6px; margin-bottom: 16px;">
<strong style="box-sizing: border-box;">Need Help?</strong> Please join this <a href="https://gitter.im/thecodepath/public" style="background-color: transparent; box-sizing: border-box; color: #4078c0; text-decoration: none;">gitter real-time chat</a> or the <a href="https://groups.google.com/forum/#!forum/codepath-android-guides" style="background-color: transparent; box-sizing: border-box; color: #4078c0; text-decoration: none;">google groups</a> for these guides where you can post related questions. You can also <a href="https://www.codementor.io/android-experts" style="background-color: transparent; box-sizing: border-box; color: #4078c0; text-decoration: none;">get 1:1 mentorship online</a> through codementor.</div>
</div>
Anonymoushttp://www.blogger.com/profile/16161990470673049263noreply@blogger.com0tag:blogger.com,1999:blog-4479053300163234685.post-39770962549129161092016-02-03T05:19:00.001-08:002016-02-05T01:37:01.061-08:00Speed up your android app<div dir="ltr" style="text-align: left;" trbidi="on">
source:<a href="https://github.com/square/leakcanary">https://github.com/square/leakcanary</a><br />
<br />
<div style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; line-height: 25.6px; margin-bottom: 16px;">
A memory leak detection library for Android and Java.</div>
<div style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; line-height: 25.6px; margin-bottom: 16px;">
<em style="box-sizing: border-box;">“A small leak will sink a great ship.”</em> - Benjamin Franklin</div>
<div style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; line-height: 25.6px; margin-bottom: 16px;">
<a href="https://github.com/square/leakcanary/blob/master/assets/screenshot.png" style="box-sizing: border-box; color: #4078c0; text-decoration: none;" target="_blank"><img alt="screenshot.png" src="https://github.com/square/leakcanary/raw/master/assets/screenshot.png" style="background-color: white; border: 0px; box-sizing: content-box; max-width: 100%;" /></a></div>
<br />
<br />
<br />
<br />
<br />
source:<a href="http://blog.udinic.com/2015/09/15/speed-up-your-app/" target="_blank">http://blog.udinic.com/2015/09/15/speed-up-your-app/</a><br />
<br />
<div class="page-header" style="background-color: #282e39; border-bottom-width: 0px; box-sizing: border-box; color: #83af9b; font-family: Roboto, 'PT sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 18px; line-height: 25.7143px; margin: 0px; padding-bottom: 0px; width: 1044.89px;">
<h1 style="box-sizing: border-box; font-family: Roboto, Arvo; font-size: 60px; line-height: 1.1; margin: 20px 0px 10px; padding-bottom: 40px;">
Speed up your app</h1>
</div>
<br />
<article style="background-color: #282e39; box-sizing: border-box; color: #8f9ba8; font-family: Roboto, 'PT sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 18px; line-height: 25.7143px; margin-bottom: 40px;"><div class="col-sm-10" style="box-sizing: border-box; float: left; min-height: 1px; padding-left: 0px; padding-right: 0px; position: relative; width: 967.5px;">
<span class="post-date" style="box-sizing: border-box; color: #646c75; font-size: 14px; letter-spacing: 3px; text-transform: uppercase;">SEPTEMBER 15TH, 2015</span><br />
<div class="article_body" style="box-sizing: border-box; margin-bottom: 20px; margin-top: 20px;">
<div style="box-sizing: border-box; margin-bottom: 20px; word-wrap: break-word;">
A few weeks ago, I gave a talk about Android Performance Optimization, at Droidcon NYC.</div>
<div style="box-sizing: border-box; margin-bottom: 20px; word-wrap: break-word;">
I invested a lot of time in this presentation, since I wanted to show real examples for performance issues, and how to identify them with the available tools. I had to cut down about a half of my slides because I didn’t have enough time to show everything. In this post, I’ll summarize everything I was talking about, and show examples I didn’t have time to go over.</div>
<div style="box-sizing: border-box; margin-bottom: 20px; word-wrap: break-word;">
The talk was recorded and you can watch it here:</div>
<iframe allowfullscreen="allowfullscreen" height="420" src="http://www.youtube.com/embed/v3DlGOQAIbw?color=white&theme=light" style="box-sizing: border-box;" width="560"></iframe><br />
<div style="box-sizing: border-box; margin-bottom: 20px; word-wrap: break-word;">
The slides are also available:</div>
<div style="box-sizing: border-box; width: 677.25px;">
<div style="box-sizing: border-box;">
<iframe allowfullscreen="true" class="speakerdeck-iframe" frameborder="0" mozallowfullscreen="true" src="http://speakerdeck.com/player/596740dd42254419935aa604d098f2d3?" style="background: transparent; border-radius: 5px; border-style: initial; border-width: 0px; box-sizing: border-box; height: 442.812px; margin: 0px; padding: 0px; width: 677px;" webkitallowfullscreen="true"></iframe></div>
</div>
<div style="box-sizing: border-box; margin-bottom: 20px; word-wrap: break-word;">
Now, Let’s go over some of the important things I was talking about, hopefully I can give a deeper explanation for everything, starting with the basic rules I follow when I work on optimizations:</div>
<h2 id="my-rules" style="box-sizing: border-box; font-family: Roboto, Arvo; font-size: 30px; line-height: 1.1; margin-bottom: 10px; margin-top: 20px;">
My Rules</h2>
<div style="box-sizing: border-box; margin-bottom: 20px; word-wrap: break-word;">
Everytime I approach a performance problem, or looking for performance problems, I follow these rules:</div>
<ul style="box-sizing: border-box; margin-bottom: 10px; margin-top: 0px;">
<li style="box-sizing: border-box;"><div style="box-sizing: border-box; margin-bottom: 20px; word-wrap: break-word;">
<span style="box-sizing: border-box; color: #9aa5b0;">Always Measure</span> - Optimizing with your eyes is never a good idea. After looking at the same animation for a few times, you’ll start imagining it’s running faster. Numbers don’t lie. Use the tools we’ll go over soon, and measure how your app performs a few times before and after you make your change.</div>
</li>
<li style="box-sizing: border-box;"><div style="box-sizing: border-box; margin-bottom: 20px; word-wrap: break-word;">
<span style="box-sizing: border-box; color: #9aa5b0;">Use slow devices</span> - If you really want to expose all the weak spots, slower devices will help you more. Newer and stronger devices might not get too excited about performance issues you may have, but not all your users use the latest and greatest.</div>
</li>
<li style="box-sizing: border-box;"><div style="box-sizing: border-box; margin-bottom: 20px; word-wrap: break-word;">
<span style="box-sizing: border-box; color: #9aa5b0;">Trade-offs</span> - Performance optimization is all about trade-offs. You optimize one thing - it comes on the expense of another. In many cases, that other thing can be your time spent finding and fixing it, but it can also be the quality of your bitmaps or the amount of data you should store in a specific data structure. Prepare yourself to make sacrifices.</div>
</li>
</ul>
<h2 id="systrace" style="box-sizing: border-box; font-family: Roboto, Arvo; font-size: 30px; line-height: 1.1; margin-bottom: 10px; margin-top: 20px;">
Systrace</h2>
<div style="box-sizing: border-box; margin-bottom: 20px; word-wrap: break-word;">
Systrace is one of the greatest tools that you probably don’t use. That’s because developers weren’t sure what to do with the information it provides.</div>
<div style="box-sizing: border-box; margin-bottom: 20px; word-wrap: break-word;">
Systrace shows us an overview of what’s currently running on the phone. This tool reminds us that the phone we hold in our hands, is actually is a powerful computer that can do many things at the same time. In one of the latest SDK tools updates, this tool was improved with generated insights from the data, helping us to find problems. Let’s see how a trace file looks like:</div>
<div style="box-sizing: border-box; margin-bottom: 20px; word-wrap: break-word;">
<a href="http://blog.udinic.com/assets/media/images/speed-up-your-app/systrace-overview.png" style="box-sizing: border-box; color: #658cb6; text-decoration: none;"><img alt="img" src="http://blog.udinic.com/assets/media/images/speed-up-your-app/systrace-overview.png" style="border: 0px; box-sizing: border-box; max-width: 100%; vertical-align: middle;" /></a></div>
</div>
</div>
</article><br />
<br /></div>
Anonymoushttp://www.blogger.com/profile/16161990470673049263noreply@blogger.com0tag:blogger.com,1999:blog-4479053300163234685.post-48535751626002056872016-01-21T22:19:00.004-08:002016-01-21T22:19:38.651-08:00Complete video tutorial of android<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="left-items" style="-webkit-box-flex: 1; box-sizing: border-box; flex: 1 1 0%; min-width: 1px;">
<h4 class="list-title" style="box-sizing: border-box; color: rgba(0, 0, 0, 0.8); font-family: inherit; font-size: 18px; font-weight: 500; line-height: 28px; margin: 0px; padding-right: 2px;">
Because you enrolled in <i style="box-sizing: border-box;">"Become an Android Developer from Scratch"</i></h4>
<div>
<i style="box-sizing: border-box;"><a href="https://www.blogger.com/goog_1300961783"><br /></a></i></div>
Source: <a href="https://www.udemy.com/payment/success/?courseId=146156">https://www.udemy.com/payment/success/?courseId=146156</a></div>
<div class="left-items" style="-webkit-box-flex: 1; box-sizing: border-box; flex: 1 1 0%; min-width: 1px;">
<br /></div>
<div class="left-items" style="-webkit-box-flex: 1; box-sizing: border-box; flex: 1 1 0%; min-width: 1px;">
<a href="https://www.udemy.com/become-an-android-developer-from-scratch/learn/#/lecture/1046286">https://www.udemy.com/become-an-android-developer-from-scratch/learn/#/lecture/1046286</a></div>
<div class="left-items" style="-webkit-box-flex: 1; box-sizing: border-box; flex: 1 1 0%; min-width: 1px;">
<br /></div>
<div class="left-items" style="-webkit-box-flex: 1; box-sizing: border-box; flex: 1 1 0%; min-width: 1px;">
<br /></div>
</div>
Anonymoushttp://www.blogger.com/profile/16161990470673049263noreply@blogger.com1tag:blogger.com,1999:blog-4479053300163234685.post-74039690408441316612016-01-21T03:31:00.003-08:002016-05-03T22:23:56.095-07:00Android material design icon.<div dir="ltr" style="text-align: left;" trbidi="on">
Generate material design icon online.<br />
<br />
Change color and size of the icon.<br />
<br />
<a href="https://materialdesignicons.com/" target="_blank">https://materialdesignicons.com</a><br />
<br />
<br />
==================================================================<br />
<br />
<ul style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; line-height: 25.6px; margin-bottom: 16px; margin-top: 0px; padding: 0px 0px 0px 2em;">
<li style="box-sizing: border-box;">Adds about 200kb to your apk (so a wopping average of <strong style="box-sizing: border-box;">170 bytes per icon</strong>)</li>
</ul>
<a href="https://github.com/code-mc/material-icon-lib">https://github.com/code-mc/material-icon-lib</a><br />
<br />
==================================================================<br />
<br />
<span style="background-color: white; color: #545454; font-family: "arial" , sans-serif; font-size: x-small; line-height: 18.2px;">Search through more than 3600 free icons. </span><span style="background-color: white; color: #6a6a6a; font-family: "arial" , sans-serif; font-size: x-small; font-weight: bold; line-height: 18.2px;">IconsDB</span><span style="background-color: white; color: #545454; font-family: "arial" , sans-serif; font-size: x-small; line-height: 18.2px;"> let's you customize and download icons. Browse icons by category. Download as ico, icns, png, gif or jpg.</span><br />
<span style="background-color: white; color: #545454; font-family: "arial" , sans-serif; font-size: x-small; line-height: 18.2px;"><br /></span>
<span style="background-color: white; color: #545454; font-family: "arial" , sans-serif; font-size: x-small; line-height: 18.2px;"><a href="http://www.iconsdb.com/" target="_blank">http://www.iconsdb.com/</a></span><br />
<br />
<span style="color: #444444; font-family: "robotodraft" , "roboto" , sans-serif; font-size: 20px; line-height: 36px;">Material icons are beautifully crafted, delightful, and easy to use in your web, Android, and iOS projects. Learn more about material design and our process for making these icons in the </span><a href="https://design.google.com/spec/style/icons.html#icons-system-icons" style="color: #03a9f4; font-family: RobotoDraft, Roboto, sans-serif; font-size: 20px; line-height: 36px; text-decoration: none;">system icons section</a><span style="color: #444444; font-family: "robotodraft" , "roboto" , sans-serif; font-size: 20px; line-height: 36px;"> of the</span><a href="https://design.google.com/spec/" style="color: #03a9f4; font-family: RobotoDraft, Roboto, sans-serif; font-size: 20px; line-height: 36px; text-decoration: none;">material design guidelines</a><span style="color: #444444; font-family: "robotodraft" , "roboto" , sans-serif; font-size: 20px; line-height: 36px;">.</span><br />
<span style="color: #444444; font-family: "robotodraft" , "roboto" , sans-serif; font-size: 20px; line-height: 36px;"><a href="https://www.blogger.com/goog_528832811"><br /></a></span>
<span style="color: #444444; font-family: "robotodraft" , "roboto" , sans-serif;"><span style="font-size: 20px; line-height: 36px;"><a href="https://design.google.com/icons/">https://design.google.com/icons/</a></span></span><br />
<span style="color: #444444; font-family: "robotodraft" , "roboto" , sans-serif;"><br /></span>
<span style="color: #444444; font-family: "robotodraft" , "roboto" , sans-serif;"><br /></span>
<span style="color: #444444; font-family: "robotodraft" , "roboto" , sans-serif;">Download color icon</span><br />
<span style="color: #444444; font-family: "robotodraft" , "roboto" , sans-serif;"><br /></span>
<span style="color: #444444; font-family: "robotodraft" , "roboto" , sans-serif;"><a href="http://www.flaticon.com/">http://www.flaticon.com/</a></span><br />
<span style="color: #444444; font-family: "robotodraft" , "roboto" , sans-serif;"><br /></span>
<span style="color: #444444; font-family: "robotodraft" , "roboto" , sans-serif;"><br /></span>
<span style="color: #444444; font-family: "robotodraft" , "roboto" , sans-serif;"><br /></span>
<span style="color: #444444; font-family: "robotodraft" , "roboto" , sans-serif;"><br /></span></div>
Anonymoushttp://www.blogger.com/profile/16161990470673049263noreply@blogger.com0tag:blogger.com,1999:blog-4479053300163234685.post-58764390621808740072016-01-18T21:07:00.001-08:002016-01-18T21:07:58.754-08:00Build android application from repository<div dir="ltr" style="text-align: left;" trbidi="on">
<div>
<span style="background-color: white; color: #333333; font-family: Arial, Helvetica; font-size: 11.2px;">An extendable open source automation server</span></div>
<div>
<span style="background-color: white; color: #333333; font-family: Arial, Helvetica; font-size: 11.2px;"><br /></span></div>
<div>
<span style="background-color: white; color: #333333; font-family: Arial, Helvetica; font-size: 11.2px;"><br /></span></div>
<div>
<span style="background-color: white; color: #333333; font-family: Arial, Helvetica; font-size: 11.2px;"><a href="https://jenkins-ci.org/" target="_blank"><br /></a></span></div>
<div>
<a href="https://jenkins-ci.org/" target="_blank"><span style="background-color: white; color: #333333; font-family: Arial, Helvetica; font-size: 11.2px;">Source: </span><span style="color: #333333; font-family: Arial, Helvetica;"><span style="font-size: 11.2px;">https://jenkins-ci.org/</span></span></a></div>
<div>
<span style="color: #333333; font-family: Arial, Helvetica;"><span style="font-size: 11.2px;"><br /></span></span></div>
<div>
<span style="color: #333333; font-family: Arial, Helvetica;"><span style="font-size: 11.2px;"><br /></span></span></div>
<div>
<div class="section" style="font-family: 'Droid Sans', sans-serif; line-height: 24px;">
<div class="titlepage">
<h2 class="title" style="font-family: Montserrat, sans-serif; font-size: 30px; margin-top: 30px;">
Using the Jenkins build server</h2>
</div>
<div style="font-family: Helvetica, Arial, Verdana, sans-serif; font-size: 14px; line-height: 20px; margin-left: 10px; margin-right: 10px;">
<em class="wordasword">Continuous integration</em> is a process in which all development work is integrated as early as possible and the resulting artifacts are automatically created and tested. This process should identify errors as very early in the process.</div>
<div style="font-family: Helvetica, Arial, Verdana, sans-serif; font-size: 14px; line-height: 20px; margin-left: 10px; margin-right: 10px;">
<em class="wordasword">Jenkins</em> is one open source tool to perform continuous integration and build automation. The basic functionality of Jenkins is to execute a predefined list of steps. The trigger for this execution can be time or event based. For example every 20 minutes or after a new commit in a Git repository.</div>
<div style="font-family: Helvetica, Arial, Verdana, sans-serif; font-size: 14px; line-height: 20px; margin-left: 10px; margin-right: 10px;">
The list of steps can, for example, include:</div>
<div class="itemizedlist">
<ul class="itemizedlist" type="disc">
<li class="listitem"><div style="font-family: Helvetica, Arial, Verdana, sans-serif; font-size: 14px; line-height: 20px; margin-left: 10px; margin-right: 10px;">
perform a software build with Apache Maven or Gradle</div>
</li>
<li class="listitem"><div style="font-family: Helvetica, Arial, Verdana, sans-serif; font-size: 14px; line-height: 20px; margin-left: 10px; margin-right: 10px;">
Run a shell script</div>
</li>
<li class="listitem"><div style="font-family: Helvetica, Arial, Verdana, sans-serif; font-size: 14px; line-height: 20px; margin-left: 10px; margin-right: 10px;">
Archive the build result</div>
</li>
<li class="listitem"><div style="font-family: Helvetica, Arial, Verdana, sans-serif; font-size: 14px; line-height: 20px; margin-left: 10px; margin-right: 10px;">
Afterwards start the integration tests</div>
</li>
</ul>
</div>
<div style="font-family: Helvetica, Arial, Verdana, sans-serif; font-size: 14px; line-height: 20px; margin-left: 10px; margin-right: 10px;">
</div>
<div style="font-family: Helvetica, Arial, Verdana, sans-serif; font-size: 14px; line-height: 20px; margin-left: 10px; margin-right: 10px;">
Jenkins also monitors the execution of the steps and allows to stop the process if one of the steps fails. Jenkins can also send out notifications about the build success or failure.</div>
<div style="font-family: Helvetica, Arial, Verdana, sans-serif; font-size: 14px; line-height: 20px; margin-left: 10px; margin-right: 10px;">
<em class="wordasword">Jenkins</em> can be extended by additional plug-ins, e.g., for building and testing Android applications or to support the Git version control system.</div>
</div>
<div class="section" style="font-family: 'Droid Sans', sans-serif; line-height: 24px;">
<div class="titlepage">
<h2 class="title" style="font-family: Montserrat, sans-serif; font-size: 30px; margin-top: 30px;">
</h2>
</div>
</div>
source: <a href="http://www.vogella.com/tutorials/Jenkins/article.html">http://www.vogella.com/tutorials/Jenkins/article.html</a><br />
<br />
<br /></div>
</div>
Anonymoushttp://www.blogger.com/profile/16161990470673049263noreply@blogger.com0tag:blogger.com,1999:blog-4479053300163234685.post-90810544543329714032016-01-05T22:00:00.000-08:002016-01-05T22:00:09.511-08:00Apk to source code online de-compiler.<div dir="ltr" style="text-align: left;" trbidi="on">
You can de- compile apk using using following web site.<br />
<br />
<a href="http://www.javadecompilers.com/" target="_blank">http://www.javadecompilers.com/</a></div>
Anonymoushttp://www.blogger.com/profile/16161990470673049263noreply@blogger.com0tag:blogger.com,1999:blog-4479053300163234685.post-164206754291003642015-12-21T01:58:00.003-08:002015-12-21T01:58:39.409-08:00Android expert code<div dir="ltr" style="text-align: left;" trbidi="on">
source: <a href="https://codelabs.developers.google.com/android-dev-summit" target="_blank">https://codelabs.developers.google.com/android-dev-summit</a><br />
<br />
<div class="codelab-card category-about" data-category="About" style="background-color: white; border-radius: 4px; color: #333333; font-family: Roboto, 'Helvetica Neue', Helvetica, Arial; font-size: 16px; line-height: 1.5; margin: 16px 0px 16px 16px; position: relative;">
<div class="card-header about-bg" style="background-color: #1464bf; border-radius: 4px 4px 0px 0px; color: #666666; display: flex; padding: 16px;">
<h2 class="title" style="color: white; flex: 1 1 0%; font-size: 1.4em; font-weight: 300; line-height: 1em;">
<a href="https://codelabs.developers.google.com/codelabs/about/index.html?index=..%2F..%2Fandroid-dev-summit&viewga=UA-69243313-1" style="color: white; text-decoration: none;"><br class="Apple-interchange-newline" />About Codelabs</a></h2>
</div>
<div class="flex" style="flex: 1 1 0%;">
<div class="description" style="padding: 16px;">
Learn about Google codelabs.</div>
<div class="card-footer" style="border-top-color: rgb(224, 224, 224); border-top-style: solid; border-top-width: 1px; color: #616161; display: flex; justify-content: space-between; padding: 8px 16px;">
<div class="card-duration self-center" style="align-self: center;">
</div>
<div class="card-action">
<a data-wait-for-ripple="" href="https://codelabs.developers.google.com/codelabs/about/index.html?index=..%2F..%2Fandroid-dev-summit&viewga=UA-69243313-1" style="text-decoration: none;"><paper-button animated="" aria-disabled="false" elevation="0" role="button" style="-webkit-user-select: none; background: transparent; border-radius: 3px; box-sizing: border-box; color: #f9518c; cursor: pointer; display: block; font-family: inherit; font-size: 14px; font-stretch: inherit; font-style: inherit; font-variant: inherit; line-height: initial; margin: 0px 0.29em; min-width: 5.14em; outline-width: 0px; padding: 0.7em 0.57em; position: relative; text-align: center; text-transform: uppercase; transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1); z-index: 0;" tabindex="0">START</paper-button></a></div>
</div>
</div>
</div>
<div class="codelab-card category-search" data-category="Search" style="background-color: white; border-radius: 4px; color: #333333; font-family: Roboto, 'Helvetica Neue', Helvetica, Arial; font-size: 16px; line-height: 1.5; margin: 16px 0px 16px 16px; position: relative;">
<div class="card-header search-bg" style="background-color: #1464bf; border-radius: 4px 4px 0px 0px; color: #666666; display: flex; padding: 16px;">
<div class="category-icon search-icon" id="icon" style="background-color: white; background-image: url("../../images/icons/android.svg"); background-position: 50% 50%; background-repeat: no-repeat; background-size: 30px; border-radius: 50%; height: 40px; margin: auto 16px auto 8px; width: 40px;">
</div>
<h2 class="title" style="color: white; flex: 1 1 0%; font-size: 1.4em; font-weight: 300; line-height: 1em;">
<a href="https://codelabs.developers.google.com/codelabs/voice-interaction/index.html?index=..%2F..%2Fandroid-dev-summit&viewga=UA-69243313-1" style="color: white; text-decoration: none;">Add Voice Interactions to Your App</a></h2>
</div>
<div class="flex" style="flex: 1 1 0%;">
<div class="description" style="padding: 16px;">
In this codelab, you'll learn how to add voice interactions to your app with the Voice Interaction API. You'll build a voice-powered camera app that responds to the voice command “take a photo” and prompts you for confirmation before taking the photo.</div>
<div class="card-footer" style="border-top-color: rgb(224, 224, 224); border-top-style: solid; border-top-width: 1px; color: #616161; display: flex; justify-content: space-between; padding: 8px 16px;">
<div class="card-duration self-center" style="align-self: center;">
<span class="layout horizontal center" style="align-items: center; display: flex; flex-direction: row;"><iron-icon icon="schedule" style="align-items: center; color: inherit; display: inline-flex; fill: currentcolor; height: 24px; justify-content: center; margin-right: 3px; position: relative; stroke: none; vertical-align: middle; width: 24px;"><svg preserveaspectratio="xMidYMid meet" style="display: block; height: 100%; pointer-events: none; width: 100%;" viewbox="0 0 24 24"><g><path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zM12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z" fill-opacity=".9"></path></g></svg></iron-icon>20min</span></div>
<div class="card-action">
<a data-wait-for-ripple="" href="https://codelabs.developers.google.com/codelabs/voice-interaction/index.html?index=..%2F..%2Fandroid-dev-summit&viewga=UA-69243313-1" style="text-decoration: none;"><paper-button animated="" aria-disabled="false" elevation="0" role="button" style="-webkit-user-select: none; background: transparent; border-radius: 3px; box-sizing: border-box; color: #f9518c; cursor: pointer; display: block; font-family: inherit; font-size: 14px; font-stretch: inherit; font-style: inherit; font-variant: inherit; line-height: initial; margin: 0px 0.29em; min-width: 5.14em; outline-width: 0px; padding: 0.7em 0.57em; position: relative; text-align: center; text-transform: uppercase; transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1); z-index: 0;" tabindex="0">START</paper-button></a></div>
</div>
</div>
</div>
<div class="codelab-card category-android-tv" data-category="Android TV" style="background-color: white; border-radius: 4px; color: #333333; font-family: Roboto, 'Helvetica Neue', Helvetica, Arial; font-size: 16px; line-height: 1.5; margin: 16px 0px 16px 16px; position: relative;">
<div class="card-header android-tv-bg" style="background-color: #1464bf; border-radius: 4px 4px 0px 0px; color: #666666; display: flex; padding: 16px;">
<div class="category-icon android-tv-icon" id="icon" style="background-color: white; background-image: url("/images/icons/android.svg"); background-position: 50% 50%; background-repeat: no-repeat; background-size: 30px; border-radius: 50%; height: 40px; margin: auto 16px auto 8px; width: 40px;">
</div>
<h2 class="title" style="color: white; flex: 1 1 0%; font-size: 1.4em; font-weight: 300; line-height: 1em;">
<a href="https://codelabs.developers.google.com/codelabs/androidtv-adding-leanback/index.html?index=..%2F..%2Fandroid-dev-summit&viewga=UA-69243313-1" style="color: white; text-decoration: none;">Adding Leanback to your Android TV app</a></h2>
</div>
<div class="flex" style="flex: 1 1 0%;">
<div class="description" style="padding: 16px;">
This codelab will introduce you to the key Android TV concepts and the Leanback fragments. We will then walk through adding Android TV functionality to an existing mobile video app using Leanback fragments. By the end of the codelab, you'll have a single APK that you can use on both mobile and Android TV.</div>
</div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/16161990470673049263noreply@blogger.com0tag:blogger.com,1999:blog-4479053300163234685.post-6860135025940223952015-11-02T19:55:00.005-08:002015-11-02T19:55:47.655-08:00Unity Android Game Development Tutorial <div dir="ltr" style="text-align: left;" trbidi="on">
<div class="Al pf" style="margin: 0px; padding: 0px 20px; text-overflow: ellipsis;">
<div class="Xx xJ">
<div class="Ig At dn" style="color: #404040; line-height: 1.4; min-height: 0px; overflow: hidden; padding: 0px 0px 20px;">
<div class="Bt Pm" style="max-height: 123px; overflow: hidden;">
<div class="Ct">
<span style="font-size: large;">Android Game Development tutorials for Beginners With Unity.<br />Get the Complete Playlist here:<a class="ot-anchor aaTEdf" dir="ltr" href="https://www.youtube.com/watch?v=2LaBYDRR60g&list=PLytjVIyAOStrTBXBuuMR0HjXGIk4DtJrv" jslog="10929; track:click" rel="nofollow" style="color: #427fed; cursor: pointer; text-decoration: none;" target="_blank">https://www.youtube.com/watch?v=2LaBYDRR60g&list=PLytjVIyAOStrTBXBuuMR0HjXGIk4DtJrv</a><br />Hope you'll like it. :)</span></div>
</div>
</div>
</div>
<div class="yx Nf">
<div class="j9" itemscope="" itemtype="http://schema.org/VideoObject">
<div class="q9 yg" style="clear: both; line-height: 0; margin: 0px -14px; overflow: hidden; position: relative;">
<div class="sp ej bc Ai" style="background-color: whitesmoke; height: 195px; line-height: 0; min-width: 70px; overflow: hidden; position: relative; width: 346px;">
<img class="ar Mc bc kf" itemprop="image" src="https://blogger.googleusercontent.com/img/proxy/AVvXsEgFE0w3IKXoaVWeQ5H9k3Kqgpvz1UlLAmcmlvpmd31OfNybfNgzvTSD216K0UxPtmMUtOZ9lAmvCXEAQ7UZEgUDaHQ7n-PnHq-blozxng6dqxMQgeSFP4rOkHN_FR3Mosrw03Px_QzENVideAno2VYk7E2Oyg=w433-h244-n" style="border: 0px; bottom: 0px; cursor: pointer; display: block; left: 0px; margin: auto; max-height: 195px; max-width: 346px; position: absolute; right: 0px; top: 0px;" /><div aria-label="Play" class="bc vf" role="button" style="background: url(https://ssl.gstatic.com/s2/oz/images/sprites/stream-9d991e56752b6d57f78fa1d4650083b8.png) 0px -52px no-repeat; cursor: pointer; height: 72px; left: 173px; margin-left: -36px; margin-top: -36px; position: absolute; top: 97.5px; width: 72px;" tabindex="0">
</div>
<div class="yh Rl RJ" style="box-sizing: border-box; color: white; cursor: pointer; height: 120px; line-height: 1.4; padding: 15px; position: absolute; top: 0px; width: 346px; z-index: 1;">
<div class="yh Sl SJ" style="background-color: transparent; background-image: -webkit-linear-gradient(top, rgba(0, 0, 0, 0.65098) 0px, transparent); height: 120px; left: 0px; position: absolute; top: 0px; width: 346px; z-index: 2;">
</div>
<div class="yh Du" style="font-family: Roboto, arial, sans-serif; font-size: 16px; font-stretch: normal; line-height: normal; position: relative; z-index: 2;">
<a class="kq ot-anchor" href="https://www.youtube.com/watch?v=2LaBYDRR60g&list=PLytjVIyAOStrTBXBuuMR0HjXGIk4DtJrv" style="color: #427fed; cursor: pointer; display: inline-block; max-width: 100%; overflow: hidden; pointer-events: auto; text-decoration: none; text-overflow: ellipsis; transition: color 0.218s; vertical-align: top; white-space: nowrap;" target="_blank">Unity Android Game Development Tutorial(Start to Publish)-1-Setting up Android SDK</a></div>
</div>
</div>
<div class="lr" style="border-top-color: rgba(0, 0, 0, 0.0470588); border-top-style: solid; border-top-width: 1px; height: 0px; left: 0px; position: absolute; top: 0px; width: 346.4px;">
</div>
<div class="ko" style="border-left-color: rgba(0, 0, 0, 0.0470588); border-left-style: solid; border-left-width: 1px; height: 195px; position: absolute; right: 0px; top: 0px; width: 0px;">
</div>
<div class="kr" style="border-top-color: rgba(0, 0, 0, 0.0470588); border-top-style: solid; border-top-width: 1px; bottom: 0px; height: 0px; left: 0px; position: absolute; width: 346.4px;">
</div>
<div class="jo" style="border-left-color: rgba(0, 0, 0, 0.0470588); border-left-style: solid; border-left-width: 1px; height: 195px; left: 0px; position: absolute; top: 0px; width: 0px;">
</div>
</div>
</div>
</div>
</div>
<div class="Qg" style="height: 30px; margin: 20px 0px 0px; padding: 0px 0px 20px 12px;">
</div>
</div>
Anonymoushttp://www.blogger.com/profile/16161990470673049263noreply@blogger.com0tag:blogger.com,1999:blog-4479053300163234685.post-48633767770381564962015-10-30T00:19:00.003-07:002015-10-30T00:19:25.608-07:00ImageView and FrameLayout with gestures control and position animation.<div dir="ltr" style="text-align: left;" trbidi="on">
<h1 style="background-color: white; border-bottom-color: rgb(238, 238, 238); border-bottom-style: solid; border-width: 0px 0px 1px; box-sizing: border-box; color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; line-height: 24px; margin-bottom: 16px; margin-left: 0px; margin-right: 0px; margin-top: 0px !important; padding: 0px 0px 0.3em; text-align: left; width: 1066px;">
<span style="font-size: small;">source:</span><span style="font-size: 2.25em;"> </span><a href="https://android-arsenal.com/details/1/2705" target="_blank"><span style="font-size: small;">https://android-arsenal.com/details/1/2705</span></a></h1>
<div>
<br /></div>
<h1 style="background-color: white; border-bottom-color: rgb(238, 238, 238); border-bottom-style: solid; border-width: 0px 0px 1px; box-sizing: border-box; color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 2.25em; line-height: 24px; margin-bottom: 16px; margin-left: 0px; margin-right: 0px; margin-top: 0px !important; padding: 0px 0px 0.3em; width: 1066px;">
GestureViews</h1>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 16px;">
<a href="https://maven-badges.herokuapp.com/maven-central/com.alexvasilkov/gesture-views" rel="nofollow" style="background: 0px 0px transparent; box-sizing: border-box; color: #4078c0; text-decoration: none;"><img alt="Maven Central" src="https://camo.githubusercontent.com/fb663123d8f769d317bffc3557615dbc22ba261a/68747470733a2f2f696d672e736869656c64732e696f2f6d6176656e2d63656e7472616c2f762f636f6d2e616c6578766173696c6b6f762f676573747572652d76696577732e7376673f7374796c653d666c61742d737175617265" style="border: 0px; box-sizing: border-box; max-width: 100%; vertical-align: middle;" /></a></div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 16px;">
ImageView and FrameLayout with gestures control and position animation.</div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 16px;">
Main goal of this library is to make images viewing process as smooth as possible and to make it easier for developers to integrate it into their apps.</div>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 1.25em; line-height: 1.4; margin-bottom: 16px; margin-top: 1em;">
<a aria-hidden="true" class="anchor" href="https://android-arsenal.com/details/1/2705#demo-video" id="user-content-demo-video" rel="nofollow" style="background: 0px 0px transparent; box-sizing: border-box; color: #4078c0; display: block; left: 0px; line-height: 1.2; margin-left: -30px; padding-left: 30px; padding-right: 6px; position: absolute; text-decoration: none; top: 0px;"></a>Demo video</h4>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 16px;">
<a href="http://www.youtube.com/watch?v=5N5G_vgqZbI" rel="nofollow" style="background: 0px 0px transparent; box-sizing: border-box; color: #4078c0; text-decoration: none;"><img alt="Demo video" src="https://github.com/alexvasilkov/GestureViews/raw/master/sample/art/demo.gif" style="border: 0px; box-sizing: border-box; max-width: 100%; vertical-align: middle;" /></a><br style="box-sizing: border-box;" />(Click for full demo video)</div>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 1.25em; line-height: 1.4; margin-bottom: 16px; margin-top: 1em;">
<a aria-hidden="true" class="anchor" href="https://android-arsenal.com/details/1/2705#sample-app" id="user-content-sample-app" rel="nofollow" style="background: 0px 0px transparent; box-sizing: border-box; color: #4078c0; display: block; left: 0px; line-height: 1.2; margin-left: -30px; padding-left: 30px; padding-right: 6px; position: absolute; text-decoration: none; top: 0px;"></a>Sample app</h4>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 16px;">
<a href="http://play.google.com/store/apps/details?id=com.alexvasilkov.gestures.sample" rel="nofollow" style="background: 0px 0px transparent; box-sizing: border-box; color: #4078c0; text-decoration: none;"><img alt="Get it on Google Play" src="https://camo.githubusercontent.com/9e1a34e84a09c0f95303da060457aea4a8899f85/687474703a2f2f646576656c6f7065722e616e64726f69642e636f6d2f696d616765732f6272616e642f656e5f67656e657269635f7267625f776f5f36302e706e67" style="border: 0px; box-sizing: border-box; max-width: 100%; vertical-align: middle;" /></a></div>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 1.25em; line-height: 1.4; margin-bottom: 16px; margin-top: 1em;">
<a aria-hidden="true" class="anchor" href="https://android-arsenal.com/details/1/2705#usage" id="user-content-usage" rel="nofollow" style="background: 0px 0px transparent; box-sizing: border-box; color: #4078c0; display: block; left: 0px; line-height: 1.2; margin-left: -30px; padding-left: 30px; padding-right: 6px; position: absolute; text-decoration: none; top: 0px;"></a>Usage</h4>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 16px;">
Add dependency to your <code style="background-color: rgba(0, 0, 0, 0.0392157); border-radius: 3px; box-sizing: border-box; color: #c7254e; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12.75px; margin: 0px; padding: 0.2em 0px;">build.gradle</code> file:</div>
<pre style="background-color: #f7f7f7; border-radius: 3px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12.75px; font-stretch: normal; line-height: 1.45; margin-bottom: 16px; overflow: auto; padding: 16px; position: relative; word-break: break-all; word-wrap: normal;"><code style="background: 0px 0px transparent; border-radius: 3px; border: 0px; box-sizing: border-box; color: inherit; display: inline; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; line-height: inherit; margin: 0px; max-width: initial; overflow: initial; padding: 0px; word-break: normal; word-wrap: normal;">compile 'com.alexvasilkov:gesture-views:2.0.0'
</code><a class="ctcb" href="https://www.blogger.com/null" style="background: 0px 0px transparent; box-sizing: border-box; color: inherit; cursor: pointer; position: absolute; right: 10px; top: 10px;" title="Copy to clipboard"><span class="fa fa-clipboard" style="-webkit-font-smoothing: antialiased; box-sizing: border-box; display: inline-block; font-family: FontAwesome; font-size: 18px; font-stretch: normal; line-height: 1; padding: 0px; text-rendering: auto; transform: translate(0px, 0px);"></span></a></pre>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 16px;">
Note: min SDK version for library is 9, but it was tested mainly on 15+.</div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 16px;">
<a href="https://github.com/alexvasilkov/GestureViews/wiki/Usage" rel="nofollow" style="background: 0px 0px transparent; box-sizing: border-box; color: #4078c0; text-decoration: none;">Usage wiki</a></div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 16px;">
<a href="https://oss.sonatype.org/service/local/repositories/releases/archive/com/alexvasilkov/gesture-views/2.0.0/gesture-views-2.0.0-javadoc.jar/!/index.html" rel="nofollow" style="background: 0px 0px transparent; box-sizing: border-box; color: #4078c0; text-decoration: none;">Javadoc</a></div>
<div style="background-color: white; box-sizing: border-box; color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 16px;">
<a href="https://github.com/alexvasilkov/GestureViews/tree/master/sample" rel="nofollow" style="background: 0px 0px transparent; box-sizing: border-box; color: #4078c0; text-decoration: none;">Sample app sources</a></div>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 1.25em; line-height: 1.4; margin-bottom: 16px; margin-top: 1em;">
License</h4>
<h4 style="background-color: white; box-sizing: border-box; color: #333333; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 1.25em; line-height: 1.4; margin-bottom: 16px; margin-top: 1em;">
<a aria-hidden="true" class="anchor" href="https://android-arsenal.com/details/1/2705#license" id="user-content-license" rel="nofollow" style="background: 0px 0px transparent; box-sizing: border-box; color: #4078c0; display: block; left: 0px; line-height: 1.2; margin-left: -30px; padding-left: 30px; padding-right: 6px; position: absolute; text-decoration: none; top: 0px;"></a><pre data-codota-status="done" data-csrftoken="9xrXmcph-Kuf-sfO-fM3M9NKGPdgZqIiOoAs" data-original-code="Copyright 2014 Alex Vasilkov
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
" data-snippet-id="ext.041c9e548067ba3638aa5b19241a3971" data-snippet-saved="false" style="background-color: #f7f7f7; border-radius: 3px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12.75px; font-stretch: normal; font-weight: normal; line-height: 1.45; overflow: auto; padding: 16px; position: relative; word-break: break-all; word-wrap: normal;"><code style="background: 0px 0px transparent; border-radius: 3px; border: 0px; box-sizing: border-box; color: inherit; display: inline; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; line-height: inherit; margin: 0px; max-width: initial; overflow: initial; padding: 0px; word-break: normal; word-wrap: normal;">Copyright 2014 Alex Vasilkov
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
</code><a class="ctcb" href="https://www.blogger.com/null" style="background: 0px 0px transparent; box-sizing: border-box; color: inherit; cursor: pointer; position: absolute; right: 10px; top: 10px;" title="Copy to clipboard"><span class="fa fa-clipboard" style="-webkit-font-smoothing: antialiased; box-sizing: border-box; display: inline-block; font-family: FontAwesome; font-size: 18px; font-stretch: normal; line-height: 1; padding: 0px; text-rendering: auto; transform: translate(0px, 0px);"></span></a></pre>
</h4>
<div>
<br /></div>
</div>
Anonymoushttp://www.blogger.com/profile/16161990470673049263noreply@blogger.com0tag:blogger.com,1999:blog-4479053300163234685.post-86863468843483839972015-10-20T00:25:00.002-07:002015-10-20T00:25:12.219-07:00Android Application UI Testing (with monkey and monkeyrunner)<div dir="ltr" style="text-align: left;" trbidi="on">
<h3 class="post-title entry-title" itemprop="name" style="background-color: #fefdfa; color: #d52a33; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 22px; font-stretch: normal; font-weight: normal; margin: 0px; position: relative;">
source: <a href="http://hariniachala.blogspot.in/2011/09/android-application-ui-testing-with.html">http://hariniachala.blogspot.in/2011/09/android-application-ui-testing-with.html</a></h3>
<div>
<br /></div>
<h3 class="post-title entry-title" itemprop="name" style="background-color: #fefdfa; color: #d52a33; font-family: Georgia, Utopia, 'Palatino Linotype', Palatino, serif; font-size: 22px; font-stretch: normal; font-weight: normal; margin: 0px; position: relative;">
Android Application UI Testing (with monkey and monkeyrunner)</h3>
<div class="post-header" style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 1.6; margin: 0px 0px 1em;">
<div class="post-header-line-1">
</div>
</div>
<br />
<div class="post-footer" style="background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 1.6; margin: 1.5em 0px 0px;">
</div>
<br />
<div class="post-body entry-content" id="post-body-8822220837293680991" itemprop="description articleBody" style="-webkit-text-stroke-width: 0px; background-color: #fefdfa; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18.2px; orphans: auto; position: relative; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; width: 536px; word-spacing: 0px;">
Android has some built in UI testing tools. These tools can be used for automated UI testing. However the tools are not so simple to use. This post is an attempt to set a guideline towards using these tools.<br /><br />There are 2 main UI testing tools available<br /><br /><span style="font-weight: bold;">1.monkey (aka. UI/Application Exerciser Monkey)</span><br /><br />This tool is a command line based tool that can be primarily used to stress test your application UI. It is the simplest tool to use. Here's how..<br /><br /><span style="font-style: italic; font-weight: bold;">Running monkey as an application UI stress tester</span> (runs a random set of commands on the application. useful to UI stress testing)<br /><br />- Open a command console.<br />- First direct your console to the location of the adb (Android Debug Bridge) program in the android sdk. Typically you can use the following command for this..<br /><br />$cd path_to_android_sdk/platform-tools/<br /><br />path_to_android_sdk should be the path to the sdk on your pc<br /><br />- Now make sure you device is connected with the application running on it or that the emulator is running the application.<br /><br />- To test on device issue the following command in the console<br /><br />$./adb -d shell monkey -p package_name -v 1000<br /><br />(replace -d with -e to test on the emulator.<br />package_name is the name of the application package abnd it usually begins with com.<br />-v specifies the number of UI events to be generated, in this case we ask it to generate 1000 random events)<br /><br />Now you will see the monkey stress testing your app.<br /><br />If you get force close message while running monkey you have just discovered a bug that needs fixing. You can run<br /><br />./adb logcat<br /><br />in the console to generate the relevant logs.<br /><br /><br /><span style="font-style: italic;"><span style="font-weight: bold;">Running specific commands in monkey</span></span><br />The monkey tool can also be used to run a specific set of commands on the application. However it is easier to use the monkeyrunner for this purpose.<br /><br />On the connected device (to run on emulator simply replace -d with -e)<br /><br />./adb -d shell monkey -p package_name --port 1080 &<br />./adb -d forward tcp:1080 tcp:1080<br />telnet localhost 1080<br /><br />Now the following will be printed on cmd line..<br /><br />Trying ::1...<br />Trying 127.0.0.1...<br />Connected to localhost.<br />Escape character is '^]'.<br /><br />Now you can type in your instructions<br /><br />>tap 150 200<br /><br />you can write all instruction into a script (script.txt) as below..<br /><br /># monkey<br />tap 100 180<br />type 123<br />tap 100 280<br />press DEL<br />press DEL<br />press DEL<br />press DEL<br />press DEL<br />press DEL<br />press DEL<br />press DEL<br />type -460.3<br /><br />now run..<br /><br />./adb -d shell monkey -p package_name --port 1080 &<br />./adb -d forward tcp:1080 tcp:1080<br />nc localhost 1080 < script.txt<br /><br /><br /><span style="font-weight: bold;">2. monkeyrunner</span><br /><br />The monkeyrunner tool is an API for writing automated UI tests. You can use it to write specific scripts that run a series of commands and inspects the output by taking screenshots etc. The android SDK includes two special scripts written using monkeyrunner which help in running automated UI tests. The scripts are..<br /><br /><a href="http://www.mediafire.com/?cbjbba4x4czw4z0" style="color: #7d171d; text-decoration: none;">monkey_recorder.py</a><br /><a href="http://www.mediafire.com/?wyqbkdjj8qkiwxh" style="color: #7d171d; text-decoration: none;">monkey_playback.py</a><br /><br />Copy these scripts to /tools folder in the android sdk. Set the console path to the tools directory. Open up the application on the emulator.<br /><br />You can run the recorder as follows..<br /><br />./monkeyrunner monkey_recorder.py<br /><br />Below is a screenshot of monkey_recorder recording actions for calculator.<br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0KTYAyzyk3rn0HI076lh5LrZKshSkEwdkKRh_2bENrqCTEimOvUu3ygrj3TS-lTSQse_zQz4k0JW_RnH1U1Ns90eoL7nWX091V9EZIqaFJyKn5s0zriB_hmkxFzAODY-AfF-CnGkcHLD3/s1600/Screen+shot+2011-10-03+at+3.00.50+PM.png" style="color: #7d171d; text-decoration: none;"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5659198467358253010" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0KTYAyzyk3rn0HI076lh5LrZKshSkEwdkKRh_2bENrqCTEimOvUu3ygrj3TS-lTSQse_zQz4k0JW_RnH1U1Ns90eoL7nWX091V9EZIqaFJyKn5s0zriB_hmkxFzAODY-AfF-CnGkcHLD3/s320/Screen+shot+2011-10-03+at+3.00.50+PM.png" style="background: rgb(255, 255, 255); border-radius: 5px; border: 1px solid rgb(204, 204, 204); box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 20px; cursor: pointer; height: 245px; padding: 8px; position: relative; width: 320px;" /></a><br /><br />Use 'Export Actions' button to export the set of actions into a script (eg: calc.mr)<br /><br />now run the cal.mr script on a connected device as follows.. (first make sure the emulator is shut down)<br /><br />./monkeyrunner monkey_playback.py calc.mr<br /><br />For playback to run properly you need to take precautions of setting the correct wait times and using the correct press, fling, type methods in the recorder.<br /><br />Conclusion: Android has a good collection of tools meant to enable UI test automation. However they still have a lot more room for improvement especially in terms of ease of use and efficiency.<br /><br />References:<br /><br /><a href="http://developer.android.com/guide/developing/tools/monkey.html" style="color: #7d171d; text-decoration: none;">http://developer.android.com/guide/developing/tools/monkey.html</a><br /><a href="http://developer.android.com/guide/developing/tools/monkeyrunner_concepts.html" style="color: #7d171d; text-decoration: none;">http://developer.android.com/guide/developing/tools/monkeyrunner_concepts.html</a><br />Android Application Testing Guide - Diego Torres Milano<div style="clear: both;">
</div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/16161990470673049263noreply@blogger.com1tag:blogger.com,1999:blog-4479053300163234685.post-24089966724427314692015-10-14T23:25:00.000-07:002015-10-14T23:25:09.841-07:00Beware EditText on API 21<div dir="ltr" style="text-align: left;" trbidi="on">
<b>source</b>: <a href="http://blog.danlew.net/2015/09/09/dont-use-dynamic-versions-for-your-dependencies/">http://blog.danlew.net/2015/09/09/dont-use-dynamic-versions-for-your-dependencies/</a><br />
<br />
<main class="content" role="main" style="color: #3a4145; font-family: Merriweather, serif; font-size: 18px; letter-spacing: 0.1px; line-height: 31.5px; overflow: hidden;"><article class="post tag-android" style="border-bottom-style: none; margin: 0px auto 4rem; max-width: 710px; padding-bottom: 0px; position: relative; width: 710px; word-wrap: break-word;"><header class="post-header" style="margin-bottom: 3.4rem;"><h1 class="post-title" style="-webkit-font-feature-settings: 'dlig' 1, 'liga' 1, 'lnum' 1, 'kern' 1; color: #2e2e2e; font-family: 'Open Sans', sans-serif; font-size: 5rem; letter-spacing: -2px; line-height: 1.15em; margin: 0px; text-indent: -3px; text-rendering: geometricPrecision;">
Beware EditText on API 21</h1>
</header><section class="post-content"><div style="-webkit-font-feature-settings: 'liga' 1, 'onum' 1, 'kern' 1; margin-bottom: 1.75em; text-rendering: geometricPrecision;">
Check out these two <code style="background: rgb(247, 250, 251); border-radius: 2px; border: 1px solid rgb(227, 237, 243); font-family: Inconsolata, monospace, sans-serif; font-size: 0.85em; padding: 1px 3px; white-space: pre-wrap;">EditTexts</code>. One is on an API 21 device, the other on an API 22 device.</div>
<div style="-webkit-font-feature-settings: 'liga' 1, 'onum' 1, 'kern' 1; margin-bottom: 1.75em; text-rendering: geometricPrecision;">
<img alt="" src="http://blog.danlew.net/content/images/2015/10/edittexts.png" style="border: 0px; display: block; height: auto; margin: 0px auto; max-width: 100%; padding: 0.6em 0px;" /></div>
<div style="-webkit-font-feature-settings: 'liga' 1, 'onum' 1, 'kern' 1; margin-bottom: 1.75em; text-rendering: geometricPrecision;">
See the difference? It's even more pronounced with "show layout bounds" enabled:</div>
<div style="-webkit-font-feature-settings: 'liga' 1, 'onum' 1, 'kern' 1; margin-bottom: 1.75em; text-rendering: geometricPrecision;">
<img alt="" src="http://blog.danlew.net/content/images/2015/10/edittexts-layout.png" style="border: 0px; display: block; height: auto; margin: 0px auto; max-width: 100%; padding: 0.6em 0px;" /></div>
<div style="-webkit-font-feature-settings: 'liga' 1, 'onum' 1, 'kern' 1; margin-bottom: 1.75em; text-rendering: geometricPrecision;">
The height and vertical alignment of the <code style="background: rgb(247, 250, 251); border-radius: 2px; border: 1px solid rgb(227, 237, 243); font-family: Inconsolata, monospace, sans-serif; font-size: 0.85em; padding: 1px 3px; white-space: pre-wrap;">EditTexts</code> are different! This was caused by a change in the background of <code style="background: rgb(247, 250, 251); border-radius: 2px; border: 1px solid rgb(227, 237, 243); font-family: Inconsolata, monospace, sans-serif; font-size: 0.85em; padding: 1px 3px; white-space: pre-wrap;">EditText</code> between v21 and v22 (<a href="https://android.googlesource.com/platform/frameworks/base/+/c6696c11d74656fa9e5411271519612e2fd4f0df" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #4a4a4a; transition: color 0.3s ease;">diff</a>).</div>
<div style="-webkit-font-feature-settings: 'liga' 1, 'onum' 1, 'kern' 1; margin-bottom: 1.75em; text-rendering: geometricPrecision;">
This change can cause sadness if your <code style="background: rgb(247, 250, 251); border-radius: 2px; border: 1px solid rgb(227, 237, 243); font-family: Inconsolata, monospace, sans-serif; font-size: 0.85em; padding: 1px 3px; white-space: pre-wrap;">EditText</code> is vertically aligned with other<code style="background: rgb(247, 250, 251); border-radius: 2px; border: 1px solid rgb(227, 237, 243); font-family: Inconsolata, monospace, sans-serif; font-size: 0.85em; padding: 1px 3px; white-space: pre-wrap;">Views</code>, such as this case in <a href="https://play.google.com/store/apps/details?id=com.trello" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #4a4a4a; transition: color 0.3s ease;">Trello</a>:</div>
<div style="-webkit-font-feature-settings: 'liga' 1, 'onum' 1, 'kern' 1; margin-bottom: 1.75em; text-rendering: geometricPrecision;">
<img alt="" class="full-img" src="http://blog.danlew.net/content/images/2015/10/checkitem.png" style="border: 0px; display: block; height: auto; margin: 0px -92.2969px; max-width: none; padding: 0.6em 0px; width: 894.594px;" /></div>
<div style="-webkit-font-feature-settings: 'liga' 1, 'onum' 1, 'kern' 1; margin-bottom: 1.75em; text-rendering: geometricPrecision;">
The text should be aligned with the icons, yet clearly it's not. The screenshot above is from 5.0; any other version of Android looks perfectly fine.</div>
<div style="-webkit-font-feature-settings: 'liga' 1, 'onum' 1, 'kern' 1; margin-bottom: 1.75em; text-rendering: geometricPrecision;">
This problem crops up even if you're using AppCompat. AppCompat usually defers to the system material styles on v21+, which is the source of the problem.</div>
<h1 id="solution" style="-webkit-font-feature-settings: 'dlig' 1, 'liga' 1, 'lnum' 1, 'kern' 1; color: #2e2e2e; font-family: 'Open Sans', sans-serif; font-size: 5rem; letter-spacing: -2px; line-height: 1.15em; margin: 0px 0px 0.4em; text-indent: -3px; text-rendering: geometricPrecision;">
Solution</h1>
<div style="-webkit-font-feature-settings: 'liga' 1, 'onum' 1, 'kern' 1; margin-bottom: 1.75em; text-rendering: geometricPrecision;">
Both solutions I've come up with use resource qualifiers to handle API 21 in a special manner.</div>
<div style="-webkit-font-feature-settings: 'liga' 1, 'onum' 1, 'kern' 1; margin-bottom: 1.75em; text-rendering: geometricPrecision;">
One possibility is to import your own <code style="background: rgb(247, 250, 251); border-radius: 2px; border: 1px solid rgb(227, 237, 243); font-family: Inconsolata, monospace, sans-serif; font-size: 0.85em; padding: 1px 3px; white-space: pre-wrap;">EditText</code> background assets for API 21. Unless your app is filled with vertically-aligned <code style="background: rgb(247, 250, 251); border-radius: 2px; border: 1px solid rgb(227, 237, 243); font-family: Inconsolata, monospace, sans-serif; font-size: 0.85em; padding: 1px 3px; white-space: pre-wrap;">EditTexts</code> this seems like more effort than it's worth, since precision-targeting the background of <code style="background: rgb(247, 250, 251); border-radius: 2px; border: 1px solid rgb(227, 237, 243); font-family: Inconsolata, monospace, sans-serif; font-size: 0.85em; padding: 1px 3px; white-space: pre-wrap;">EditTexts</code> for just a single API version is tricky.</div>
<div style="-webkit-font-feature-settings: 'liga' 1, 'onum' 1, 'kern' 1; margin-bottom: 1.75em; text-rendering: geometricPrecision;">
The hackier (but easier) solution is to just define different margins or paddings based on the API level. For example, I found that they're ~6dp off, so you end up with resources like this:</div>
<div class="top-box hide">
<div class="alert-info">
</div>
</div>
<pre data-codota-status="done" data-original-code="<!-- values/dimens.xml -->
<dimen name="edit_text_spacing">6dp</dimen>
<!-- values-v21/dimens.xml -->
<dimen name="edit_text_spacing">0dp</dimen>
<!-- values-v22/dimens.xml -->
<dimen name="edit_text_spacing">6dp</dimen>
" data-snippet-id="ext.c396608737dc8aab3ba345f938de1044" data-snippet-saved="false" style="background: rgb(247, 250, 251); border-radius: 3px; border: 1px solid rgb(227, 237, 243); box-sizing: border-box; font-family: Inconsolata, monospace, sans-serif; font-size: 0.9em; margin-bottom: 1.75em; overflow: auto; padding: 10px; width: 710px;"><code class="language-xml" style="background: transparent; border-radius: 2px; border: none; font-family: Inconsolata, monospace, sans-serif; font-size: inherit; padding: 0px; white-space: pre-wrap;"><!-- values/dimens.xml -->
<dimen name="edit_text_spacing">6dp</dimen>
<!-- values-v21/dimens.xml -->
<dimen name="edit_text_spacing">0dp</dimen>
<!-- values-v22/dimens.xml -->
<dimen name="edit_text_spacing">6dp</dimen>
</code></pre>
<div style="-webkit-font-feature-settings: 'liga' 1, 'onum' 1, 'kern' 1; margin-bottom: 1.75em; text-rendering: geometricPrecision;">
I'd be the first to admit it's ugly, but if there's only a handful of places you're fixing the problem, it's not so bad.</div>
</section></article></main></div>
Anonymoushttp://www.blogger.com/profile/16161990470673049263noreply@blogger.com0tag:blogger.com,1999:blog-4479053300163234685.post-76186501215438749882015-09-22T21:20:00.004-07:002016-05-03T22:26:20.381-07:00Android App Template<div dir="ltr" style="text-align: left;" trbidi="on">
1) Source: <a href="https://github.com/mwolfson/android-historian">https://github.com/mwolfson/android-historian</a><br />
<br />
1) <a href="https://github.com/mwolfson/android-historian/blob/master/art/appdemo1.gif" style="box-sizing: border-box; color: #4078c0; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 25.6px; text-decoration: none;" target="_blank"><img alt="Screen Flow Demo" src="https://github.com/mwolfson/android-historian/raw/master/art/appdemo1.gif" style="border: 0px; box-sizing: border-box; max-width: 100%;" /></a><br />
<h1 style="border-bottom-color: rgb(238, 238, 238); border-bottom-style: solid; border-bottom-width: 1px; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 2.25em; line-height: 1.2; margin: 1em 0px 16px; padding-bottom: 0.3em; position: relative;">
<a aria-hidden="true" class="anchor" href="https://github.com/mwolfson/android-historian#android-ultimate-historian---material-design-demo" id="user-content-android-ultimate-historian---material-design-demo" style="box-sizing: border-box; color: #4078c0; display: block; left: 0px; line-height: 1; margin-left: -30px; padding-left: 30px; padding-right: 6px; position: absolute; text-decoration: none; top: 0px;"></a>Android Ultimate Historian - Material Design Demo</h1>
<div style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 25.6px; margin-bottom: 16px;">
This app is designed to demonstrate the various components of the Android Support libraries, in particular, showing how to implement Material design into your app, using these controls.</div>
<div style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 25.6px; margin-bottom: 16px;">
This is not a complete example (but will be growing), and is intended to provide a high-level overview of many of the main controls in the Support and Design libraries:</div>
<ul style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 25.6px; margin-bottom: 16px; margin-top: 0px; padding: 0px 0px 0px 2em;">
<li style="box-sizing: border-box;">AppCompatActivity</li>
<li style="box-sizing: border-box;">CoordinatorLayout</li>
<li style="box-sizing: border-box;">AppBarLayout & Toolbar</li>
<li style="box-sizing: border-box;">RecyclerView (with ItemDecorators)<ul style="box-sizing: border-box; margin-bottom: 0px; margin-top: 0px; padding: 0px 0px 0px 2em;">
<li style="box-sizing: border-box;">LinearLayoutManager</li>
<li style="box-sizing: border-box;">GridLayoutManager</li>
<li style="box-sizing: border-box;">StaggeredGridLayoutManager</li>
</ul>
</li>
<li style="box-sizing: border-box;">Snackbar</li>
<li style="box-sizing: border-box;">TabLayout</li>
<li style="box-sizing: border-box;">AppCompat Tinting</li>
<li style="box-sizing: border-box;">NavigationView</li>
<li style="box-sizing: border-box;">Snackbar</li>
<li style="box-sizing: border-box;">SwitchCompat</li>
<li style="box-sizing: border-box;">AlertDialog</li>
<li style="box-sizing: border-box;">CardView</li>
<li style="box-sizing: border-box;">FloatingActionButton</li>
<li style="box-sizing: border-box;">TextInputLayout</li>
<li style="box-sizing: border-box;">TextAppearance.AppCompat</li>
</ul>
<h2 style="border-bottom-color: rgb(238, 238, 238); border-bottom-style: solid; border-bottom-width: 1px; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 1.75em; line-height: 1.225; margin-bottom: 16px; margin-top: 1em; padding-bottom: 0.3em; position: relative;">
<a aria-hidden="true" class="anchor" href="https://github.com/mwolfson/android-historian#special-thanks" id="user-content-special-thanks" style="box-sizing: border-box; color: #4078c0; display: block; left: 0px; line-height: 1; margin-left: -30px; padding-left: 30px; padding-right: 6px; position: absolute; text-decoration: none; top: 0px;"></a>Special Thanks</h2>
<div style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 25.6px; margin-bottom: 16px;">
This project was originally forked from the <a href="https://github.com/chrisbanes/cheesesquare" style="box-sizing: border-box; color: #4078c0; text-decoration: none;">Cheesesquare</a> project. Special thanks to <a href="https://github.com/chrisbanes" style="box-sizing: border-box; color: #4078c0; text-decoration: none;">Chris Banes</a>.</div>
<div style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 25.6px; margin-bottom: 16px;">
Item Decorator from <a href="https://github.com/devunwired/recyclerview-playground" style="box-sizing: border-box; color: #4078c0; text-decoration: none;">recyclerview-playground</a> project. Special thanks to <a href="https://github.com/devunwired" style="box-sizing: border-box; color: #4078c0; text-decoration: none;">Dave Smith (DevUnwired</a>.</div>
<h2 style="border-bottom-color: rgb(238, 238, 238); border-bottom-style: solid; border-bottom-width: 1px; box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 1.75em; line-height: 1.225; margin-bottom: 16px; margin-top: 1em; padding-bottom: 0.3em; position: relative;">
<a aria-hidden="true" class="anchor" href="https://github.com/mwolfson/android-historian#pre-requisites" id="user-content-pre-requisites" style="box-sizing: border-box; color: #4078c0; display: block; left: 0px; line-height: 1; margin-left: -30px; padding-left: 30px; padding-right: 6px; position: absolute; text-decoration: none; top: 0px;"></a>Pre-requisites</h2>
<ul style="box-sizing: border-box; color: #333333; font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif; font-size: 16px; line-height: 25.6px; margin-bottom: 0px !important; margin-top: 0px; padding: 0px 0px 0px 2em;">
<li style="box-sizing: border-box;">Android SDK, Build Tools and Support Repository for v23.0.1</li>
</ul>
<div>
<span style="color: #333333; font-family: "helvetica neue" , "helvetica" , "segoe ui" , "arial" , "freesans" , sans-serif;"><span style="line-height: 25.6px;">====================================================================</span></span></div>
<div>
<span style="color: #333333; font-family: "helvetica neue" , "helvetica" , "segoe ui" , "arial" , "freesans" , sans-serif;"><span style="line-height: 25.6px;">2) Download xml template</span></span><br />
<span style="color: #333333; font-family: "helvetica neue" , "helvetica" , "segoe ui" , "arial" , "freesans" , sans-serif;"><span style="line-height: 25.6px;"><a class="ot-anchor aaTEdf" dir="ltr" href="http://www.wsdesign.in/" jslog="10929; track:click" rel="nofollow" style="-webkit-tap-highlight-color: transparent; background-color: #f3f3f3; color: #2962ff; font-family: Roboto, RobotoDraft, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; text-decoration: none; white-space: pre-wrap;" target="_blank">www.wsdesign.in</a><span style="background-color: #f3f3f3; color: rgba(0, 0, 0, 0.870588); font-family: Roboto, RobotoDraft, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; white-space: pre-wrap;"> </span></span></span><br />
<span style="color: #333333; font-family: "helvetica neue" , "helvetica" , "segoe ui" , "arial" , "freesans" , sans-serif;"><span style="line-height: 25.6px;"><span style="background-color: #f3f3f3; color: rgba(0, 0, 0, 0.870588); font-family: Roboto, RobotoDraft, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; white-space: pre-wrap;"><br /></span></span></span></div>
</div>
Anonymoushttp://www.blogger.com/profile/16161990470673049263noreply@blogger.com0tag:blogger.com,1999:blog-4479053300163234685.post-45992426955662370012015-09-22T21:18:00.004-07:002015-09-22T21:18:49.289-07:00Android App Code Architecture<div dir="ltr" style="text-align: left;" trbidi="on">
source: <a href="http://frank-zhu.github.io/android/2014/11/22/android-app-code-architecture/">http://frank-zhu.github.io/android/2014/11/22/android-app-code-architecture/</a><br />
<br />
<div class="post" style="background-color: white; box-sizing: border-box; color: #515151; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 20px; line-height: 30px; margin-bottom: 4em;">
<h1 class="post-title" style="box-sizing: border-box; color: #303030; font-family: 'Fjalla One', serif; font-size: 2.6rem; font-weight: normal; letter-spacing: -0.03em; line-height: 1.25; margin-bottom: 0.6rem; margin-top: 0px; text-rendering: optimizeLegibility;">
<span style="box-sizing: border-box;">Android App Code Architecture</span></h1>
<span class="post-date" style="box-sizing: border-box; color: #9a9a9a; display: block; margin-bottom: 1rem; margin-top: -0.5rem;">22 Nov 2014</span><div class="theme-base-0c" style="box-sizing: border-box;">
<h3 style="box-sizing: border-box; color: #313131; font-family: 'Fjalla One', serif; font-size: 1.25rem; font-weight: normal; letter-spacing: -0.03em; line-height: 1.25; margin-bottom: 0.6rem; margin-top: 1.5rem; text-rendering: optimizeLegibility;">
<span style="box-sizing: border-box;">Andrews APP architecture building codes</span></h3>
<div style="box-sizing: border-box; margin-bottom: 1rem;">
<span style="box-sizing: border-box;">Android developers engaged for two years, always wanted to organize a get their usual code developed by other projects as infrastructure development, even before finishing off one, but because of their own short-board technology of the time, would have been a bit of code behind, so today is a relatively reasonable thing to rearrange the backup code, if you are interested in previous versions can click here ---> </span><a href="https://github.com/Frank-Zhu/AndroidAppCodeFramework" style="box-sizing: border-box; color: #75b5aa; text-decoration: none;">AndroidAppCodeFramework</a></div>
<hr style="border-bottom-color: rgb(255, 255, 255); border-bottom-style: solid; border-left-width: 0px; border-right-width: 0px; border-top-color: rgb(238, 238, 238); border-top-style: solid; box-sizing: border-box; margin: 1.5rem 0px; position: relative;" />
<div style="box-sizing: border-box; margin-bottom: 1rem;">
<span style="box-sizing: border-box;">The new code structure I will use the following open source libraries</span></div>
<ul style="box-sizing: border-box; margin-bottom: 1rem; margin-top: 0px;">
<li style="box-sizing: border-box;"><span style="box-sizing: border-box;">Network traffic will use these open source libraries </span><a href="https://github.com/square/retrofit" style="box-sizing: border-box; color: #75b5aa; text-decoration: none;">Retrofit </a><a href="https://github.com/square/okhttp" style="box-sizing: border-box; color: #75b5aa; text-decoration: none;">OKHTTP</a></li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box;">Network image loading </span><a href="https://github.com/square/picasso" style="box-sizing: border-box; color: #75b5aa; text-decoration: none;">Picasso</a><span style="box-sizing: border-box;"> / </span><a href="https://github.com/nostra13/Android-Universal-Image-Loader" style="box-sizing: border-box; color: #75b5aa; text-decoration: none;">UIL</a></li>
<li style="box-sizing: border-box;">View注解 <a href="https://github.com/JakeWharton/butterknife" style="box-sizing: border-box; color: #75b5aa; text-decoration: none;">Butterknife</a></li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box;">DB will use the local cache CursorLoader do with contentProvider</span></li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box;">JSON parsing will use </span><a href="https://code.google.com/p/google-gson/" style="box-sizing: border-box; color: #75b5aa; text-decoration: none;">GSON</a></li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box;">Notify update data may use </span><a href="https://github.com/greenrobot/EventBus" style="box-sizing: border-box; color: #75b5aa; text-decoration: none;">EventBus</a><span style="box-sizing: border-box;"> or </span><a href="https://github.com/square/otto" style="box-sizing: border-box; color: #75b5aa; text-decoration: none;">otto</a><span style="box-sizing: border-box;"> instead of broadcast</span></li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box;">Message Tip </span><a href="https://github.com/johnkil/Android-AppMsg" style="box-sizing: border-box; color: #75b5aa; text-decoration: none;">AppMsg</a><span style="box-sizing: border-box;"> instead of the system Toast</span></li>
<li style="box-sizing: border-box;"><div style="box-sizing: border-box; margin-bottom: 1rem;">
<span style="box-sizing: border-box;">Round picture </span><a href="https://github.com/hdodenhof/CircleImageView" style="box-sizing: border-box; color: #75b5aa; text-decoration: none;">CircleImageView</a></div>
<hr style="border-bottom-color: rgb(255, 255, 255); border-bottom-style: solid; border-left-width: 0px; border-right-width: 0px; border-top-color: rgb(238, 238, 238); border-top-style: solid; box-sizing: border-box; margin: 1.5rem 0px; position: relative;" />
<div style="box-sizing: border-box; margin-bottom: 1rem;">
<img alt="" src="https://raw.githubusercontent.com/Frank-Zhu/AppCodeArchitecture/master/art/art.jpg" style="border-radius: 5px; box-sizing: border-box; display: block; margin: 0px 0px 1rem; max-width: 100%;" /></div>
</li>
<li style="box-sizing: border-box;"><div style="box-sizing: border-box; margin-bottom: 1rem;">
<span style="box-sizing: border-box;">adapter ListView / GridView adapters are placed in this folder</span></div>
</li>
<li style="box-sizing: border-box;"><div style="box-sizing: border-box; margin-bottom: 1rem;">
<span style="box-sizing: border-box;">The main APP app put some constants and configuration files</span></div>
</li>
<li style="box-sizing: border-box;"><div style="box-sizing: border-box; margin-bottom: 1rem;">
<span style="box-sizing: border-box;">The main activity base and put the base class file fragment</span></div>
</li>
<li style="box-sizing: border-box;"><div style="box-sizing: border-box; margin-bottom: 1rem;">
<span style="box-sizing: border-box;">dao major release database files</span></div>
</li>
</ul>
<div class="highlight" style="box-sizing: border-box;">
<div class="top-box hide" style="box-sizing: border-box;">
<div class="alert-info" style="box-sizing: border-box;">
</div>
</div>
<pre data-codota-status="done" data-csrftoken="3cXy2RPf-8k8DDSMyGSROmzEy367b3G2ZMqE" data-original-code=" database 数据库的表
datahelper 数据库数据操作的帮助类,每一张表派生出一个帮助类操作表
" data-snippet-id="ext.f09d7a9100dfed41c4d7c9c7b38ae2d5" data-snippet-saved="false" style="background-color: #002b36; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #93a1a1; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 15px; line-height: 1.4; margin-bottom: 1rem; overflow: auto; padding: 1rem;"><code class="language-text" data-lang="text" style="background-color: transparent; border-radius: 4px; box-sizing: border-box; color: inherit; font-family: Menlo, Monaco, 'Courier New', monospace; padding: 0px;"><span style="box-sizing: border-box;"><span style="box-sizing: border-box;"> Table database database </span></span><span style="box-sizing: border-box;"><span style="box-sizing: border-box;">
datahelper database data manipulation helper class, each table help derive a class action table</span></span>
</code></pre>
</div>
<ul style="box-sizing: border-box; margin-bottom: 1rem; margin-top: 0px;">
<li style="box-sizing: border-box;"><span style="box-sizing: border-box;">The main fragment file fragment put different pages</span></li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box;">log APP help fight LOG class, you can switch off the output LOG to be removed directly by setting compiled Gradle function mode can also be confused.</span></li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box;">model data model classes folder</span></li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box;">network network operating mainly put files</span><div class="top-box hide" style="box-sizing: border-box;">
<div class="alert-info" style="box-sizing: border-box;">
</div>
</div>
<code data-codota-status="done" data-csrftoken="t4Wqgy38-Xty1jvhp_Tag_nRfFwblX3Segu4" data-original-code="
callback HTTP请求的基类文件存放
controller 主要存放APP中请求网络的控制类操作
" data-snippet-id="ext.ea6516b0f8b04f5ee67d7da36e643c4f" data-snippet-saved="false" style="background-color: #002b36; border-radius: 4px; box-sizing: border-box; color: #93a1a1; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 15px; padding: 0.25em 0.5em;"><span style="box-sizing: border-box;"><span style="box-sizing: border-box;">base class file storage controller callback HTTP requests main storage network control APP requested class action</span></span></code></li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box;">ui main discharge activity file</span></li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box;">utils some help classes are placed in this folder</span></li>
<li style="box-sizing: border-box;"><span style="box-sizing: border-box;">view custom VIEW file</span></li>
</ul>
<div style="box-sizing: border-box; margin-bottom: 1rem;">
<span style="box-sizing: border-box;"><span style="box-sizing: border-box;">Under every file I have done a comment, a reference to the library also gives a link address, most use a little look WIKI should have no problem. </span><span style="box-sizing: border-box;">Finally, the code download address, welcome Star and Fork </span></span><a href="https://github.com/Frank-Zhu/AppCodeArchitecture" style="box-sizing: border-box; color: #75b5aa; text-decoration: none;">github CODE downloads</a></div>
<div style="box-sizing: border-box; margin-bottom: 1rem;">
<span style="box-sizing: border-box;">By the way, in order to encode more quickly, you may spend some of the IDE plug-ins will be more rapid 1, </span><a href="https://github.com/inmite/android-butterknife-zelezny" style="box-sizing: border-box; color: #75b5aa; text-decoration: none;">ButterKnife Plugin</a><span style="box-sizing: border-box;"> , an IDEA plug-in, this should tie in with this open source library </span><a href="https://github.com/JakeWharton/butterknife" style="box-sizing: border-box; color: #75b5aa; text-decoration: none;">ButterKnife</a><span style="box-sizing: border-box;"> use, an annotation library, source As Dragger, by the Great God JakeWharton hand.</span></div>
<div style="box-sizing: border-box; margin-bottom: 1rem;">
<span style="box-sizing: border-box;">2, </span><a href="https://github.com/mcharmas/android-parcelable-intellij-plugin" style="box-sizing: border-box; color: #75b5aa; text-decoration: none;">Parcelable</a><span style="box-sizing: border-box;"> , Andrews data serialization plug, not a last resort before recall will not use Parcelable to serialize, because he wrote it is too much trouble, with the introduction of a plug-in, my mother no longer have to worry about me write arcelable serialized data, and this is a loud noise with a loud noise was great</span></div>
<div style="box-sizing: border-box; margin-bottom: 1rem;">
<span style="box-sizing: border-box;">More plug-in tools can look me in this blog ----> </span><a href="http://frank-zhu.github.io/2014-08-23-android-tools-and-plugin.html" style="box-sizing: border-box; color: #75b5aa; text-decoration: none;">Android handy and popular plug-ins and tools</a></div>
</div>
</div>
<div class="related" style="background-color: white; border-top-color: rgb(238, 238, 238); border-top-style: solid; border-top-width: 1px; box-sizing: border-box; color: #515151; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 20px; line-height: 30px; padding-bottom: 2rem; padding-top: 2rem;">
</div>
</div>
Anonymoushttp://www.blogger.com/profile/16161990470673049263noreply@blogger.com0tag:blogger.com,1999:blog-4479053300163234685.post-90121873970846133212015-09-15T03:30:00.004-07:002015-09-15T03:30:39.876-07:00Fresco Image download library for android<div dir="ltr" style="text-align: left;" trbidi="on">
source: <a href="http://frescolib.org/">http://frescolib.org/</a><br />
<br />
<h1 style="background-color: #fdfdfb; box-sizing: border-box; color: #444444; font-family: proxima-nova, 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 1.4em; margin: 0px 0px 0.2em; padding: 0px; position: relative;">
About Fresco</h1>
<div style="background-color: #fdfdfb; box-sizing: border-box; color: #444444; font-family: proxima-nova, 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 22px; margin-bottom: 1em; padding: 0px;">
Fresco is a powerful system for displaying images in Android applications. It takes care of image loading and display so you don't have to.</div>
<div style="background-color: #fdfdfb; box-sizing: border-box; color: #444444; font-family: proxima-nova, 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 22px; margin-bottom: 1em; padding: 0px;">
Fresco's <em style="box-sizing: border-box; margin: 0px; padding: 0px;">image pipeline</em> will load images from the network, local storage, or local resources. To save data and CPU, it has three levels of cache; two in memory and another in internal storage.</div>
<div style="background-color: #fdfdfb; box-sizing: border-box; color: #444444; font-family: proxima-nova, 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 22px; margin-bottom: 1em; padding: 0px;">
Fresco's <em style="box-sizing: border-box; margin: 0px; padding: 0px;">Drawees</em> show a placeholder for you until the image has loaded and automatically show to the image when it arrives. When the image goes off-screen, it automatically releases its memory.</div>
<div style="background-color: #fdfdfb; box-sizing: border-box; color: #444444; font-family: proxima-nova, 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 22px; margin-bottom: 1em; padding: 0px;">
Fresco supports Android 2.3 (Gingerbread) and later.</div>
</div>
Anonymoushttp://www.blogger.com/profile/16161990470673049263noreply@blogger.com0tag:blogger.com,1999:blog-4479053300163234685.post-52850069439737336192015-09-15T03:29:00.000-07:002015-09-15T03:29:09.308-07:00Splash Screens the Right Way<div dir="ltr" style="text-align: left;" trbidi="on">
<b>source: <a href="https://www.bignerdranch.com/blog/splash-screens-the-right-way/" target="_blank">https://www.bignerdranch.com/blog/splash-screens-the-right-way/</a></b><br />
<br />
<div style="background-color: white; box-sizing: border-box; color: #4d4d4d; font-family: cabritosans-medium, 'Lucida Sans', sans-serif; font-size: 18px; line-height: 28px; padding-bottom: 0.85em; word-wrap: break-word;">
The very idea of the splash screen makes me a little angry. Just saying the phrase makes me cringe.</div>
<div style="background-color: white; box-sizing: border-box; color: #4d4d4d; font-family: cabritosans-medium, 'Lucida Sans', sans-serif; font-size: 18px; line-height: 28px; padding-bottom: 0.85em; word-wrap: break-word;">
Splash screens just waste your time, right? As an Android developer, when I see a splash screen, I know that some poor dev had to add a three-second delay to the code.</div>
<div style="background-color: white; box-sizing: border-box; color: #4d4d4d; font-family: cabritosans-medium, 'Lucida Sans', sans-serif; font-size: 18px; line-height: 28px; padding-bottom: 0.85em; word-wrap: break-word;">
Then, I have to stare at some picture for three seconds until I can use the app. And I have to do this every time it’s launched. I know which app I opened. I know what it does. Just let me use it!</div>
<h2 id="what-google-recommends" style="background-color: white; box-sizing: border-box; color: #4d4d4d; font-family: 'Lucida Bright', Georgia, sans-serif; font-size: 2.4rem; font-weight: normal; line-height: 3.1rem; margin: 0px; padding-bottom: 0.45em; padding-top: 0.5em;">
What Google Recommends</h2>
<div style="background-color: white; box-sizing: border-box; color: #4d4d4d; font-family: cabritosans-medium, 'Lucida Sans', sans-serif; font-size: 18px; line-height: 28px; padding-bottom: 0.85em; word-wrap: break-word;">
You may be surprised to hear that Google advocates that you use a splash screen. It’s right <a href="https://www.google.com/design/spec/patterns/launch-screens.html" style="box-sizing: border-box; color: #e15829; text-decoration: none; word-wrap: break-word;">here</a> in the material design spec.</div>
<div style="background-color: white; box-sizing: border-box; color: #4d4d4d; font-family: cabritosans-medium, 'Lucida Sans', sans-serif; font-size: 18px; line-height: 28px; padding-bottom: 0.85em; word-wrap: break-word;">
This wasn’t always the case; Google used to advocate against splash screens, and even <a href="https://youtu.be/pEGWcMTxs3I?t=1434" style="box-sizing: border-box; color: #e15829; text-decoration: none; word-wrap: break-word;">called it an anti-pattern</a>.</div>
<div style="background-color: white; box-sizing: border-box; color: #4d4d4d; font-family: cabritosans-medium, 'Lucida Sans', sans-serif; font-size: 18px; line-height: 28px; padding-bottom: 0.85em; word-wrap: break-word;">
<a class="lightbox-link" href="https://www.bignerdranch.com/img/blog/2015/08/adia_no_splash.png" style="box-sizing: border-box; color: #e15829; cursor: zoom-in; text-decoration: none; word-wrap: break-word;"><img alt="Adia no splash screen" src="https://www.bignerdranch.com/img/blog/2015/08/adia_no_splash.png" style="border: 0px; box-sizing: border-box; display: block; margin: 5px auto; max-width: 100%;" title="Adia no splash screen" /></a></div>
<div style="background-color: white; box-sizing: border-box; color: #4d4d4d; font-family: cabritosans-medium, 'Lucida Sans', sans-serif; font-size: 18px; line-height: 28px; padding-bottom: 0.85em; word-wrap: break-word;">
What gives?</div>
<h2 id="splash-screens-the-right-way" style="background-color: white; box-sizing: border-box; color: #4d4d4d; font-family: 'Lucida Bright', Georgia, sans-serif; font-size: 2.4rem; font-weight: normal; line-height: 3.1rem; margin: 0px; padding-bottom: 0.45em; padding-top: 0.5em;">
Splash Screens the Right Way</h2>
<div style="background-color: white; box-sizing: border-box; color: #4d4d4d; font-family: cabritosans-medium, 'Lucida Sans', sans-serif; font-size: 18px; line-height: 28px; padding-bottom: 0.85em; word-wrap: break-word;">
I believe that Google isn’t contradicting itself; the old advice and the new stand together. (That said, it’s still not a good idea to use a splash screen that wastes a user’s time. Please don’t do that.)</div>
<div style="background-color: white; box-sizing: border-box; color: #4d4d4d; font-family: cabritosans-medium, 'Lucida Sans', sans-serif; font-size: 18px; line-height: 28px; padding-bottom: 0.85em; word-wrap: break-word;">
However, Android apps do take some amount of time to start up, especially on a cold start. There is a delay there that you may not be able to avoid. Instead of leaving a blank screen during this time, why not show the user something nice? This is the approach Google is advocating. Don’t waste the user’s time, but don’t show them a blank, unconfigured section of the app the first time they launch it, either.</div>
<div style="background-color: white; box-sizing: border-box; color: #4d4d4d; font-family: cabritosans-medium, 'Lucida Sans', sans-serif; font-size: 18px; line-height: 28px; padding-bottom: 0.85em; word-wrap: break-word;">
If you look at recent updates to Google apps, you’ll see appropriate uses of the splash screen. Take a look at the YouTube app, for example.</div>
<div style="background-color: white; box-sizing: border-box; color: #4d4d4d; font-family: cabritosans-medium, 'Lucida Sans', sans-serif; font-size: 18px; line-height: 28px; padding-bottom: 0.85em; word-wrap: break-word;">
<a class="lightbox-link" href="https://www.bignerdranch.com/img/blog/2015/08/youtube_splash.gif" style="box-sizing: border-box; color: #e15829; cursor: zoom-in; text-decoration: none; word-wrap: break-word;"><img alt="YouTube splash screen" src="https://www.bignerdranch.com/img/blog/2015/08/youtube_splash.gif" style="border: 0px; box-sizing: border-box; display: block; margin: 5px auto; max-width: 100%;" title="YouTube splash screen" /></a></div>
<div style="background-color: white; box-sizing: border-box; color: #4d4d4d; font-family: cabritosans-medium, 'Lucida Sans', sans-serif; font-size: 18px; line-height: 28px; padding-bottom: 0.85em; word-wrap: break-word;">
The amount of time you spend looking at this splash screen is exactly the amount of time it takes the app to configure itself. This is on a cold launch, too, which means this is the slowest launch possible. If the app is cached, the splash screen will go away almost immediately.</div>
<h2 id="implementing-a-splash-screen" style="background-color: white; box-sizing: border-box; color: #4d4d4d; font-family: 'Lucida Bright', Georgia, sans-serif; font-size: 2.4rem; font-weight: normal; line-height: 3.1rem; margin: 0px; padding-bottom: 0.45em; padding-top: 0.5em;">
Implementing a Splash Screen</h2>
<div style="background-color: white; box-sizing: border-box; color: #4d4d4d; font-family: cabritosans-medium, 'Lucida Sans', sans-serif; font-size: 18px; line-height: 28px; padding-bottom: 0.85em; word-wrap: break-word;">
Implementing a splash screen the right way is a little different than you might imagine. The splash view that you see has to be ready immediately, even before you can inflate a layout file in your splash activity.</div>
<div style="background-color: white; box-sizing: border-box; color: #4d4d4d; font-family: cabritosans-medium, 'Lucida Sans', sans-serif; font-size: 18px; line-height: 28px; padding-bottom: 0.85em; word-wrap: break-word;">
So you will not use a layout file. Instead, specify your splash screen’s background as the activity’s theme background. To do this, first create an XML drawable in res/drawable.</div>
<div style="background-color: white; box-sizing: border-box; color: #4d4d4d; font-family: cabritosans-medium, 'Lucida Sans', sans-serif; font-size: 18px; line-height: 28px; padding-bottom: 0.85em; word-wrap: break-word;">
<em style="box-sizing: border-box;">Note: all code below is <a href="https://github.com/cstew/Splash" style="box-sizing: border-box; color: #e15829; text-decoration: none; word-wrap: break-word;">available on GitHub</a>.</em></div>
<div class="highlight" style="background: rgb(255, 255, 255); box-sizing: border-box; color: #4d4d4d; font-family: cabritosans-medium, 'Lucida Sans', sans-serif; font-size: 18px; line-height: 28px;">
<div class="top-box hide" style="box-sizing: border-box;">
<div class="alert-info" style="box-sizing: border-box;">
</div>
</div>
<pre data-codota-status="done" data-original-code="<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@color/gray"/>
<item>
<bitmap
android:gravity="center"
android:src="@mipmap/ic_launcher"/>
</item>
</layer-list>" data-snippet-id="ext.5470aa6e1962f6724e19deb7a3223a61" data-snippet-saved="false" style="background: rgb(247, 247, 247); border: 1px solid rgb(226, 226, 226); box-sizing: border-box; font-family: monospace, serif; font-size: 1em; overflow-x: auto; padding: 25px; white-space: pre-wrap;"><code style="box-sizing: border-box; font-family: monospace, serif; font-size: 1em; white-space: pre; word-wrap: inherit;"><span class="cp" style="box-sizing: border-box; color: #999999; font-weight: bold;"><?xml version="1.0" encoding="utf-8"?></span>
<span class="nt" style="box-sizing: border-box; color: navy;"><layer-list</span> <span class="na" style="box-sizing: border-box; color: teal;">xmlns:android=</span><span class="s" style="box-sizing: border-box; color: #dd1144;">"http://schemas.android.com/apk/res/android"</span><span class="nt" style="box-sizing: border-box; color: navy;">></span>
<span class="nt" style="box-sizing: border-box; color: navy;"><item</span>
<span class="na" style="box-sizing: border-box; color: teal;">android:drawable=</span><span class="s" style="box-sizing: border-box; color: #dd1144;">"@color/gray"</span><span class="nt" style="box-sizing: border-box; color: navy;">/></span>
<span class="nt" style="box-sizing: border-box; color: navy;"><item></span>
<span class="nt" style="box-sizing: border-box; color: navy;"><bitmap</span>
<span class="na" style="box-sizing: border-box; color: teal;">android:gravity=</span><span class="s" style="box-sizing: border-box; color: #dd1144;">"center"</span>
<span class="na" style="box-sizing: border-box; color: teal;">android:src=</span><span class="s" style="box-sizing: border-box; color: #dd1144;">"@mipmap/ic_launcher"</span><span class="nt" style="box-sizing: border-box; color: navy;">/></span>
<span class="nt" style="box-sizing: border-box; color: navy;"></item></span>
<span class="nt" style="box-sizing: border-box; color: navy;"></layer-list></span></code></pre>
</div>
<div style="background-color: white; box-sizing: border-box; color: #4d4d4d; font-family: cabritosans-medium, 'Lucida Sans', sans-serif; font-size: 18px; line-height: 28px; padding-bottom: 0.85em; word-wrap: break-word;">
Here, I’ve set up a background color and an image.</div>
<div style="background-color: white; box-sizing: border-box; color: #4d4d4d; font-family: cabritosans-medium, 'Lucida Sans', sans-serif; font-size: 18px; line-height: 28px; padding-bottom: 0.85em; word-wrap: break-word;">
Next, you will set this as your splash activity’s background in the theme. Navigate to your styles.xml file and add a new theme for your splash activity:</div>
<div class="highlight" style="background: rgb(255, 255, 255); box-sizing: border-box; color: #4d4d4d; font-family: cabritosans-medium, 'Lucida Sans', sans-serif; font-size: 18px; line-height: 28px;">
<div class="top-box hide" style="box-sizing: border-box;">
<div class="alert-info" style="box-sizing: border-box;">
</div>
</div>
<pre data-codota-status="done" data-original-code="<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowBackground">@drawable/background_splash</item>
</style>
</resources>" data-snippet-id="ext.0ebad84d43291d64cd8f5620873824bb" data-snippet-saved="false" style="background: rgb(247, 247, 247); border: 1px solid rgb(226, 226, 226); box-sizing: border-box; font-family: monospace, serif; font-size: 1em; overflow-x: auto; padding: 25px; white-space: pre-wrap;"><code style="box-sizing: border-box; font-family: monospace, serif; font-size: 1em; white-space: pre; word-wrap: inherit;"><span class="nt" style="box-sizing: border-box; color: navy;"><resources></span>
<span class="c" style="box-sizing: border-box; color: #999988; font-style: italic;"><!-- Base application theme. --></span>
<span class="nt" style="box-sizing: border-box; color: navy;"><style</span> <span class="na" style="box-sizing: border-box; color: teal;">name=</span><span class="s" style="box-sizing: border-box; color: #dd1144;">"AppTheme"</span> <span class="na" style="box-sizing: border-box; color: teal;">parent=</span><span class="s" style="box-sizing: border-box; color: #dd1144;">"Theme.AppCompat.Light.DarkActionBar"</span><span class="nt" style="box-sizing: border-box; color: navy;">></span>
<span class="c" style="box-sizing: border-box; color: #999988; font-style: italic;"><!-- Customize your theme here. --></span>
<span class="nt" style="box-sizing: border-box; color: navy;"></style></span>
<span class="nt" style="box-sizing: border-box; color: navy;"><style</span> <span class="na" style="box-sizing: border-box; color: teal;">name=</span><span class="s" style="box-sizing: border-box; color: #dd1144;">"SplashTheme"</span> <span class="na" style="box-sizing: border-box; color: teal;">parent=</span><span class="s" style="box-sizing: border-box; color: #dd1144;">"Theme.AppCompat.NoActionBar"</span><span class="nt" style="box-sizing: border-box; color: navy;">></span>
<span class="nt" style="box-sizing: border-box; color: navy;"><item</span> <span class="na" style="box-sizing: border-box; color: teal;">name=</span><span class="s" style="box-sizing: border-box; color: #dd1144;">"android:windowBackground"</span><span class="nt" style="box-sizing: border-box; color: navy;">></span>@drawable/background_splash<span class="nt" style="box-sizing: border-box; color: navy;"></item></span>
<span class="nt" style="box-sizing: border-box; color: navy;"></style></span>
<span class="nt" style="box-sizing: border-box; color: navy;"></resources></span></code></pre>
</div>
<div style="background-color: white; box-sizing: border-box; color: #4d4d4d; font-family: cabritosans-medium, 'Lucida Sans', sans-serif; font-size: 18px; line-height: 28px; padding-bottom: 0.85em; word-wrap: break-word;">
In your new <code style="box-sizing: border-box; font-family: monospace, serif; font-size: 1em; white-space: pre-wrap; word-wrap: break-word;">SplashTheme</code>, set the window background attribute to your XML drawable. Configure this as your splash activity’s theme in your <code style="box-sizing: border-box; font-family: monospace, serif; font-size: 1em; white-space: pre-wrap; word-wrap: break-word;">AndroidManifest.xml</code>:</div>
<div class="highlight" style="background: rgb(255, 255, 255); box-sizing: border-box; color: #4d4d4d; font-family: cabritosans-medium, 'Lucida Sans', sans-serif; font-size: 18px; line-height: 28px;">
<div class="top-box hide" style="box-sizing: border-box;">
<div class="alert-info" style="box-sizing: border-box;">
</div>
</div>
<pre data-codota-status="done" data-original-code="<activity
android:name=".SplashActivity"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>" data-snippet-id="ext.0d92031025c2c0bbfe8ad391ff5210ad" data-snippet-saved="false" style="background: rgb(247, 247, 247); border: 1px solid rgb(226, 226, 226); box-sizing: border-box; font-family: monospace, serif; font-size: 1em; overflow-x: auto; padding: 25px; white-space: pre-wrap;"><code style="box-sizing: border-box; font-family: monospace, serif; font-size: 1em; white-space: pre; word-wrap: inherit;"><span class="nt" style="box-sizing: border-box; color: navy;"><activity</span>
<span class="na" style="box-sizing: border-box; color: teal;">android:name=</span><span class="s" style="box-sizing: border-box; color: #dd1144;">".SplashActivity"</span>
<span class="na" style="box-sizing: border-box; color: teal;">android:theme=</span><span class="s" style="box-sizing: border-box; color: #dd1144;">"@style/SplashTheme"</span><span class="nt" style="box-sizing: border-box; color: navy;">></span>
<span class="nt" style="box-sizing: border-box; color: navy;"><intent-filter></span>
<span class="nt" style="box-sizing: border-box; color: navy;"><action</span> <span class="na" style="box-sizing: border-box; color: teal;">android:name=</span><span class="s" style="box-sizing: border-box; color: #dd1144;">"android.intent.action.MAIN"</span> <span class="nt" style="box-sizing: border-box; color: navy;">/></span>
<span class="nt" style="box-sizing: border-box; color: navy;"><category</span> <span class="na" style="box-sizing: border-box; color: teal;">android:name=</span><span class="s" style="box-sizing: border-box; color: #dd1144;">"android.intent.category.LAUNCHER"</span> <span class="nt" style="box-sizing: border-box; color: navy;">/></span>
<span class="nt" style="box-sizing: border-box; color: navy;"></intent-filter></span>
<span class="nt" style="box-sizing: border-box; color: navy;"></activity></span></code></pre>
</div>
<div style="background-color: white; box-sizing: border-box; color: #4d4d4d; font-family: cabritosans-medium, 'Lucida Sans', sans-serif; font-size: 18px; line-height: 28px; padding-bottom: 0.85em; word-wrap: break-word;">
Finally, your <code style="box-sizing: border-box; font-family: monospace, serif; font-size: 1em; white-space: pre-wrap; word-wrap: break-word;">SplashActivity</code> class should just forward you along to your main activity:</div>
<div class="highlight" style="background: rgb(255, 255, 255); box-sizing: border-box; color: #4d4d4d; font-family: cabritosans-medium, 'Lucida Sans', sans-serif; font-size: 18px; line-height: 28px;">
<div class="top-box hide" style="box-sizing: border-box;">
<div class="alert-info" style="box-sizing: border-box;">
</div>
</div>
<pre data-codota-status="done" data-csrftoken="7TEmZUiO-bjZVE-p41Oow6wUdn2CmKdCuU6U" data-original-code="public class SplashActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
finish();
}
}" data-snippet-id="ext.666e29590a3c815aadadeac29c0d890c" data-snippet-saved="false" style="background: rgb(247, 247, 247); border: 1px solid rgb(226, 226, 226); box-sizing: border-box; font-family: monospace, serif; font-size: 1em; overflow-x: auto; padding: 25px; white-space: pre-wrap;"><code style="box-sizing: border-box; font-family: monospace, serif; font-size: 1em; white-space: pre; word-wrap: inherit;"><span class="kd" style="box-sizing: border-box; font-weight: bold;">public</span> <span class="kd" style="box-sizing: border-box; font-weight: bold;">class</span> <span class="nc" style="box-sizing: border-box; color: #445588; font-weight: bold;">SplashActivity</span> <span class="kd" style="box-sizing: border-box; font-weight: bold;">extends</span> <span class="n" style="box-sizing: border-box;">AppCompatActivity</span> <span class="o" style="box-sizing: border-box; font-weight: bold;">{</span>
<span class="nd" style="box-sizing: border-box;">@Override</span>
<span class="kd" style="box-sizing: border-box; font-weight: bold;">protected</span> <span class="kt" style="box-sizing: border-box; color: #445588; font-weight: bold;">void</span> <span class="n" style="box-sizing: border-box;">onCreate</span><span class="o" style="box-sizing: border-box; font-weight: bold;">(</span><span class="n" style="box-sizing: border-box;">Bundle</span> <span class="n" style="box-sizing: border-box;">savedInstanceState</span><span class="o" style="box-sizing: border-box; font-weight: bold;">)</span> <span class="o" style="box-sizing: border-box; font-weight: bold;">{</span>
<span class="kd" style="box-sizing: border-box; font-weight: bold;">super</span><span class="o" style="box-sizing: border-box; font-weight: bold;">.</span><span class="na" style="box-sizing: border-box; color: teal;">onCreate</span><span class="o" style="box-sizing: border-box; font-weight: bold;">(</span><span class="n" style="box-sizing: border-box;">savedInstanceState</span><span class="o" style="box-sizing: border-box; font-weight: bold;">);</span>
<span class="n" style="box-sizing: border-box;">Intent</span> <span class="n" style="box-sizing: border-box;">intent</span> <span class="o" style="box-sizing: border-box; font-weight: bold;">=</span> <span class="k" style="box-sizing: border-box; font-weight: bold;">new</span> <span class="n" style="box-sizing: border-box;">Intent</span><span class="o" style="box-sizing: border-box; font-weight: bold;">(</span><span class="k" style="box-sizing: border-box; font-weight: bold;">this</span><span class="o" style="box-sizing: border-box; font-weight: bold;">,</span> <span class="n" style="box-sizing: border-box;">MainActivity</span><span class="o" style="box-sizing: border-box; font-weight: bold;">.</span><span class="na" style="box-sizing: border-box; color: teal;">class</span><span class="o" style="box-sizing: border-box; font-weight: bold;">);</span>
<span class="n" style="box-sizing: border-box;">startActivity</span><span class="o" style="box-sizing: border-box; font-weight: bold;">(</span><span class="n" style="box-sizing: border-box;">intent</span><span class="o" style="box-sizing: border-box; font-weight: bold;">);</span>
<span class="n" style="box-sizing: border-box;">finish</span><span class="o" style="box-sizing: border-box; font-weight: bold;">();</span>
<span class="o" style="box-sizing: border-box; font-weight: bold;">}</span>
<span class="o" style="box-sizing: border-box; font-weight: bold;">}</span></code></pre>
</div>
<div style="background-color: white; box-sizing: border-box; color: #4d4d4d; font-family: cabritosans-medium, 'Lucida Sans', sans-serif; font-size: 18px; line-height: 28px; padding-bottom: 0.85em; word-wrap: break-word;">
Notice that you don’t even set up a view for this <code style="box-sizing: border-box; font-family: monospace, serif; font-size: 1em; white-space: pre-wrap; word-wrap: break-word;">SplashActivity</code>. The view comes from the theme. When you set up the UI for your splash activity in the theme, it is available immediately.</div>
<div style="background-color: white; box-sizing: border-box; color: #4d4d4d; font-family: cabritosans-medium, 'Lucida Sans', sans-serif; font-size: 18px; line-height: 28px; padding-bottom: 0.85em; word-wrap: break-word;">
If you did have a layout file for your splash activity, that layout file would be visible to the user only after your app has been fully initialized, which is too late. You want the splash to be displayed only in that small amount of time before the app is initialized.</div>
<h2 id="doing-it-right" style="background-color: white; box-sizing: border-box; color: #4d4d4d; font-family: 'Lucida Bright', Georgia, sans-serif; font-size: 2.4rem; font-weight: normal; line-height: 3.1rem; margin: 0px; padding-bottom: 0.45em; padding-top: 0.5em;">
Doing it Right</h2>
<div style="background-color: white; box-sizing: border-box; color: #4d4d4d; font-family: cabritosans-medium, 'Lucida Sans', sans-serif; font-size: 18px; line-height: 28px; padding-bottom: 0.85em; word-wrap: break-word;">
With these steps completed, you will have a splash screen implemented the right way:</div>
<div style="background-color: white; box-sizing: border-box; color: #4d4d4d; font-family: cabritosans-medium, 'Lucida Sans', sans-serif; font-size: 18px; line-height: 28px; padding-bottom: 0.85em; word-wrap: break-word;">
<a class="lightbox-link" href="https://www.bignerdranch.com/img/blog/2015/08/sample_splash.gif" style="box-sizing: border-box; color: #e15829; cursor: zoom-in; text-decoration: none; word-wrap: break-word;"><img alt="Sample splash screen" src="https://www.bignerdranch.com/img/blog/2015/08/sample_splash.gif" style="border: 0px; box-sizing: border-box; display: block; margin: 5px auto; max-width: 100%;" title="Sample splash screen" /></a></div>
<div style="background-color: white; box-sizing: border-box; color: #4d4d4d; font-family: cabritosans-medium, 'Lucida Sans', sans-serif; font-size: 18px; line-height: 28px; padding-bottom: 0.85em; word-wrap: break-word;">
Armed with this knowledge, make your splash screen work the right way. Don’t waste the user’s time, but give them something nice to look at while they wait.</div>
</div>
Anonymoushttp://www.blogger.com/profile/16161990470673049263noreply@blogger.com0