Advertisement
Guest User

Untitled

a guest
Oct 20th, 2014
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. <RelativeLayout
  2. android:layout_width="wrap_content"
  3. android:layout_height="wrap_content"
  4. android:orientation="horizontal"
  5. android:paddingTop="20px"
  6. android:paddingBottom="70px" >
  7.  
  8. <ImageButton
  9. android:id="@+id/imageButton_myscript"
  10. android:layout_width="wrap_content"
  11. android:layout_height="wrap_content"
  12. android:paddingTop="0dp"
  13. android:scaleType="centerInside"
  14. android:src="@drawable/handwrite_wide"/>
  15.  
  16. <TextView
  17. android:id="@+id/pref_user"
  18. android:layout_width="wrap_content"
  19. android:layout_height="wrap_content"
  20. android:paddingTop="20dp"
  21. android:layout_centerHorizontal="true"/>
  22.  
  23. </RelativeLayout>
  24.  
  25. private void addListenerOnButtonMyScript() {
  26. // TODO Auto-generated method stub
  27. imageButton = (ImageButton) findViewById(R.id.imageButton_myscript);
  28.  
  29. imageButton.setOnClickListener(new OnClickListener() {
  30.  
  31. public void onClick(View arg0) {
  32.  
  33. Log.i("SingleViewActivity:onCreate:addListenerOnButtonMyScript" + ":onKey" , "Initiate myScript:");
  34.  
  35. final Intent intent = new Intent();
  36. intent.setClassName("com.visionobjects.textwidget.sample", "com.visionobjects.textwidget.sample.SampleActivity");
  37. startActivity(intent);
  38. }
  39. });
  40. }
  41.  
  42. //EDITED VERSION TO CALL ON SHARED PREFERENCES FUNCTION TO DISPLAY EDITED TEXT FROM MY_SCRIPT-20/10/2014
  43. private void loadSavedPreferences(){
  44.  
  45. SharedPreferences pref = getSharedPreferences(getString(R.string.pref_text),MODE_PRIVATE);
  46. SharedPreferences.Editor editor= pref.edit();
  47. editor.commit();
  48.  
  49. }
  50.  
  51. private void savePreferences(String key, String value) {
  52.  
  53. SharedPreferences pref = getSharedPreferences(getString(R.string.pref_text),MODE_PRIVATE);
  54. SharedPreferences.Editor editor = pref.edit();
  55. editor.putString(getString(R.string.pref_text),"");
  56. editor.commit();
  57. startActivity(getIntent());
  58. }
  59.  
  60. @Override
  61. public void onClick(View v) {
  62. // TODO Auto-generated method stub
  63.  
  64. final Intent intent = new Intent();
  65. intent.setClassName("com.visionobjects.textwidget.sample", "com.visionobjects.textwidget.sample.SampleActivity");
  66. startActivity(intent);
  67. }
  68. //END OF EDITED VERSION TO CALL ON SHARED PREFERENCES FUNCTION TO DISPLAY EDITED TEXT FROM MY_SCRIPT-20/10/2014
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement