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
call.enqueue(new Callback<List<Contributor>>() { | |
@Override | |
public void onResponse(Response<List<Contributor>> response, Retrofit retrofit) { | |
// handle success | |
} | |
@Override | |
public void onFailure(Throwable t) { | |
// handle failure | |
} |
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 | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:text="Fetch" | |
android:id="@+id/button" | |
android:layout_alignParentBottom="true" | |
android:layout_centerHorizontal="true" | |
android:layout_marginBottom="151dp" /> | |
<TextView |
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 button = (Button) findViewById(R.id.button); | |
button.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View view) { | |
GitHubService gitHubService = GitHubService.retrofit.create(GitHubService.class); | |
Call<List<Contributor>> call = gitHubService.repoContributors(“square”, “retrofit”); | |
String result = call.execute().body().toString(); | |
TextView textView = (TextView) findViewById(R.id.textView); | |
textView.setText(result); | |
} |
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 class NetworkCall extends AsyncTask<Call, Void, String> { | |
@Override | |
protected String doInBackground(Call… params) { | |
try { | |
Call<List<Contributor>> call = params[0]; | |
Response<List<Contributor>> response = call.execute(); | |
return response.body().toString(); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} |
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 button = (Button) findViewById(R.id.button); | |
button.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View view) { | |
GitHubService gitHubService = GitHubService.retrofit.create(GitHubService.class); | |
final Call<List<Contributor>> call = gitHubService.repoContributors("square", "retrofit"); | |
new NetworkCall().execute(call); | |
} | |
}); |
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
compile ‘com.squareup.retrofit2:retrofit:2.0.0-beta2’ | |
compile ‘com.squareup.retrofit2:gson-converter:2.0.0-beta2’ |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width" /> | |
<title>Hello World</title> | |
</head> | |
<body> | |
<div id="container"></div> |
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
@Entity | |
@NamedEntityGraph(name = "graph.AuthorBooks", attributeNodes = @NamedAttributeNode("books")) | |
public class Author implements Serializable { | |
… | |
EntityGraph graph = entityManager.getEntityGraph("graph.AuthorBooks"); | |
List<Author> authorsWithBooks = entityManager | |
.createQuery("SELECT DISTINCT a FROM Author a", Author.class) |
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 java.util.ArrayList; | |
import java.util.List; | |
/** | |
* | |
* @author Märt Bakhoff | |
*/ | |
public class GenerateGarbage { | |
private static final String loremIpsum = "" + |
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 org.shelajev; | |
import java.util.ArrayList; | |
import java.util.List; | |
public class LukasChallenge { | |
public static void main(String[] args) { | |
LukasChallenge lukasChallenge = new LukasChallenge(); | |
List<Pair> aaa = lukasChallenge.subPalindromes("ababa"); |