Transfer data beetwen activites

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Transfer data beetwen activites

Postby bialy16pl » Mon Mar 25, 2013 6:43 pm

Hi, I am new and I want to transfer some string from A.class to C.class, but after A.class I want to go to B.class and after it to C.class. I made code:
This is Nazwa.class (A.class)
Code: Select all
  final EditText Nazwa = (EditText)findViewById(R.id.EditNazwa);

    Button Przycisk_Nazwa = (Button)findViewById(R.id.PrzyciskNazwa);
    Przycisk_Nazwa.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent intent = new Intent(Nazwa.this, Ilosc.class);
            intent.putExtra("key", Nazwa.getText().toString());

            startActivity(intent);

        }
    });


This is Wydruk.class (C.class)
Code: Select all
Wydruk.java package com.example.slotki;

import android.app.Activity; import android.os.Bundle; import android.widget.TextView;

public class Wydruk extends Activity {

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.wydruk);

    TextView tv = (TextView)findViewById(R.id.TextNazwa);
    tv.setText(getIntent().getExtras().getString("key"));

}

}


My problem is: or I can transfer data but I don't get C.class or I don't transfer data but I get B.class after A.class.
bialy16pl
Once Poster
Once Poster
 
Posts: 1
Joined: Tue Feb 05, 2013 1:21 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 1 guest