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
import android.content.Context; | |
import android.net.ConnectivityManager; | |
import android.net.NetworkInfo; | |
public class ConnectedDetector { | |
private Context _context; | |
public ConnectedDetector(Context context){ | |
this._context = context; |
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
//method to retrieve song info from device | |
public void getSongList2(){ | |
//query external audio | |
ContentResolver musicResolver = getActivity().getContentResolver(); | |
Uri musicUri = android.provider.MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; | |
Cursor musicCursor = musicResolver.query(musicUri, null, null, null, null); | |
//iterate over results if valid | |
if(musicCursor!=null && musicCursor.moveToFirst()){ | |
//get columns |
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 boolean isEmailValid(String email) { | |
boolean isValid = false; | |
String expression = "^[\\w\\.-]+@([\\w\\-]+\\.)+[A-Z]{2,4}$"; | |
CharSequence inputStr = email; | |
Pattern pattern = Pattern.compile(expression, Pattern.CASE_INSENSITIVE); | |
Matcher matcher = pattern.matcher(inputStr); | |
if (matcher.matches()) { | |
isValid = true; |
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
#include <iostream> | |
#include <string> | |
#include <conio.h> | |
#include <fstream> | |
using namespace std; | |
void scanner(); | |
void factor(); | |
void term(); |
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
Instead of: | |
ScrollView main = (ScrollView) findViewById(R.id.main); | |
main.scrollTo(0,0); | |
I used: | |
final ScrollView main = (ScrollView) findViewById(R.id.main); | |
main.post(new Runnable() { | |
public void run() { | |
main.scrollTo(0,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
<?xml version="1.0" encoding="UTF-8"?> | |
<set xmlns:android="http://schemas.android.com/apk/res/android" > | |
<rotate | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
android:duration="1000" | |
android:fromDegrees="0" | |
android:pivotX="50%" | |
android:pivotY="50%" | |
android:repeatCount="1" | |
android:toDegrees="360" /> |
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 Activity context; | |
private int layoutResourceId; | |
private NewsListRSSItems newsListData[] = null; | |
public NewsListArrayAdapter(Activity context, int layoutResourceId, NewsListRSSItems[] newListData) { | |
super(context, layoutResourceId, newListData); | |
this.layoutResourceId = layoutResourceId; | |
this.context = context; | |
this.newsListData = newListData; |
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
>> I = imread('E:\fasterthinking.png'); | |
>> h = ones(5,5) / 25; | |
>> I2 = imfilter(I,h); | |
>> imshow(I), title('Original Image'); | |
>> figure, imshow(I2), title('Filtered Image') | |
//Link: | |
//http://www.mathworks.com/help/images/filter-images-using-imfilter.html |
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 intent = new Intent(); | |
intent.setType("application/pdf"); | |
intent.setAction(Intent.ACTION_GET_CONTENT); | |
startActivityForResult(Intent.createChooser(intent, "Select PDF "), SELECT_PDF); |
OlderNewer