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
LayoutInflater mInflater = (LayoutInflater) parent.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); | |
View row = mInflater.inflate(R.layout.simple_list_item_1, parent, false); | |
TextView someTextView = (TextView)view.findViewById(R.id.txt_xxx); |
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"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:orientation="horizontal" android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:padding="10dp" | |
android:gravity="center_vertical" | |
android:background="#FFFFFF"> | |
<ImageView | |
android:layout_width="50dp" |
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
{"Hardware Info":{"Android Info":{"System Type":"32-bit","Android Version":"5.1","Version Code":"Lollipop","API Version":"22","Incremental":"1743759","Codename":"REL"},"Build Info":{"Board":"shamu","Bootloader":"0x7108","Brand":"google","Characteristic":"nosdcard","CPU ABI":"armeabi-v7a","CPU ABI 2":"armeabi","Device":"shamu","Display":"LMY47D","Fingerprint":"google/shamu/shamu:5.1/LMY47D/1743759:user/release-keys","Hardware":"shamu","Host":"wpiu12.hot.corp.google.com","ID":"LMY47D","Manufacturer":"motorola","Model":"Nexus 6","Product":"shamu","Radio":"MDM9625_104446.01.02.95R","Serial":"ZX1G5236PK","Supported ABIS":"armeabi-v7a armeabi","Supported 32-bit ABIS":"armeabi-v7a armeabi","Supported 64-bit ABIS":"","Tags":"release-keys","Time":"1424322888000","Type":"user","User":"android-build"},"Communication Info":{"Vibrate Motor":"Yes","Microphone":"Yes","Telephony":"Yes","Cellular":"Yes","GPS":"Yes","Bluetooth":"Yes","Bluetooth LE":"Yes","WiFi":"Yes","WiFi Direct":"Yes","Ethernet":"Yes","WiMax":"No","USB OTG": |
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.akexorcist.fragmenttest; | |
import android.os.Bundle; | |
import android.support.v4.app.Fragment; | |
import android.support.v4.app.FragmentManager; | |
import android.support.v4.app.FragmentTransaction; | |
import android.support.v7.app.ActionBarActivity; | |
import android.view.View; | |
import android.widget.Button; | |
import android.widget.LinearLayout; |
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
TestCase – Plain old JUnit test case. It can be extended to test utility classes that are not tied to the Android framework. | |
AndroidTestCase – It extends JUnit’s TestCase. It’s a lighter testing class compared to ActivityTestCase. It doesn’t need to launch an activity to run it. Its getContext() method allows you to get an injected context if you need one. Since you can get a context from this class, you can inflate your UI objects to test their behaviors. | |
ActivityInstrumentationTestCase2 – It’s the newer version of ActivityInstrumentationTestCase. ActivityInstrumentationTestCase is deprecated in Android SDK 1.5. It’s a heavier testing class compared to AndroidTestCase. It provides UI and functional testing for a single activity. You can get an injected activity that you are testing on by calling its getActivity() method. The activity being tested is launched and finished before and after each test. | |
ActivityUnitTestCase – It gives the tested activity an isolated environment. When using it to test an activit |
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 CallServiceRunnable extends SomeRunnable { | |
private SomeProviderDelegate delegate; | |
private SomeException exception; | |
private SomeObject object; | |
public CheckMSISDNRunnable(SomeProviderDelegate delegate) { | |
super(httpClient); | |
this.delegate = delegate; | |
} | |
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.droidsans.photo.droidphoto; | |
import android.app.Application; | |
import android.content.Context; | |
public class BaseApplication extends Application { | |
private static Context context; | |
@Override | |
public void onCreate() { |
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 startReceiver() { | |
registerReceiver(broadcastReceiver, new IntentFilter(DELIVERED)); | |
} | |
public void stopReceiver() { | |
unregisterReceiver(broadcastReceiver); | |
} | |
BroadcastReceiver broadcastReceiver = new BroadcastReceiver() { | |
@Override |
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
stringmessage.replaceAll("\\(?\\b(http://|www[.])([-A-Za-z0-9+&@#/%?=~_()|!:,.;]{9})[-A-Za-z0-9+&@#/%?=~_()|!:,.;]*[-A-Za-z0-9+&@#/%=~_()|]", "<a href=\"$0\">$2...</a>"); |
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
String data = "<b>อุณหภูมิ : </b>29.7 องศาเซลเซียส <br />\n" + | |
"<b>ความชื้นสัมพัทธ์ : </b> 67 % <br />\n" + | |
"<b>ความกดอากาศ : </b> 1011.08 มิลลิบาร์ <br /> \n" + | |
"<b>ทิศทางลม : </b> ทิศตะวันตกค่อนไปทางเหนือ <b>ความเร็ว </b> 7.4 กม./ชม.<br /> \n" + | |
"<b>ทัศนวิสัย : </b> 10.0 กิโลเมตร <br />\n" + | |
"<b>ลักษณะอากาศ : </b> มีเมฆบางส่วน <br />\n" + | |
"<b>ฝนสะสมวันนี้ : </b> 0.0 มิลลิเมตร <br/>\n" + | |
"<b>พระอาทิตย์ขึ้นเช้าพรุ่งนี้: </b>06:41 น. <br />\n" + | |
"<b>พระอาทิตย์ตกเย็นวันนี้: </b>18:23 น."; |