cr5315
Android Enthusiast
I have an app that uses sharedPreferences to send a link from one activity to the next. What I can't figure out is how I would take that link and insert it into a string.
Here's the code I've got:
First.class
Second.class
What I want is to get the "link" from the sharedPreferences into the "yes" from the string. Any ideas on how I could do that?
Here's the code I've got:
First.class
Code:
public void onItemClick(AdapterView<?> parent, View v, int position, long id)
{
Log.i(tag,"item clicked! [" + RSSFeed.getItem(position).getTitle() + "]");
// Get the app's shared preferences
SharedPreferences app_preferences =
PreferenceManager.getDefaultSharedPreferences(this);
app_preferences.getInt("link", 0);
Intent itemintent = new Intent(this,ArticleView.class);
SharedPreferences.Editor editor = app_preferences.edit();
editor.putInt(RSSFeed.getItem(position).getLink(), position);
editor.commit(); // Very important
startActivity(itemintent);
}
Second.class
Code:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.webview);
// Get the app's shared preferences
SharedPreferences app_preferences =
PreferenceManager.getDefaultSharedPreferences(this);
app_preferences.getInt("link", 0);
final String BLARP = ("yes");
webview = (WebView) findViewById(R.id.webview);
webview.getSettings().setJavaScriptEnabled(true);
webview.loadUrl(BLARP);
webview.setWebViewClient(new HelloWebViewClient());
}
What I want is to get the "link" from the sharedPreferences into the "yes" from the string. Any ideas on how I could do that?