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
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
/* | |
* If savedInstanceState is not null, that means our Activity is not being started for the | |
* first time. Even if the savedInstanceState is not null, it is smart to check if the | |
* bundle contains the key we are looking for. | |
*/ | |
if (savedInstanceState != null) { |
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 method fires off an implicit Intent to open a webpage. | |
* | |
* @param url Url of webpage to open. Should start with http:// or https:// as that is the | |
* scheme of the URI expected with this Intent according to the Common Intents page | |
*/ | |
private void openWebPage(String url) { | |
Uri webpage = Uri.parse(url); | |
Intent intent = new Intent(Intent.ACTION_VIEW, webpage); | |
/* |
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 MainActivity extends AppCompatActivity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
query = "sample query" | |
URL searchUrl = NetworkUtils.buildUrl(query); | |
new QueryTask().execute(searchUrl); |
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
/** | |
* Builds the URL from query string. | |
* | |
* @param searchQuery The search string that will be queried for. | |
* @return The URL to use for the query. | |
*/ | |
public static URL buildUrl(String searchQuery) { | |
String baseUrl = "https://api.github.com/search/repositories"; | |
String paramQuery = "q"; | |
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
https://stackoverflow.com/a/35446009 11 Ways to convert an InputStream to a String with perfomance tests | |
https://medium.com/@harrysinghio/android-studio-tips-and-tricks-part-1-5b42d043333d | |
https://medium.com/@harrysinghio/android-studio-tips-and-tricks-part-2-d6548f8c249f | |
https://play.kotlinlang.org/koans/overview | |
https://medium.com/@JasonWyatt/squeezing-performance-from-sqlite-insertions-971aff98eef2 | |
Courses: | |
http://web.stanford.edu/class/cs193a/videos.shtml | |
https://www.udacity.com/course/android-basics-networking--ud843 | |
https://www.udacity.com/course/new-android-fundamentals--ud851 |
NewerOlder