开发者

how can i show string one activity to another activity on a 9*9 sudoku grid? [duplicate]

This question already has answers here: 开发者_开发知识库 Pass a String from one Activity to another Activity in Android (7 answers) Closed 3 months ago.

i want to show string one activity to another activity another activity is the sudoku game class and want to show the string like a sudoku puzzle on the sudoku screen board on the sudoku game class.sudoku grid is 9*9.


In the parent Activity I would create an Intent to the Child activity. Then use putExtra to send data. Then use getExtra or any variation on that to get the String. I have used getStringExtra in this example.

Intent childActivity = new Intent(this, Child.class);
childActivity.putExtra("parent_parameter", "This String is for child");
startActivity(childActivity); 

In the Child.java Activity.

Intent childIntent = getIntent();
String fromParent = childIntent.data.getStringExtra("parent_parameter");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