Android Development: Class That Creates an Object, Calls Some Methods Then Returns That Object (How?)
<p>I'm wondering how I'd go about making a class, let's call it Class Master, where:
- You call Class Master and it calls Class A, and calls some of that Class A's methods, then returns Class A so you can call methods from the returned Class A where ever you called Class Master.</p>

<p>Basically, I want to turn this code:</p>

<pre><code>//Create FTPClient object and connect
FTPClient ftpClient = new FTPClient(); 
ftpClient.connect(server);
ftpClient.enterLocalPassiveMode();
ftpClient.login(username);
ftpClient.listFiles("/");
</code></pre>

<p>Into this code:</p>

<pre><code>FTPClient ftpClient = new ftpConnection(); //Connects, enters passive mode and logs in then returns the FTPClient object we created so we can do other stuff with it, like below:
ftpClient.listFiles("/");
</code></pre>

<p>So that I can have one single call that I can use in different activites to connect to an FTP, if you understand what I mean.</p>

<p>I tried myself but I didn't get the desired effect for some reason (don't have the code I tried anymore)</p>

<p>Thanks,
Alex.</p>
