Main Activity.java 부분에서 제가 뭘 잘못했는지 실행부터 안되네요.
[Main Activity]
package com.example.linearpractice;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
////////////////////요 부분 ///////////////////////////////
Intent intent = getIntent();
String name = intent.getExtras().getString("name");
String number = intent.getExtras().getString("number");
TextView View;
View = (TextView)findViewById(R.id.TextView3);
View.setText(name);
TextView View2;
View2 = (TextView)findViewById(R.id.TextView5);
View2.setText(number);
////////////////////요 부분/////////////////////////////
}
public void onButton1Clicked(View v) {
Intent intent = new Intent(getApplicationContext(),MainActivity2.class);
startActivity(intent);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
----------------------------------------------
저 빗금친 부분을 없애면 화면은 나오는 것으로 보아하니 저기가 잘못된거 같은데.. 어떤게 잘못된것일까요.
---[MainActivity2.java]-----
public void onBackButtonCicked (View v){
Intent intent = new Intent(getApplicationContext(),MainActivity.class);
intent.putExtra("name","홍길동");
intent.putExtra("number","010-1234-1234");
startActivity(intent);
그냥 이걸 받아서 저기다 올리려고 했는데... 음... 아직 자바를 몰라서 그런지 힘드네요..