View Single Post
  #52  
Old November 8th 18, 05:45 PM posted to comp.mobile.android,alt.comp.freeware,microsoft.public.windowsxp.general
Bill[_40_]
external usenet poster
 
Posts: 346
Default Report: My first "hello world" using Android Studio freeware on Windows worked just fine (in about an hour)

Hi Arlen, It seems to me that the tutorial has mistakes and is
misleading! I think by adjusting my code to yours, I have cleared all
the errors.

Re the tutorial, this is what I would like to concentrate on, if I may:

In message , Arlen_Holder
writes
Here are the two main java files which worked for me.
==========
C:\tmp\android\app02\app\src\main\java\com\kiss\a pp02\MainActivity.jav
a


That line seems similar to mine.
==========
package com.kiss.app02;

import android.content.Intent;


I don't have this import, but maybe that comes later.

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;

Check, same here. I then have, and don't know where it has come from,

import static android.icu.lang.UCharacter.GraphemeClusterBreak.V ;

import android.widget.EditText;

Maybe comes later.
public class MainActivity extends AppCompatActivity {


Check
public static final String EXTRA_MESSAGE =
"com.example.myfirstapp.MESSAGE";


Not there yet presume OK

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

Check

/** Called when the user taps the Send button */
public void sendMessage(View view) {


I have fun sendMessage(view: View){
*cf what the tutorial says. View and view are in reverse order, with a
colon between and "fun" is referred to in the code in the tutorial that
says
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}
*

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);

These 5 lines will, I hope appear later
}
}


I haven't yet tried to progress any further (lack of time - we have a
lot of family matters here), but would be interested to know how, for
example, you came to reverse View and view.

The external editor I'm using is Notepad++. I had difficulty making it
the default editor on the Windows 10 machine, but by digging through the
Settings menu to the "Default Options by File type" and then pointing it
to the Notepad++ .exe file.
I understand there is an intermittent bug in W10 that stops Notepad++
being selected and retained, but it worked here. They seem to be raking
out the good bits of Control Panel and gradually destroying it.

I will try to catch up over the next few days. Many thanks for getting
me past this problem.
--
Bill

---
This email has been checked for viruses by AVG.
https://www.avg.com

Ads