This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.http.HttpVersion; | |
import org.apache.http.client.HttpClient; | |
import org.apache.http.conn.ClientConnectionManager; | |
import org.apache.http.conn.params.ConnManagerParams; | |
import org.apache.http.conn.scheme.PlainSocketFactory; | |
import org.apache.http.conn.scheme.Scheme; | |
import org.apache.http.conn.scheme.SchemeRegistry; | |
import org.apache.http.conn.ssl.SSLSocketFactory; | |
import org.apache.http.impl.client.DefaultHttpClient; | |
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public View getView(int position, View convertView, ViewGroup parent) { | |
ViewHolder vh = ViewHolder.get(convertView, parent); | |
Item item = getItem(position); | |
vh.title.setText(item.title); | |
vh.subtitle.setText(item.subtitle); | |
return vh.root; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.mtgclient.util; | |
import java.io.File; | |
import java.io.FilenameFilter; | |
/** | |
* Class for filtering File objects based on specific extension. | |
* | |
* @author e.shishkin | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.miz.heapsize; | |
import android.app.Activity; | |
import android.app.ActivityManager; | |
import android.os.Bundle; | |
import android.widget.TextView; | |
public class CheckHeapActivity extends Activity { | |
private TextView text; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2012 Square, Inc. | |
package com.squareup.widgets; | |
import android.content.Context; | |
import android.content.res.TypedArray; | |
import android.util.AttributeSet; | |
import android.widget.ImageView; | |
/** Maintains an aspect ratio based on either width or height. Disabled by default. */ | |
public class AspectRatioImageView extends ImageView { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) ListView=>Use android:cacheColorHint=”@android:color/transparent” to avoid black highlighting while Scrolling. | |
2) To resolve this issue “Failed to install *.apk on device timeout Launch canceled! , increase ADB connection timeout | |
3) use setError() to display error message for your EditText | |
4) To Block the default animation for startActivity() For ex: myIntent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); | |
5) Android Action Bar Style Generator http://jgilfelt.github.com/android-actionbarstylegenerator | |
6) create library with reusable code and reference it in future projects. | |
7) Don’t use right-pointing carets on line items http://developer.android.com/design/media/migrating_ios_settings.png | |
8) 10 amazing Android development tips http://www.netmagazine.com/features/10-amazing-android-development-tips | |
9) Define these attributes for displaying multiline EditText => android:singleLine=”false”, android:lines=”5″ | |
10) Follow Dashboard design pattern. Easy to implement and handle Navigation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Execute an {@link AsyncTask} on a thread pool. | |
* | |
* @param task Task to execute. | |
* @param args Optional arguments to pass to {@link AsyncTask#execute(Object[])}. | |
* @param <T> Task argument type. | |
*/ | |
public <T> void execute(AsyncTask<T, ?, ?> task, T... args) { | |
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.DONUT) { | |
throw new UnsupportedOperationException("This class can only be used on API 4 and newer."); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.app.Activity; | |
import android.graphics.Bitmap; | |
import android.graphics.Bitmap.Config; | |
import android.graphics.Canvas; | |
import android.view.View; | |
public class ScreenShot { | |
private final View view; | |
/** Create snapshots based on the view and its children. */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Shows the keyboard. | |
* | |
* @param view | |
*/ | |
public void showKeyboard(View view) { | |
Context context = view.getContext(); | |
InputMethodManager imm = (InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE); | |
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Getting external files/cache dir [compatibility]. | |
* | |
* @author johnkil | |
* | |
*/ | |
public class FileUtils { | |
private static final String LOG_TAG = FileUtils.class.getSimpleName(); | |
/** |
OlderNewer