SUBSIM Radio Room Forums



SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997

Go Back   SUBSIM Radio Room Forums > General > General Topics > Subsim 3.0 R & D
Forget password? Reset here

Reply
 
Thread Tools Display Modes
Old 06-17-12, 05:28 AM   #1
McBeck
Admiral
 
McBeck's Avatar
 
Join Date: Feb 2001
Location: Denmark
Posts: 2,023
Downloads: 15
Uploads: 0


Default Fooling aroind with Java

OK, so I created a package called "the.stuff.needed"
with this code:
Code:
package the.stuff.needed;

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

public class MySecondProjectActivity extends Activity {
    /** Called when the activity is first created. */
   TextView textView1;
       
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Account account1 = new Account("Burd","222 Cyberspace Lane", 24.02);
        
        textView1=((TextView) findViewById(R.id.textView1));
        textView1.setText (account1.infoString());
    }
}
This is located in "MySecondProjectAcitivity.java"

In "Account.java" I have created below:
Code:
package the.stuff.needed;

public class Account {
    public String name;
    public String address;
    public double balance;
    
    public Account(String name,
            String address,
            double balance) {
        this.name=name;
        this.address=address;
        this.balance=balance;
    }
    public String infoString() {
        return name + " ( " + address + 
                " ) has $" + balance;
    }
}
This is for the Account class, its varibles, methods and contructors.

How can I be sure that the MySecondProjectAcitivity.java looks in Account.java?
__________________

"I like subcommanders...they dont have time for bull****!"

Proud member of the Subsim army of zombies
Becks website
McBeck is offline   Reply With Quote
Old 06-17-12, 03:55 PM   #2
PeriscopeDepth
Sea Lord
 
Join Date: Jul 2002
Location: Pacific NW
Posts: 1,894
Downloads: 6
Uploads: 0
Default

I'm not sure what you mean by "looks in". Are you getting a class not found error for account? If that's the case throw this in your imports:

import the.stuff.needed.Account
PeriscopeDepth is offline   Reply With Quote
Old 06-17-12, 08:19 PM   #3
the_tyrant
Admiral
 
Join Date: Jun 2010
Location: Canada
Posts: 2,272
Downloads: 58
Uploads: 0
Default

Quote:
Originally Posted by PeriscopeDepth View Post
I'm not sure what you mean by "looks in". Are you getting a class not found error for account? If that's the case throw this in your imports:

import the.stuff.needed.Account
+1
If they are in the same package, than you can declare an account from MySecondProjectActivity
__________________
My own open source project on Sourceforge
OTP.net KGB grade encryption for the rest of us
the_tyrant is offline   Reply With Quote
Old 06-18-12, 12:30 AM   #4
McBeck
Admiral
 
McBeck's Avatar
 
Join Date: Feb 2001
Location: Denmark
Posts: 2,023
Downloads: 15
Uploads: 0


Default

Thanks. I'm very new to how this works, so its baby steps :-D
__________________

"I like subcommanders...they dont have time for bull****!"

Proud member of the Subsim army of zombies
Becks website
McBeck is offline   Reply With Quote
Old 06-18-12, 01:12 AM   #5
PeriscopeDepth
Sea Lord
 
Join Date: Jul 2002
Location: Pacific NW
Posts: 1,894
Downloads: 6
Uploads: 0
Default

Quote:
Originally Posted by McBeck View Post
Thanks. I'm very new to how this works, so its baby steps :-D
Just FYI, if you really wanted to I believe you could have referred to the class using the fully qualified the.stuff.needed.Account (ex: the.stuff.needed.Account.infoString()). But nobody does that, that's too much typing!

Trying to hook up the tab bars to actions and put them into a fragment as we speak, didn't get started as early as I wanted to and will probably be going to bed soon though :/.

PD
PeriscopeDepth is offline   Reply With Quote
Old 06-18-12, 03:39 AM   #6
McBeck
Admiral
 
McBeck's Avatar
 
Join Date: Feb 2001
Location: Denmark
Posts: 2,023
Downloads: 15
Uploads: 0


Default

