intencjal.class chyba ze problem tkwi w tym, że tam sobie coś przekazuje ?
package com.example.pawel.mysql;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;
public class intencjacal extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_intencjacal);
TextView tekst = (TextView) findViewById(R.id.textView3);
Bundle bundle = getIntent().getExtras();
String imie = bundle.getString("prze");
tekst.setText(imie);
Log.e("odebrane", imie);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_intencjacal, 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();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
a tutaj gdzie działa intencja
package com.example.pawel.mysql;
import android.app.Activity;
import android.content.Intent;
import android.inputmethodservice.ExtractEditText;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
public class Kalendarz2 extends Activity {
public String ms;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_kalendarz2);
TextView tekst = (TextView) findViewById(R.id.textView2);
Button przekaz = (Button) findViewById(R.id.button10);
tekst.setText("czesc");
}
public void intencja(View view){
EditText edit = (EditText) findViewById(R.id.editText);
ms = edit.getText().toString();
Toast.makeText(getApplicationContext(),
ms,Toast.LENGTH_LONG).show();
Intent i = new Intent(getApplicationContext(), intencjacal.class);
i.putExtra("prze", ms);
startActivity(i);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_kalendarz2, 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();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}