Guest User

Untitled

a guest
Jan 22nd, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. Bundle bundle = getIntent().getExtras();
  2. if(bundle != null)
  3. {
  4.  
  5. String date = bundle.getString("date");
  6.  
  7. txtDate.setText(date);
  8.  
  9. }
  10.  
  11. Bundle b = getIntent().getExtras();
  12. if(b != null)
  13. {
  14. String name = bundle.getString("name");
  15. txtName.setText("Create an event for:" +name);
  16. }
  17.  
  18. buttonDate = (Button) findViewById(R.id.btnDate);
  19. buttonDate.setOnClickListener(new View.OnClickListener()
  20. {
  21.  
  22. @Override
  23. public void onClick(View v)
  24. {
  25. Intent calIntent = new Intent(Create_Events.this, Calendar_Event.class);
  26. startActivity(calIntent);
  27.  
  28.  
  29. }
  30.  
  31. });
  32.  
  33.  
  34. ContactsList.java -- the ListView of the names which is passed to the Create_Events page.
  35.  
  36. Cursor cursor = null;
  37.  
  38. cursor = (Cursor) l.getItemAtPosition(position);
  39. Intent intent = new Intent(ContactsList.this, Create_Events.class);
  40. intent.putExtra("name", cursor.getString(cursor.getColumnIndex(buddyDB.KEY_NAME)));
  41. startActivity(intent);
  42.  
  43. private void SavePreferences(String key, String value)
  44. {
  45. SharedPreferences sharedPref = getSharedPreferences("MY_SHARED_PREF", MODE_PRIVATE);
  46. SharedPreferences.Editor editor = sharedPref.edit();
  47. editor.putString(key, value);
  48. editor.commit();
  49. }
  50.  
  51. private void LoadPreferences()
  52. {
  53. SharedPreferences sharedPref = getSharedPreferences("MY_SHARED_PREF", MODE_PRIVATE);
  54. String name = sharedPref.getString("name", "");
  55.  
  56.  
  57.  
  58. }
Add Comment
Please, Sign In to add comment