Quote:
Originally Posted by PeriscopeDepth View Post
Just FYI, if you really wanted to I believe you could have referred to the class using the fully qualified the.stuff.needed.Account (ex: the.stuff.needed.Account.infoString()). But nobody does that, that's too much typing!

Trying to hook up the tab bars to actions and put them into a fragment as we speak, didn't get started as early as I wanted to and will probably be going to bed soon though :/.

PD
Don't worry PD, this is a hobby project, so don't rush because of me.
I think Neal is working on the mobile versions of news and forums. Just waiting for him to confirm, so we can test.
__________________

"I like subcommanders...they dont have time for bull****!"

Proud member of the Subsim army of zombies
Becks website
McBeck is offline   Reply With Quote
Old 06-30-12, 05:49 AM   #7
McBeck
Admiral
 
McBeck's Avatar
 
Join Date: Feb 2001
Location: Denmark
Posts: 2,023
Downloads: 15
Uploads: 0


Default

Did you progress on the buttons and the code?
__________________

"I like subcommanders...they dont have time for bull****!"

Proud member of the Subsim army of zombies
Becks website
McBeck is offline   Reply With Quote
Old 07-04-12, 12:36 AM   #8
PeriscopeDepth
Sea Lord
 
Join Date: Jul 2002
Location: Pacific NW
Posts: 1,894
Downloads: 6
Uploads: 0
Default

Quote:
Originally Posted by McBeck View Post
Did you progress on the buttons and the code?
Hey McBeck!

Sorry for going MIA, was out of town all of last week and the rest of the time was spent occupied with the real world.

I am going to try to get back to this now, I also have some Android hardware to test on now!

PD
PeriscopeDepth is offline   Reply With Quote
Old 07-04-12, 01:58 AM   #9
McBeck
Admiral
 
McBeck's Avatar
 
Join Date: Feb 2001
Location: Denmark
Posts: 2,023
Downloads: 15
Uploads: 0


Default

Quote:
Originally Posted by PeriscopeDepth View Post
Hey McBeck!

Sorry for going MIA, was out of town all of last week and the rest of the time was spent occupied with the real world.

I am going to try to get back to this now, I also have some Android hardware to test on now!

PD
Sound great did you get a new phone?
Neals been off as well, so I doubt he has progressed on the updates on his side as well.

I have been busy too, would love to get a look at some code examples...
__________________

"I like subcommanders...they dont have time for bull****!"

Proud member of the Subsim army of zombies
Becks website
McBeck is offline   Reply With Quote
Old 07-04-12, 02:26 AM   #10
PeriscopeDepth
Sea Lord
 
Join Date: Jul 2002
Location: Pacific NW
Posts: 1,894
Downloads: 6
Uploads: 0
Default

Quote:
Originally Posted by McBeck View Post
Sound great did you get a new phone?
Neals been off as well, so I doubt he has progressed on the updates on his side as well.

I have been busy too, would love to get a look at some code examples...
Work sent me to the Google developer conference, my company kept the tablet for testing our app and I made off with everything else (a Galaxy Nexus phone, among the booty!). First real Android hardware I've owned, liking it so far.

If you haven't seen it, Google's put together a decent Android best practices section (finally) at: http://developer.android.com/training/index.html

PD
PeriscopeDepth is offline   Reply With Quote
Old 07-04-12, 03:17 AM   #11
McBeck
Admiral
 
McBeck's Avatar
 
Join Date: Feb 2001
Location: Denmark
Posts: 2,023
Downloads: 15
Uploads: 0


Default

Quote:
Originally Posted by PeriscopeDepth View Post
Work sent me to the Google developer conference, my company kept the tablet for testing our app and I made off with everything else (a Galaxy Nexus phone, among the booty!). First real Android hardware I've owned, liking it so far.

If you haven't seen it, Google's put together a decent Android best practices section (finally) at: http://developer.android.com/training/index.html

PD
you lucky SOB
__________________

"I like subcommanders...they dont have time for bull****!"

Proud member of the Subsim army of zombies
Becks website
McBeck is offline   Reply With Quote
Old 07-09-12, 02:34 AM   #12
PeriscopeDepth
Sea Lord
 
