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"?> | |
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |
<item android:color="@color/blue" android:state_pressed="true" /> | |
<item android:color="@color/blue" android:state_selected="true" /> | |
<item android:color="@android:color/white" /> | |
</selector> |
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
private int getLastImageId() { | |
final String[] imageColumns = {MediaStore.Images.Media._ID, MediaStore.Images.Media.DATA}; | |
final String imageOrderBy = MediaStore.Images.Media._ID + " DESC"; | |
Cursor imageCursor = getActivity().getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, imageColumns, null, null, imageOrderBy); | |
if (imageCursor.moveToFirst()) { | |
int id = imageCursor.getInt(imageCursor.getColumnIndex(MediaStore.Images.Media._ID)); | |
String fullPath = imageCursor.getString(imageCursor.getColumnIndex(MediaStore.Images.Media.DATA)); | |
Log.d(TAG, "getLastImageId::id " + id); | |
Log.d(TAG, "getLastImageId::path " + fullPath); | |
imageCursor.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
//http://stackoverflow.com/questions/2662531/launching-google-maps-directions-via-an-intent-on-android | |
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, | |
Uri.parse("http://maps.google.com/maps?saddr="+latitude_source+","+longitude_source+"&daddr="+latitude_dest+","+longitude_dest)); | |
startActivity(intent); | |
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, | |
Uri.parse("google.navigation:q=an+address+city")); |
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
//http://stackoverflow.com/questions/13812892/enable-scrollable-edittext-within-a-scrollview-and-viewflipper/13815747#13815747 | |
EditText EtOne = (EditText) findViewById(R.id.EditText01); | |
EtOne.setOnTouchListener(new OnTouchListener() { | |
@Override | |
public boolean onTouch(View v, MotionEvent event) { | |
if (v.getId() == R.id.comment1) { | |
v.getParent().requestDisallowInterceptTouchEvent(true); | |
switch (event.getAction() & MotionEvent.ACTION_MASK) { | |
case MotionEvent.ACTION_UP: | |
v.getParent().requestDisallowInterceptTouchEvent(false); |
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
Intent emailIntent = new Intent(Intent.ACTION_SEND_MULTIPLE); | |
emailIntent.setType("text/plain"); | |
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Payment Information"); | |
emailIntent.putExtra(Intent.EXTRA_TEXT, stringBuilder.toString()); | |
emailIntent.putExtra(Intent.EXTRA_EMAIL, | |
new String[] { emailValue }); | |
ArrayList<Uri> uris = new ArrayList<Uri>(); | |
// convert from paths to Android friendly Parcelable Uri's | |
Uri uri = null; |
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
final TextView tv = new TextView(this); | |
final SpannableString s = new SpannableString(response); | |
Linkify.addLinks(s, Linkify.WEB_URLS); | |
tv.setText(s); | |
tv.setMovementMethod(LinkMovementMethod.getInstance()); | |
AlertDialog dialog = new AlertDialog.Builder(this) | |
.setPositiveButton(android.R.string.ok, null) | |
.setView(tv).create(); | |
dialog.show(); |
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
//http://rosettacode.org/wiki/Luhn_test_of_credit_card_numbers#Java | |
public static boolean isEmptyString(String stringValue) { | |
return stringValue == null || stringValue.trim().length() == 0; | |
} | |
public static boolean isCreditCardValid(String number) { | |
if (isEmptyString(number)) | |
return false; | |
int s1 = 0, s2 = 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
[ | |
{ | |
"IsAddedByMe": true, | |
"IsFavorite": true, | |
"Latitude": 27.684554, | |
"LocationAddress": "test", | |
"LocationId": 6068, | |
"LocationImgUrl": "http://firesonar.blob.core.windows.net/checkinlocations/test.png", | |
"LocationName": "test", | |
"Longitude": 85.333882, |
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
Fragment fragment = (Fragment) mPagerAdapter.instantiateItem(mPager, mPager.getCurrentItem()); |
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
final TextView tv = new TextView(this); | |
final SpannableString s = new SpannableString(result); | |
Linkify.addLinks(s, Linkify.WEB_URLS); | |
tv.setText(s); | |
tv.setMovementMethod(LinkMovementMethod.getInstance()); | |
DialogFragment dg = new DialogFragment() { | |
@Override | |
public Dialog onCreateDialog(Bundle savedInstanceState) { | |
return new AlertDialog.Builder(getActivity()) |