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
DialogFragment dg = new DialogFragment() { | |
@Override | |
public Dialog onCreateDialog(Bundle savedInstanceState) { | |
return new AlertDialog.Builder(getActivity()) | |
.setMessage(R.string.submit_confirm_message) | |
.setPositiveButton(R.string.submit_confirm_button, new DialogInterface.OnClickListener() { | |
@Override | |
public void onClick(DialogInterface dialogInterface, int i) { | |
/*---THIS IS ADDED EXTRA--------*/ | |
postInfoToServer(); |
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
Cursor cursor = getContentResolver().query(Media.EXTERNAL_CONTENT_URI, new String[]{Media.DATA, Media.DATE_ADDED, MediaStore.Images.ImageColumns.ORIENTATION}, Media.DATE_ADDED, null, "date_added ASC"); | |
if(cursor != null && cursor.moveToFirst()) | |
{ | |
do { | |
uri = Uri.parse(cursor.getString(cursor.getColumnIndex(Media.DATA))); | |
photoPath = uri.toString(); | |
}while(cursor.moveToNext()); | |
cursor.close(); | |
} |
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
ByteArrayOutputStream bos = new ByteArrayOutputStream(); | |
bitmap.compress(CompressFormat.PNG, 0 /*ignored for PNG*/, bos); | |
byte[] bitmapdata = bos.toByteArray(); | |
ByteArrayInputStream bs = new ByteArrayInputStream(bitmapdata); |
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 class BaseEditText extends EditText { | |
public BaseEditText(Context context) { | |
this(context, null); | |
} | |
public BaseEditText(Context context, AttributeSet attrs) { | |
this(context, attrs, 0); | |
} | |
public BaseEditText(Context context, AttributeSet attrs, int defStyle) { |
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
{ | |
"following": [ | |
{ | |
"name" : "john doe", | |
"following" : true, | |
"created_at" : "1 hour ago", | |
"picture" : "http://i.imgur.com/DA8VXak.jpg" | |
}, | |
{ | |
"name" : "john doe", |
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
<?xml version="1.0" encoding="utf-8"?> | |
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" > | |
<!-- Drop Shadow Stack --> | |
<item> | |
<shape> | |
<corners android:radius="10dp" /> | |
<padding | |
android:bottom="1dp" |
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
//Terms of Service | |
String tobeClickable = getString(R.string.tos); | |
int index = getString(R.string.terms_of_service).indexOf(tobeClickable); | |
int length = index + tobeClickable.length(); | |
//I agree to FireSonar's Terms of Service | |
Spannable spannableString = new SpannableString( | |
getString(R.string.terms_of_service)); | |
ClickableSpan clickableSpan = new ClickableSpan() { |
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 void hideSoftInputKeyBoard(View view) { | |
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); | |
if (imm != null && view != null) { | |
imm.hideSoftInputFromWindow(view.getWindowToken(), 0); | |
} | |
} |
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
TypedValue outValue = new TypedValue(); | |
getTheme().resolveAttribute(R.attr.themeName, outValue, true); | |
if(outValue.equals(getString(R.string.custom_title_theme))){ | |
//you have applied this theme else not | |
} | |
//http://stackoverflow.com/questions/7267852/android-how-to-obtain-the-resource-id-of-the-current-theme |
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 class SomeFragment extends Fragment { | |
MapView mapView; | |
GoogleMap map; | |
@Override | |
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { | |
View v = inflater.inflate(R.layout.some_layout, container, false); | |