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
/* | |
* Copyright (C) 2014 skyfish.jy@gmail.com | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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
webView = findViewById(R.id.webview_devotions); | |
//Button Initialization | |
backButton =(Button) findViewById(R.id.bt_back); | |
forwardButton =(Button) findViewById(R.id.bt_forward); | |
//Back Button Action | |
backButton.setOnClickListener(new View.OnClickListener() { | |
@Override | |
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
/* | |
Retrieved from https://web.archive.org/web/20160516165158/http://lexandera.com/2009/01/adding-alert-support-to-a-webview/ | |
*/ | |
final WebView browser = (WebView)findViewById(R.id.browser); | |
/* JavaScript must be enabled if you want it to work, obviously */ | |
browser.getSettings().setJavaScriptEnabled(true); | |
final Context myApp = this; | |
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
/** | |
* Called when an item in the navigation menu is selected. | |
* | |
* @param item The selected item | |
* @return true to display the item as the selected item | |
*/ | |
@Override | |
public boolean onNavigationItemSelected(@NonNull MenuItem item) { | |
int id = item.getItemId(); |
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
. | |
. | |
. | |
<TextView | |
. | |
. | |
. | |
android:shadowColor="@color/text_shadow_color" | |
android:shadowDx="-2" | |
android:shadowDy="2" |
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
// Create a collection and initialize it with data | |
ArrayList<String> list = new ArrayList<>(); | |
for (int i=0; i<10; i++) { | |
list.add("Item "+i); | |
} | |
// Create an adapter for Spinner | |
ArrayAdapter<String> spinAdapter = new ArrayAdapter<>(context,android.R.layout.simple_list_item_1, list); |
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
DateFormat dateFormat = new SimpleDateFormat("MM"); | |
Date date = new Date(); | |
dateFormat.format(date); |
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
// Desired date pattern | |
String pattern = "MM-dd-yyyy"; | |
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern); | |
String strDate; | |
// Current date | |
Date date = new Date(); | |
// Current date in desired format | |
strDate = simpleDateFormat.format(date); |
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 AlertDialog.Builder getDialogProgressBar() { | |
AlertDialog.Builder builder = new AlertDialog.Builder(Objects.requireNonNull(getContext())); | |
builder.setTitle("Loading..."); | |
builder.setCancelable(false); | |
final ProgressBar progressBar = new ProgressBar(getContext()); | |
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( | |
LinearLayout.LayoutParams.WRAP_CONTENT, |
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 showCustomAlert() { | |
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context); | |
LayoutInflater inflater = this.getLayoutInflater(); | |
View dialogView = inflater.inflate(R.layout.update_layout, null); | |
dialogBuilder.setView(dialogView); | |
EditText etName = (EditText) dialogView.findViewById(R.id.etName); | |
AlertDialog alertDialog = dialogBuilder.create(); | |
alertDialog.show(); |