View Single Post
  #51  
Old November 8th 18, 10:24 AM posted to comp.mobile.android,alt.comp.freeware,microsoft.public.windowsxp.general
Arlen_Holder
external usenet poster
 
Posts: 96
Default Report: My first "hello world" using Android Studio freeware on Windows worked just fine (in about an hour)

On Wed, 7 Nov 2018 16:39:06 +0000, Bill wrote:

I haven't really checked any speeds.


Hi Bill,

Good news!

Now that I got all the old-AMD-induced emulations problems worked out,
I just completed the official Android Studio "My First App" tutorial:
https://developer.android.com/training/basics/firstapp/
Where the emulation speed is "about the same" as the physical speed,
although, again, I haven't timed it with a stopwatch, and I'm counting
assuming the emulator is already up and ready to take files just as a phone
would be as it's connected via USB to the computer.

The emulation seems quite slow to
appear, but, because I've stayed with the text instructions, I haven't
actually got any buttons to press that do anything on the emulator.


In that first app, there are only three buttons that you can test.
o One is called "Send", which will send the text to the next screen
o The other two are the top & bottom "back" buttons on the second screen

Here is a set of screenshots showing those events on the MS emulator:
o The app running in a Nexus 7 emulation displays a screen for text input:
http://www.bild.me/bild.php?file=5614359androidstudio42.jpg
o You enter any desired text and hit the "Send" button:
http://www.bild.me/bild.php?file=1062599androidstudio43.jpg
o That sends the text to the next level (where all the back buttons work):
http://www.bild.me/bild.php?file=6870342androidstudio44.jpg

I am
still stuck where I enter the java message stub under the heading "Start
another activity". I haven't had much time and have spent it mainly
trying to get the instance of the program on the other machine - with
default settings everywhere - working.


Here are the two main java files which worked for me.
==========
C:\tmp\android\app02\app\src\main\java\com\kiss\ap p02\MainActivity.java
==========
package com.kiss.app02;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

public class MainActivity extends AppCompatActivity {
public static final String EXTRA_MESSAGE =
"com.example.myfirstapp.MESSAGE";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}

/** Called when the user taps the Send button */
public void sendMessage(View view) {
Intent intent = new Intent(this, DisplayMessageActivity.class);
EditText editText = (EditText) findViewById(R.id.editText);
String message = editText.getText().toString();
intent.putExtra(EXTRA_MESSAGE, message);
startActivity(intent);
}
}
==========
C:\tmp\android\app02\app\src\main\java\com\kiss\ap p02\DisplayMessageActivity.java
==========
package com.kiss.app02;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;

public class DisplayMessageActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_display_message);

// Get the Intent that started this activity and extract the string
Intent intent = getIntent();
String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);

// Capture the layout's TextView and set the string as its text
TextView textView = findViewById(R.id.textView);
textView.setText(message);
}
}
==========
I have a spare Android 6 phone that I've been using. I also have an
Android 4 phone and a couple of Android 4 tablets, but haven't tried any
of these. ( I've kept them all because each has a special feature eg an
A4 tablet receives off air TV).


Thanks for letting me know you've been emulating but that you can run the
apps on the phones. My main warning to you on running the apps on the
phones is that it clutters them up with your test apps, but otherwise I
have run all the test on the physical phone and it works just fine either
way (on the emulator, or on the phone).

The emulator is more convenient because I can pick any emulator I want.

I will probably concentrate on the machine where the emulator works,
concentrate on getting the java to work, and then look at where to go
from there.


Let me know if you need me to post any code for you.

These are most likely the six files that you may want to look at:
C:\tmp\android\app02\app\src\main\java\com\kiss\ap p02\MainActivity.java
C:\tmp\android\app02\app\src\main\res\layout\activ ity_main.xml
....
C:\tmp\android\app02\app\src\main\java\com\kiss\ap p02\DisplayMessageActivity.java
C:\tmp\android\app02\app\src\main\res\layout\activ ity_display_message.xml
....
C:\tmp\android\app02\app\src\main\AndroidManifest. xml
C:\tmp\android\app02\app\src\main\res\values\strin gs.xml
....

BTW, I'm curious what happens when you doubleclick on those *.java
and *.xml files. What editor comes up for you? Can you change that editor?

I think the timer app is a great basic thing to aim for, and
have at least one idea of my own for a further "one button" app.


I think it would be great if we both work on a simple timer app as our
first app that strays off the trail that the tutorials provide to us.

The timer seems simple enough in that you hit an icon, and ten minutes
later a timer rings. It would have utility to millions of people as the
_simplest_ timer on the planet!

My intention, if I ever develop apps, would be that they be
o Always free
o Always ad free, cloud free, spyware free, permission free, etc.
o And that they perform a simple KISS functionality

That's why I named the "company" field "kiss".
Ads