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
[ | |
{ | |
"brocab": { | |
"description":"Fear of the brosephs", | |
"author":"", | |
"term":"Abroaphobia" | |
} | |
}, | |
{ | |
"brocab":{ ... |
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 class Brocab { | |
String term; | |
String author; | |
String description; | |
public String getTerm() { | |
return 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
String[] brocabs = {"Brotocol","Brobot","Theodore Broosevelt"}; | |
ArrayList<Brocab> brocabList = new ArrayList<Brocab>(Arrays.asList(brocabs)); | |
-> | |
ArrayList<Brocab> brocabList = new ArrayList<Brocab>(); |
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 class BrocabAdapter extends ArrayAdapter<String> | |
-> | |
public class BrocabAdapter extends ArrayAdapter<Brocab> | |
public BrocabAdapter(Context context, int textViewResourceId, ArrayList<String> items) | |
-> | |
public BrocabAdapter(Context context, int textViewResourceId, ArrayList<Brocab> items) |
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
... | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.local); | |
loadBrocabulary(); | |
} | |
public void loadBrocabulary() { | |
...TO BE CONTINUED... |
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 loadBrocabulary() { | |
String jsonRep = null; | |
... |
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
... | |
try { | |
InputStream in = getResources().openRawResource(R.raw.iphone); | |
...TO BE CONTINUED... | |
} catch (Throwable t) { | |
Toast.makeText(this, "Exception: "+t.toString(), 2000).show(); | |
} | |
... |
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
... | |
if (in != null) { | |
Writer writer = new StringWriter(); | |
char[] buffer = new char[1024]; | |
try { | |
Reader reader = new BufferedReader(new InputStreamReader(in, "UTF-8")); | |
int n; | |
while((n = reader.read(buffer)) != -1) { | |
writer.write(buffer, 0, n); | |
} |
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
... | |
String jsonRep = null; | |
try { | |
InputStream in = getResources().openRawResource(R.raw.iphone); | |
if (in != null) { | |
Writer writer = new StringWriter(); | |
char[] buffer = new char[1024]; | |
try { | |
Reader reader = new BufferedReader(new InputStreamReader(in, "UTF-8")); | |
int n; |
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
... | |
try { | |
JSONArray jsonArray = new JSONArray(jsonRep); | |
...TO BE CONTINUED... | |
} catch (JSONException e) { | |
Toast.makeText(this, "JSONException: "+e.toString(), 2000).show(); | |
} | |
... |