Created
April 30, 2020 12:53
-
-
Save wheeliechamp/9c74c1449acfa596e5b85bebf10b5151 to your computer and use it in GitHub Desktop.
Activity以外から更新とSharedPreferencesの使い方
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
import android.content.Context; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.util.Log; | |
import android.view.View; | |
import android.widget.TextView; | |
public class MainActivity extends AppCompatActivity { | |
Context context; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
context = this; | |
TextView textview1 = findViewById(R.id.textView1); | |
textview1.setText("かきくけこ"); | |
final TextChange text_change = new TextChange(context); | |
findViewById(R.id.button1).setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View v) { | |
text_change.textChange(); | |
} | |
}); | |
} | |
public static void testTest() { | |
Log.d("@@@@@::", "testTest"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment