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
public class QuizModel { | |
public String strQuiz = null; | |
public String strAnwser = null; | |
public QuizModel(String strQuiz, String strAnwser) { | |
this.strQuiz = strQuiz; | |
this.strAnwser = strAnwser; | |
} | |
public String getQuiz() { |
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 app.akexorcist.googledapsample; | |
import org.w3c.dom.Document; | |
import com.google.android.gms.maps.CameraUpdateFactory; | |
import com.google.android.gms.maps.GoogleMap; | |
import com.google.android.gms.maps.SupportMapFragment; | |
import com.google.android.gms.maps.model.BitmapDescriptorFactory; | |
import com.google.android.gms.maps.model.LatLng; | |
import com.google.android.gms.maps.model.MarkerOptions; |
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
Button btn1 = (Button)findViewById(R.id.btn1); | |
btn1.setOnClickLlistener(new OnClickListener() { | |
public void onClick(View v) { | |
// Button 1 Command | |
} | |
}); | |
Button btn2 = (Button)findViewById(R.id.btn2); | |
btn2.setOnClickLlistener(new OnClickListener() { | |
public void onClick(View v) { |
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 int dpToPx(Context context, int dp) { | |
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics(); | |
int px = Math.round(dp * (displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT)); | |
return px; | |
} | |
public int pxToDp(Context context, int px) { | |
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics(); | |
int dp = Math.round(px / (displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT)); | |
return dp; |
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
ConnectivityManager cm = (ConnectivityManager) getActivity().getSystemService(Context.CONNECTIVITY_SERVICE); | |
NetworkInfo netInfo = cm.getActiveNetworkInfo(); | |
if (netInfo != null && netInfo.isConnected()) { | |
try { | |
URL pingUrl = new URL("http://www.google.com"); | |
HttpURLConnection urlc = (HttpURLConnection)pingUrl.openConnection(); | |
urlc.setConnectTimeout(3000); | |
urlc.connect(); | |
if (urlc.getResponseCode() == 200) { | |
// ผู้ใช้ต่อเนตและใช้งานได้ |
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"?> | |
<shape xmlns:android="http://schemas.android.com/apk/res/android" | |
android:shape="oval" > | |
<solid android:color="@color/light_green" /> | |
</shape> |
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 Bitmap resizeBitmap(Bitmap bm, int maxWidth, int maxHeight) { | |
int newWidth, newHeight; | |
int bmWidth = bm.getWidth(); | |
int bmHeight = bm.getHeight(); | |
if(bmWidth > maxWidth && (maxWidth * bmHeight) / bmWidth < maxHeight) { | |
newWidth = maxWidth; | |
newHeight = (maxWidth * bmHeight) / bmWidth; | |
} else { | |
newWidth = (maxHeight * bmWidth) / bmHeight; | |
newHeight = maxHeight; |
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.inex.ioioapp" | |
android:versionCode="1" | |
android:versionName="1.0" > | |
<uses-sdk | |
android:minSdkVersion="8" | |
android:targetSdkVersion="19" /> | |
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.inex.ioioapp" | |
android:versionCode="1" | |
android:versionName="1.0" > | |
<uses-sdk | |
android:minSdkVersion="8" | |
android:targetSdkVersion="19" /> | |
OlderNewer