Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: android studio problem

  1. #1
    Junior Member
    Join Date
    Dec 2017
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default android studio problem

    Hello

    on youtube I find tutor how create program with android studio. Tutor show me how create first activity and put one edittext and tree buttons, first and second button write in edittext which button I pressed.im add
    On first activity I have edit box and third button show me second Activity. This works normal. Click on button on first Activity show me second Activity
    I make second activity with one edittext and tree buttons,.and copy some code from first Activity. Code must show me which button I click but dont work. Where's mistake?
    // Start code first activity
    package com.pingusteam.mybigapp;
    import android.support.v7.app.AppCompatActivity;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.Button;
    import android.widget.TextView;
    public class FIRST extends AppCompatActivity {
        public Button but1;
        public Button gumb1;
        public TextView vnos;
        public Button izpis;
        public TextView prikaz;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_first);
            final Button but1 = findViewById(R.id.but1);
            final Button gumb1 = findViewById(R.id.gumb1);
            final Button izpis = findViewById(R.id.izpis);
            final TextView vnos = findViewById(R.id.vnos);
            final TextView prikaz = findViewById(R.id.prikaz);
            gumb1.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                   setContentView(R.layout.activity_second);
                    }
            });
            but1.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    //setContentView(R.layout.activity_tretji);
                    prikaz.setText("to je črka B");
                }
            });
            izpis.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                   prikaz.setText("to je črka A");
                }
            });
        }
        }


    // Start code second activity
    package com.pingusteam.mybigapp;
    import android.support.v7.app.AppCompatActivity;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.Button;
    import android.widget.TextView;
    public class second extends AppCompatActivity  {
    public Button gumba;
    public Button gumbb;
    public Button gumbc;
    public TextView pozdravtxt;
    public TextView prikaz;
    @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_second);
            final TextView pozdravtxt = findViewById(R.id.pozdravtxt);
            final Button gumba = findViewById(R.id.gumba);
            final Button gumbb = findViewById(R.id.gumbb);
            final Button gumbc = findViewById(R.id.gumbc);
            gumba.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    pozdravtxt.setText("Pritisnili ste črko A");
                }
            });
            gumbb.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    pozdravtxt.setText("Pritisnili ste črko B");
                }
            });
            gumbc.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    pozdravtxt.setText("Pritisnili ste črko C");
                }
            });
        }
    }

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: android studio problem

    Is there an error message in the logcat that shows a problem in your code?

    Copy the part of logcat that shows any problem and paste it here.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Dec 2017
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: android studio problem

    In my logcatu dont show any errors. My computer dont support emulators and I must create apk and send him to android table?
    This its link to this project
    https://www.dropbox.com/s/il110r7s40...igapp.zip?dl=0
    Last edited by pingusteam; August 30th, 2018 at 01:08 PM.

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: android studio problem

    The adb command can retrieve the logcat from a Android device attached to a PC via USB. Did you Try that.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. android compiling problem
    By pingusteam in forum Android Development
    Replies: 0
    Last Post: April 28th, 2018, 03:48 AM
  2. Integrate Android studio with lwuit
    By youssef77 in forum Android Development
    Replies: 0
    Last Post: August 2nd, 2014, 08:17 AM
  3. Android emulator problem
    By dougie1809 in forum Java ME (Mobile Edition)
    Replies: 1
    Last Post: March 14th, 2013, 09:50 PM
  4. Problem developing app for Android
    By jume28 in forum JDBC & Databases
    Replies: 1
    Last Post: June 4th, 2012, 05:26 PM
  5. Replies: 3
    Last Post: January 5th, 2012, 01:44 AM