Hi everybody, I stucked in how to use two delimiters in
StringTokenizer in android for storing null values into db I have
string like this, string1=IMPS 2223 9481851276 7654321 , , 33
But empty fields missing in when used stringtokeniser
I want store result in db like this,
IMPS
2223
9481851276
7654321
null
null
33
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.getactivity_layout);
LinearLayout layout = (LinearLayout) findViewById(R.id.details);
sms = getIntent().getStringExtra("value");
merchantName = getIntent().getStringExtra("merchantName");
tv = (TextView) findViewById (R.id.textview_getactivity_key);
tv.setText("Enter the Detail for-"+merchantName);
keyText = (EditText) findViewById(R.id.edittext_getactivity_value);
//finalKey = "Pay"+" "+merchantName+"-";
keyText.setText(finalKey);
View submitButton = findViewById(R.id.finish);
inputMap = new LinkedHashMap<String, EditText>();
Pattern p = Pattern.compile("\\|.*?\\|");
Matcher m = p.matcher(sms);
while (m.find())
{
//String to be replaced
String s = m.group(0);
Log.d("TestTag", "Value of string in getdetails"+s);
if (!" ".equals(s.replaceAll("\\|", "")))
{
TextView t = new TextView(this);
t.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
t.setText(s.replaceAll("\\|", ""));
t.setPadding(0, 0, 0, 5);
t.setTextColor(getResources().getColor(android.R.color.black));
EditText et = new EditText(this);
et.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
//et.setInputType(1234);
layout.addView(t);
layout.addView(et);
inputMap.put(s, et);
}
}
submitButton.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
keyValue = keyText.getText().toString().trim();
ArrayList<String> tempArray = new ArrayList<String>();
String string=null;
if(sms != null && inputMap != null){
for(String s : inputMap.keySet()){
String inputValue = inputMap.get(s).getText().toString().trim();
if(inputValue.equalsIgnoreCase("") || inputValue.equals(null)){
//showDialog(s.replaceAll("\\|", "")+ " is mandatory.", inputMap.get(s));
return;
//sms = sms.replace(s, inputValue);
//tempArray.add(sms.replace(s, inputValue));
}
else{
sms = sms.replace(s, inputValue);
tempArray.add(sms.replace(s, inputValue));
}
string = sms.replaceAll("\\|\\s\\|",",");
}
StringTokenizer tokens = new StringTokenizer(string, " ");
String first = tokens.hasMoreTokens() ? tokens.nextToken() : null;
String second =tokens.hasMoreTokens() ? tokens.nextToken() : null;
String third = tokens.hasMoreTokens() ? tokens.nextToken() : null;
String fourth =tokens.hasMoreTokens() ? tokens.nextToken() : null;
String fifth = tokens.hasMoreTokens() ? tokens.nextToken() : null;
String sixth = tokens.hasMoreTokens() ? tokens.nextToken() : null;
String seventh =tokens.hasMoreTokens() ? tokens.nextToken() : null;
Log.d("Test123", "Split String is : "+first+" "+second+" "+third+" "+fourth+" "+fifth+" "+sixth+" "+seventh);
in.setKeyValue(keyValue);
in.setSmsKeyword(first);
in.setCustomerAccountNo(second);
in.setMobileNo(third);
in.setMmid(fourth);
in.setAmount(fifth);
in.setCustomerPin(sixth);
in.setRemarks(seventh);
in.setTempName(merchantName);
accessDB.open();
accessDB.insertMerchant(in);
accessDB.close();
Intent detailsIntent = new Intent(GetDetailsActivity.this,MainScreenTab.class);
detailsIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(detailsIntent);
}
Related
I am querying the android Contact class and able to fetch contact name plus number and able to add multiple textviews in linear layout with number and name of the contact and able to save single textview number value in shared preferences and retrive it, how can I save dynamically adding textviews array of values (phone numbers (strings) in shared preferences. If any one provide sample code it will help me a lot, as I am doing this for the first time, by the way i searched a lot about this topic but no luck.
Here is my code:
public class Cont extends Fragment {
protected static final int PICK_CONTACT = 0;
Button showConts;
TextView[] resultTextView;
ViewGroup addItems;
final int N = 1;
String name;
String cNumber;
String[] array;
String nameContact;
String number;
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View contViews = inflater.inflate(R.layout.cont, container, false);
addItems = (LinearLayout) contViews.findViewById(R.id.adds);
showConts = (Button) contViews.findViewById(R.id.opens);
resultTextView = new TextView[N]; //create an empty array;
// create a new textview
for (int i = 0; i < N; i++) {
final TextView rowTextView = new TextView(getActivity());
resultTextView = new TextView[N]; // create an empty array;
addItems.addView(rowTextView);
resultTextView[i] = rowTextView;
if(resultTextView[i] != null ){
resultTextView[i].setText(nameContact+ " "+ cNumber);
}
}
showConts.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
startActivityForResult(intent, PICK_CONTACT);
}
});
return contViews;
}
#Override
public void onActivityResult(int reqCode, int resultCode, Intent data){
super.onActivityResult(reqCode, resultCode, data);
switch(reqCode)
{
case (PICK_CONTACT):
if (resultCode == Activity.RESULT_OK)
{
Uri contactData = data.getData();
Cursor c = getActivity().managedQuery(contactData, null, null, null, null);
if (c.moveToFirst())
{
String id = c.getString(c.getColumnIndexOrThrow(ContactsContract.Contacts._ID));
String hasPhone = c.getString(c.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER));
if (hasPhone.equalsIgnoreCase("1"))
{
Cursor phones = getActivity().getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,null,
ContactsContract.CommonDataKinds.Phone.CONTACT_ID +" = "+ id,null, null);
phones.moveToFirst();
cNumber = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
//Toast.makeText(getActivity(), cNumber, Toast.LENGTH_SHORT).show();
nameContact = c.getString(c.getColumnIndexOrThrow(ContactsContract.Contacts.DISPLAY_NAME));
for (int i = 0; i < N; i++) {
final TextView rowTextView = new TextView(getActivity());
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
params.setMargins(0,0,0,10);
resultTextView = new TextView[N];
rowTextView.setTextSize(34);
rowTextView.setHeight(140);
rowTextView.setGravity(Gravity.CENTER);
rowTextView.setBackgroundColor(Color.parseColor("#7d3f98"));
rowTextView.setTextColor(Color.WHITE);
//rowTextView.setBackgroundResource(R.drawable.corn);
addItems.addView(rowTextView);
resultTextView[i] = rowTextView;
resultTextView[i].setLayoutParams(params);
if(resultTextView[i] != null ){
resultTextView[i].setText(nameContact+ " "+ cNumber);
}
resultTextView[i].setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
String res1 = rowTextView.getText().toString();
System.out.println("num " + res1.length());
res1 = res1.split(" ")[res1.split(" ").length - 1];
startDialActivity(res1);
}
private void startDialActivity(String result) {
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:"+result));
startActivity(intent);
}
});
}
}
}
}}}}
Try google PreferenceActivity, you don't have to,you can just use the traditional way(SharedPreference sp =new ....)
, but I think SharedPreferenceActivity is very easier, it's native,very simple and powerfull!
You can make a JSONArray and add name and phone number by making JSONObject and add these JSONObjects to the JSONArray.
JSONObject mainObject=null;
try{
mainObject=new JSONObject();
JSONArray arr = new JSONArray();
for (int i = 0; i < 10; i++) {
JSONObject objName = new JSONObject();
JSONObject objPhone = new JSONObject();
objName.put("name", new String("abbcc"));
objPhone.put("phone", new String("dfdfgdf"));
arr.put(i,objName);
arr.put(i,objPhone);
}
mainObject.put("mainObj",arr);
System.out.println(mainObject.toString());
}
catch(Exception e){
}
shared.edit().putString("details",mainObject.toString()).commit();
and then get string from sharedPreferences wherever you want and the get details from JSONObject and JSONArray
Hi I have Listview in that when I select an item I display another page where I am setting the text views with appropriate informations but when i select an item and go back and select another item the textviews are not getting updated ?BTW there are 10 text views can somebody provide me the solution for this? Thanks.
super.onCreate(savedInstanceState);
setContentView(R.layout.lastl);
Intent i = getIntent();
ACK = i.getStringExtra("ack-no");
NAME = i.getExtras().getString("appl name");
TRADE = i.getExtras().getString("trade");
PIN = i.getExtras().getString("pin");
MOBILE = i.getExtras().getString("mobile");
EMAIL = i.getExtras().getString("email");
LVO1 = i.getExtras().getString("LVO1");
LVO2 = i.getExtras().getString("LVO2");
tv1 = (TextView) findViewById(R.id.set_ack);
tv1.setText(ACK);
tv2 = (TextView) findViewById(R.id.set_apl);
tv2.setText(NAME);
tv3 = (TextView) findViewById(R.id.set_trd);
tv3.setText(TRADE);
tv4 = (TextView) findViewById(R.id.set_dr);
tv4.setText(ArrayAdapter.ar.get(0));
tv5 = (TextView) findViewById(R.id.set_flr);
tv5.setText(ArrayAdapter.ar.get(1));
tv6 = (TextView) findViewById(R.id.set_bdg);
tv6.setText(ArrayAdapter.ar.get(2));
tv7 = (TextView) findViewById(R.id.set_str);
tv7.setText(ArrayAdapter.ar.get(3));
tv8 = (TextView) findViewById(R.id.set_area);
tv8.setText(ArrayAdapter.ar.get(4));
tv9 = (TextView) findViewById(R.id.set_dis);
//tv9.setText(ArrayAdapter.ar.get(5));
tv10 = (TextView) findViewById(R.id.set_pin);
tv10.setText(PIN);
tv11 = (TextView) findViewById(R.id.set_mb);
tv11.setText(MOBILE);
tv12 = (TextView) findViewById(R.id.set_email);
tv12.setText(EMAIL);
tv13 = (TextView) findViewById(R.id.set_pn);
tv14 = (TextView) findViewById(R.id.set_bdgg);
tv15 = (TextView) findViewById(R.id.set_dt);
tv16 = (TextView) findViewById(R.id.set_lvo);
tv16.setText(LVO1);
String lvo2 = LVO2.substring(0, LVO2.length() - 1);
Log.d("sssssss", lvo2);
tv17 = (TextView) findViewById(R.id.set_lvo2);
tv17.setText(lvo2);
b1 = (Button) findViewById(R.id.button1);
b1.setOnClickListener(this);
b2 = (Button) findViewById(R.id.button2);
b2.setOnClickListener(this);
}
#Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.button1:
break;
case R.id.button2:
break;
}
}
this is my listView code
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.listmain);
pv = getIntent().getStringArrayListExtra("Array_list");
System.out.println("ARRAYLIST---->" + pv);
final ListView list = (ListView) findViewById(R.id.listView1);
mylistData = new ArrayList<HashMap<String, String>>();
String[] columnTags = new String[]{"col1", "col2", "col3", "col4", "col5", "col6", "col7", "col8"};
int[] columnIds = new int[]{R.id.col1, R.id.col2, R.id.col3, R.id.col4, R.id.col5, R.id.col6, R.id.col7, R.id.col8};
int k = 0;
for (int i = 0; i <= 9; i++) {
HashMap<String, String> map = new HashMap<String, String>();
//initialize row data
for (int j = 0; j <= 7/*pv.size()-1*/; j++) {
map.put(columnTags[j], pv.get(k));
put(columnTags[j], "row" + i + "col" + j);
k++;
}
mylistData.add(map);
}
SimpleAdapter arrayAdapter = new SimpleAdapter(this, mylistData, R.layout.rowmain, columnTags, columnIds);
list.setAdapter(arrayAdapter);
list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> parnet, android.view.View view, int position, long id) {
new LongOperation().execute();
String text = list.getItemAtPosition(position).toString();
String g = text.replace("{col5=", "");
String g1 = g.replace(" col4=", "");
String g2 = g1.replace(" col7=", "");
String g3 = g2.replace(" col6=", "");
String g4 = g3.replace(" col1=", "");
String g5 = g4.replace(" col3=", "");
String g6 = g5.replace(" col2=", "");
String g7 = g6.replace(" col8=", "");
String val[] = g7.split(",");
for (int m = 0; m < val.length; m++) {
Log.d("VALUE", val[m]);
ar1.add(val[m]);
}
System.out.println(ar1);
Log.d("VALUES-------->", text);
mob = ar1.get(0);
Log.d("VALUE1", mob);
pin = ar1.get(1);
Log.d("VALUE2", pin);
lvo = ar1.get(2);
Log.d("VALUE3", lvo);
email = ar1.get(3);
Log.d("VALUE4", email);
ack = ar1.get(4);
Log.d("VALUE5", ack);
trade = ar1.get(5);
Log.d("VALUE6", trade);
name = ar1.get(6);
Log.d("VALUE7", name);
lvo2 = ar1.get(7);
Log.d("VALUE8", lvo2);
}
});
}
From your code: ar1.add(val[m]);
I guess that ar1 is a List<String> variable of your listview activity?
If that's true, maybe add a call to clear() may work:
ar1.clear();
for(int m =0 ; m< val.length ; m++)
{
Log.d("VALUE",val[m]);
ar1.add(val[m]);
}
Hi guy's i have a problem with Android...
This is a part of my code:
setContentView(R.layout.activity_main);
TableLayout MainTable = (TableLayout) findViewById(R.id.main_table);
JSONArray Jobj = new JSONArray(result_set);
String url_img = null;
String url_video = null; //MUST CONTAINS THE URL OF MY VIDEO
for (int i = 0; i < Jobj.length(); i++) {
TableRow row = new TableRow(getApplicationContext());
row.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
row.setPadding(0, 14, 2, 14);
JSONObject titoli = Jobj.getJSONObject(i);
Integer id = titoli.getInt("id_video");
String titolo = titoli.getString("nome_video");
String immagini = titoli.getString("video_img");
String video_url = titoli.getString("url_video");
/* video_url : this is the variable that i change (and contains the relative path that i obtains parsing json array) */
Pattern p = Pattern.compile("^(https?|ftp|file)://[-a-zA-Z0-9+&##/%?=~_|!:,.;]*[-a-zA-Z0-9+&##/%=~_|]");
Matcher m = p.matcher(immagini);
Pattern v = Pattern.compile("^/video/[-a-zA-Z0-9+&##/%?=~_|!:,.;]*[-a-zA-Z0-9+&##/%=~_|]");
Matcher vm = v.matcher(video_url);
// Path video
if (vm.matches() == false) {
url_video = path_youtube + video_url; // SECOND ERROR HERE
} else if (vm.matches() == true) {
url_video = path_an_tv + video_url; // SECOND ERROR HERE
}
// Path image
if (m.matches() == false) {
url_img = path + immagini;
} else if (m.matches() == true) {
url_img = immagini;
}
ImageView img = new ImageView(getApplicationContext());
img.setAdjustViewBounds(true);
img.setMaxHeight(140);
img.setMaxWidth(140);
Bitmap bitmap = BitmapFactory.decodeStream((InputStream) new URL(url_img).getContent());
img.setImageBitmap(bitmap);
LayoutParams params = new TableRow.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
final TextView txt = new TextView(getApplicationContext());
txt.setGravity(Gravity.LEFT | Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL);
txt.setLayoutParams(params);
txt.setTextSize(18);
txt.setBackgroundColor(Color.WHITE);
txt.setTypeface(null, Typeface.BOLD);
txt.setTextColor(Color.BLACK);
txt.setId(id);
txt.setText(titolo);
txt.setClickable(true);
row.addView(img);
row.addView(txt);
MainTable.addView(row);
txt.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url_video)));
/* FIRST ERROR HERE, url_video contains the absolute url of my video*/
}
});
}
When i try compile my project an error occours:
*Cannot refer to a non final variable url_video inside a innner class defined in a different method...*
If I change url video into final another error occours:
The final local variable cannot be assigned. it must be blank and not using a compound assignment
How I can fix it ?
UPDATE I FIX IT REPLACING WITH THIS:
final TextView txt = new TextView(getApplicationContext());
txt.setGravity(Gravity.LEFT | Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL );
txt.setLayoutParams(params); txt.setTextSize(18); txt.setBackgroundColor(Color.WHITE);
txt.setTypeface(null, Typeface.BOLD); txt.setTextColor(Color.BLACK);
txt.setId(id); txt.setTag(url_video); txt.setText(titolo); txt.setClickable(true);
row.addView(img);
row.addView(txt);
MainTable.addView(row);
txt.setOnClickListener(new OnClickListener(){
public void onClick(View v) {
startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse((String) txt.getTag())));
}
});
}
Define it in class level private String video_url;
You can't access a variable defined within onCreate() within OnClick() Because the scope of oncreate is over when you get a click. So you must keep the variable scope alive.
UPDATE
Yeah, Its simple,
public class YourClass {
private String video_url;
public void OnCreate()
{
}
}
Just make this an instance variable
String url_video = null;
That is define this inactivity.
I have been working on saving 4 String arrays to sharedpreference. Currently I am breaking the array down in to a string separating the pieces by a comma. When I go to the string, it does save the pieces accurately as it should; however, when I "load" the data and convert it back to an array, it's coming up empty (not null). I am unable to determine how I should fix this to pull my array back. Below is my Activity:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.debtlist);
String[] debtName = new String[10];
String[] debtAmount = new String[10];
String[] debtRate = new String[10];
String[] debtPayment = new String[10];
int counter = 0;
SharedPreferences sharedPref= getSharedPreferences("chaosdatasnowball", 0);
String tempDebtNames = sharedPref.getString("debtNames", "");
debtName = convertStringToArray(tempDebtNames);
Bundle extras = getIntent().getExtras();
int trigger = 0;
for (int i=0;i<counter || i==counter;i++)
{
if (debtName[i] == null && extras != null && trigger == 0)
{
debtName[i] = extras.getString("debtName");
debtAmount[i] = extras.getString("debtAmount");
debtRate[i] = extras.getString("debtRate");
debtPayment[i] = extras.getString("debtPayment");
trigger = 1;
counter++ ;
}
}
TableLayout tl = (TableLayout) findViewById(R.id.debtListTableView);
for (int i=0;i<counter || i==counter;i++)
{
if (debtName[i] != null)
{
TableRow tr = new TableRow(this);
TextView tv0 = new TextView(this);
TextView tv1 = new TextView(this);
TextView tv2 = new TextView(this);
TextView tv3 = new TextView(this);
TableRow.LayoutParams trlp = new TableRow.LayoutParams();
tv0.setLayoutParams(new LayoutParams(0, LayoutParams.MATCH_PARENT, 0.25f));
tv1.setLayoutParams(new LayoutParams(0, LayoutParams.MATCH_PARENT, 0.25f));
tv2.setLayoutParams(new LayoutParams(0, LayoutParams.MATCH_PARENT, 0.25f));
tv3.setLayoutParams(new LayoutParams(0, LayoutParams.MATCH_PARENT, 0.25f));
trlp.span = 3;
tr.setLayoutParams(trlp);
tv0.setText("" + debtName[i]);
tv1.setText("" + debtAmount[i]);
tv2.setText("" + debtPayment[i]);
tv3.setText("" + i);
tr.addView(tv0);
tr.addView(tv1);
tr.addView(tv2);
tr.addView(tv3);
tl.addView(tr);
}
}
SharedPreferences.Editor editor= sharedPref.edit();
String debtNames = convertArrayToString(debtName, counter);
editor.putString("debtNames", debtNames).commit();
TextView disp = (TextView) findViewById(R.id.dispAdditionalAmount);
disp.setText("" + debtNames); //This is how I confirm that the convertArrayToString is functioning properly
}
public static String convertArrayToString(String[] array, int stop){
String str = "";
for (int i = 0;i<stop; i++) {
str = str+array[i];
// Do not append comma at the end of last element
if(i<stop-1){
str = str+",";
}
}
return str;
}
public static String[] convertStringToArray(String str){
String[] arr = str.split(",");
return arr;
}
You do:
String tempDebtNames = sharedPref.getString("debtNames", "");
debtName = convertStringToArray(tempDebtNames);
It is possible that "debtNames" key does not exist. (It returns "" in this case).
Think about first time the app is run. The key will not exist. Therefore, you should convertStringToArray only if !tempDebtNames.equals(""). If key doesn't exist then proceed with empty values..
Ok so im making an app that involve a qr scanner on result i have text showing with the url of the code is there any way in an onclick listener to call the text from the result and open it in the browser if so how can I do it
Java Snippet
Button browser = (Button) findViewById(R.id.ulibutton);
browser.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent i = new Intent(Intent.ACTION_VIEW, url = new URL(
getString(R.string.contents_text)));
startActivity(i);
}
});
ImageView barcodeImageView = (ImageView) findViewById(R.id.barcode_image_view);
if (barcode == null) {
barcodeImageView.setImageBitmap(BitmapFactory.decodeResource(
getResources(), R.drawable.icon));
} else {
barcodeImageView.setImageBitmap(barcode);
}
TextView formatTextView = (TextView) findViewById(R.id.format_text_view);
formatTextView.setText(rawResult.getBarcodeFormat().toString());
TextView typeTextView = (TextView) findViewById(R.id.type_text_view);
typeTextView.setText(resultHandler.getType().toString());
DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.SHORT,
DateFormat.SHORT);
String formattedTime = formatter.format(new Date(rawResult
.getTimestamp()));
TextView timeTextView = (TextView) findViewById(R.id.time_text_view);
timeTextView.setText(formattedTime);
TextView metaTextView = (TextView) findViewById(R.id.meta_text_view);
View metaTextViewLabel = findViewById(R.id.meta_text_view_label);
metaTextView.setVisibility(View.GONE);
metaTextViewLabel.setVisibility(View.GONE);
Map<ResultMetadataType, Object> metadata = rawResult
.getResultMetadata();
if (metadata != null) {
StringBuilder metadataText = new StringBuilder(20);
for (Map.Entry<ResultMetadataType, Object> entry : metadata
.entrySet()) {
if (DISPLAYABLE_METADATA_TYPES.contains(entry.getKey())) {
metadataText.append(entry.getValue()).append('\n');
}
}
if (metadataText.length() > 0) {
metadataText.setLength(metadataText.length() - 1);
metaTextView.setText(metadataText);
metaTextView.setVisibility(View.VISIBLE);
metaTextViewLabel.setVisibility(View.VISIBLE);
}
}
TextView contentsTextView = (TextView) findViewById(R.id.contents_text_view);
contentsTextView.setMovementMethod(LinkMovementMethod.getInstance());
CharSequence displayContents = resultHandler.getDisplayContents();
contentsTextView.setText(displayContents);
// Crudely scale betweeen 22 and 32 -- bigger font for shorter text
int scaledSize = Math.max(22, 32 - displayContents.length() / 4);
contentsTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, scaledSize);
}
}
Intent i = new Intent(Intent.ACTION_VIEW,Uri.parse(YourUrl)));
startActivity(i);