This file contains hidden or 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
| Spinner spinner = (Spinner) findViewById(R.id.main_spinner); | |
| ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<>(getSupportActionBar().getThemedContext(), | |
| R.layout.spinner_list_style, | |
| getResources().getStringArray(R.array.countries)); | |
| spinnerAdapter.setDropDownViewResource(R.layout.spinner_dropdown_item); | |
| spinner.setAdapter(spinnerAdapter); |
This file contains hidden or 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 java.io.File; | |
| import java.util.regex.Pattern; | |
| import org.adblockplus.android.ABPEngine; | |
| import org.adblockplus.libadblockplus.FilterEngine.ContentType; | |
| import android.content.Context; | |
| import android.webkit.WebResourceResponse; | |
| import android.webkit.WebView; | |
| import android.webkit.WebViewClient; |
This file contains hidden or 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 Bitmap DownloadImageBitmap(String url) { | |
| Bitmap bm = null; | |
| try { | |
| URL aURL = new URL(url); | |
| URLConnection conn = aURL.openConnection(); | |
| conn.connect(); | |
| InputStream is = conn.getInputStream(); | |
| BufferedInputStream bis = new BufferedInputStream(is); | |
| bm = BitmapFactory.decodeStream(bis); | |
| bis.close(); |
This file contains hidden or 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.example.robpercival.webviewdemo; | |
| import android.app.Activity; | |
| import android.os.Bundle; | |
| import android.view.Menu; | |
| import android.view.MenuItem; | |
| import android.webkit.WebView; | |
| import android.webkit.WebViewClient; | |
| public class MainActivity extends Activity { |
This file contains hidden or 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 MyAsync extends AsyncTask { | |
| private Context mContext; | |
| public MyAsync(Context context) { | |
| //Relevant Context should be provided to newly created components (whether application context or activity context) | |
| //getApplicationContext() - Returns the context for all activities running in application | |
| mContext = context.getApplicationContext(); | |
| } |
This file contains hidden or 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 init() | |
| { | |
| WebView webview = (WebView) findViewById(R.id.webview); | |
| WebSettings settings = webview.getSettings(); | |
| settings.setJavaScriptEnabled(true); | |
| webview.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY); | |
| PdfWebViewClient pdfWebViewClient = new PdfWebViewClient(this, webview); | |
| pdfWebViewClient.loadPdfUrl( | |
| "https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0ahUKEwjgwIfp3KXSAhXrhFQKHQqEDHYQFggZMAA&url=http%3A%2F%2Fwww.orimi.com%2Fpdf-test.pdf&usg=AFQjCNERYYcSfMLS5ukBcT2Qy11YxEhXqw&cad=rja"); |
This file contains hidden or 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 void printActivityFlags(String activityName, Intent intent) { | |
| Field[] declaredFields = Intent.class.getDeclaredFields(); | |
| StringBuilder stringBuilder = new StringBuilder(activityName + " => "); | |
| for (Field field : declaredFields) { | |
| if (field.getName().startsWith("FLAG_")) { // Fetch all the flag names which start from "FLAG_" | |
| try { | |
| int flag = field.getInt(null); | |
| if ((intent.getFlags() | flag) == intent.getFlags()) { // checking that flag is present or not. | |
| stringBuilder.append(field.getName()); | |
| stringBuilder.append("|"); |
This file contains hidden or 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
| /** | |
| * This utility method moves contents from sourceDirectory to destinationDirectory | |
| * | |
| * @param sourceDirectory : from where to get contents | |
| * @param destinationDirectory : where to move contents | |
| * @return true if success, false otherwise. | |
| */ | |
| public static boolean moveDirectoryContents(@NonNull File sourceDirectory, @NonNull File destinationDirectory) { | |
| if (!sourceDirectory.exists()) { | |
| return false; |
This file contains hidden or 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 java.io.BufferedReader; | |
| import java.io.IOException; | |
| import java.io.InputStreamReader; | |
| import java.util.List; | |
| import bittrex.BittrexWS; | |
| import bittrex.CurrencyPair; | |
| import bittrex.Trade; |