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 void validateCursor(Cursor valueCursor, ContentValues expectedValues){ | |
assertTrue(valueCursor.moveToFirst()); | |
Set<Map.Entry<String, Object>> valueSet = expectedValues.valueSet(); | |
for(Map.Entry<String, Object> entry : valueSet){ | |
String columnName = entry.getKey(); | |
int idx = valueCursor.getColumnIndex(columnName); | |
assertFalse(idx == -1); | |
switch(columnName){ |
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
// onCreateLoader: | |
@Override | |
public Loader<Cursor> onCreateLoader(int id, Bundle args) { | |
switch(id){ | |
case ACCOUNT_LOADER: | |
return new CursorLoader( | |
getActivity(), | |
AccountEntry.buildAccountUri(mAccountID), | |
new String[]{ | |
AccountEntry.TABLE_NAME + "." + AccountEntry._ID, |
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 test_getFormattedCurrency(){ | |
// Test double without decimal points | |
assertEquals("$100.00", Utility.getFormattedCurrency(100)); | |
// Test with one decimal point | |
assertEquals("$100.00", Utility.getFormattedCurrency(100.0)); | |
// Test with two decimal points | |
assertEquals("$100.00", Utility.getFormattedCurrency(100.00)); |
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 static String getUIDateString(LocalDate d){ | |
// Do not allow dates with negative years | |
if(d.getYear() < 0){ | |
throw new UnsupportedOperationException("LocalDate has negative year value."); | |
} else { | |
DateTimeFormatter dtf = DateTimeFormat.forPattern(UI_DATE_FORMAT); | |
return dtf.print(d); | |
} | |
} |
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 HttpExampleActivity extends Activity { | |
private static final String DEBUG_TAG = "HttpExample"; | |
private EditText urlText; | |
private TextView textView; | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout_main); | |
urlText = (EditText) findViewById(R.id.myUrl); |
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 HttpExampleActivity extends Activity { | |
private static final String DEBUG_TAG = "HttpExample"; | |
private EditText urlText; | |
private TextView textView; | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout_main); | |
urlText = (EditText) findViewById(R.id.myUrl); |
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 ListView mTransactionListView = (ListView) view.findViewById(R.id.transactionListView); | |
// Set header view | |
mAccountBalanceHeader = (TextView) inflater.inflate(R.layout.account_balance_header, container, false); | |
mTransactionListView.setHeaderDividersEnabled(true); | |
mTransactionListView.addHeaderView(mAccountBalanceHeader); | |
// Set adapter | |
mTransactionListView.setAdapter(mTransactionAdapter); |
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
protected void onCreate(Bundle savedInstanceState){ | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
// Get the top text view | |
TextView top = (TextView) findViewById(R.id.top_text_view); | |
// Get the bottom text view | |
TextView bottom = (TextView) findViewById(R.id.bottom_text_view); | |
} |
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"?> | |
<manifest | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
package="com.example.app" > | |
<uses-permission android:name="android.permission.READ_CONTACTS"/> | |
<application | |
android:allowBackup="true" | |
android:icon="@mipmap/ic_launcher" |
OlderNewer