Join Date: Jul 2002
Location: Pacific NW
Posts: 1,894
Downloads: 6
Uploads: 0
Default

So I finally have a half way respectable fragment tab activity running. I'll commit it to the mercurial repo tomorrow, I have some housekeeping on the repository to do.

PD
PeriscopeDepth is offline   Reply With Quote
Old 07-09-12, 03:23 AM   #13
McBeck
Admiral
 
McBeck's Avatar
 
Join Date: Feb 2001
Location: Denmark
Posts: 2,023
Downloads: 15
Uploads: 0


Default

Quote:
Originally Posted by PeriscopeDepth View Post
So I finally have a half way respectable fragment tab activity running. I'll commit it to the mercurial repo tomorrow, I have some housekeeping on the repository to do.

PD
Thanks!
__________________

"I like subcommanders...they dont have time for bull****!"

Proud member of the Subsim army of zombies
Becks website
McBeck is offline   Reply With Quote
Old 07-10-12, 01:51 AM   #14
PeriscopeDepth
Sea Lord
 
Join Date: Jul 2002
Location: Pacific NW
Posts: 1,894
Downloads: 6
Uploads: 0
Default

Alright, changes pushed up.

As far as next steps go:

- An RSS feed for each of the three news feeds on the main pages (Subsim, world, and reviews) would greatly help. Just to be clear, one RSS feed for each category.

- For forums are we just doing a webview? I have no idea whether there's an available API for that. And is it even possible to do any of the forum stuff better than tapatalk? Maybe we should just leave forums out?

- Any other feature ideas?

- I feel like I'm somewhat back up to speed on the Android stuff. Do we want to stick with the tabbed layout? From what I understand, action bars (http://developer.android.com/referen...ActionBar.html) are the new normal for Android navigation. For an example, look at the Play Store (or many others) app. They are Honeycomb and above, but there are libraries to help us target earlier versions without too much trouble.

- Is there anybody around who considers themselves a designer? We will need graphics for icons, opinions on colors, etc eventually.

Is there an iOS app in progress? If so, if whoever is doing that is open to any help, I would certainly be interested in helping out. I would probably focus on the Android stuff though, iOS is what I do all day at work.

PD
PeriscopeDepth is offline   Reply With Quote
Old 07-26-12, 03:08 PM   #15
McBeck
Admiral
 
McBeck's Avatar
 
Join Date: Feb 2001
Location: Denmark
Posts: 2,023
Downloads: 15
Uploads: 0


Default

Quote:
Originally Posted by PeriscopeDepth View Post
Alright, changes pushed up.

As far as next steps go:

- An RSS feed for each of the three news feeds on the main pages (Subsim, world, and reviews) would greatly help. Just to be clear, one RSS feed for each category.

- For forums are we just doing a webview? I have no idea whether there's an available API for that. And is it even possible to do any of the forum stuff better than tapatalk? Maybe we should just leave forums out?

- Any other feature ideas?

- I feel like I'm somewhat back up to speed on the Android stuff. Do we want to stick with the tabbed layout? From what I understand, action bars (http://developer.android.com/referen...ActionBar.html) are the new normal for Android navigation. For an example, look at the Play Store (or many others) app. They are Honeycomb and above, but there are libraries to help us target earlier versions without too much trouble.

- Is there anybody around who considers themselves a designer? We will need graphics for icons, opinions on colors, etc eventually.

Is there an iOS app in progress? If so, if whoever is doing that is open to any help, I would certainly be interested in helping out. I would probably focus on the Android stuff though, iOS is what I do all day at work.

PD
I'm on vacation, so ill try it out when I get back.

I think one of the other threads were on ois.

As for graphics, I suggest we get the functions in there first and then tweak the looks. What do you think (I have little experience).

As for tabs, I think we should stick to you idea and focus on something that would work for most. Do lets target the solution that covers android 2.3 and up. Does that sound fair?
__________________

"I like subcommanders...they dont have time for bull****!"

Proud member of the Subsim army of zombies
Becks website
McBeck is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 07:36 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © 1995- 2024 Subsim®
"Subsim" is a registered trademark, all rights reserved.