Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sat 20 Dec 2014, 09:12
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
How to open dev options in Android 4.2
Post new topic   Reply to topic View previous topic :: View next topic
Page 2 of 3 [31 Posts]   Goto page: Previous 1, 2, 3 Next
Author Message
Dave_G


Joined: 21 Jul 2011
Posts: 459

PostPosted: Thu 20 Dec 2012, 14:03    Post subject:  

Quote:
jpeps wrote:

Why not just root your device and install puppy today?


Is there are Puppy port for ARM that I don't know about which runs on these devices?
Back to top
View user's profile Send private message 
jpeps

Joined: 31 May 2008
Posts: 3220

PostPosted: Thu 20 Dec 2012, 15:56    Post subject:  

Dave_G wrote:
Quote:
jpeps wrote:

Why not just root your device and install puppy today?


Is there are Puppy port for ARM that I don't know about which runs on these devices?


http://puppylinux.org/wikka/PARM
Back to top
View user's profile Send private message 
Dave_G


Joined: 21 Jul 2011
Posts: 459

PostPosted: Thu 20 Dec 2012, 16:27    Post subject:  

Aha, great stuff, thank you.
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5043
Location: Arizona, U.S.A.

PostPosted: Thu 20 Dec 2012, 18:50    Post subject:  

jpeps; I like the idea of what you`ve said.
But isn`t Puppy as a mouse driven interface not really suited for a touch screen?
So much is small buttons and lists and menus to select from.
Unless the tablet was equipped with a stylus Puppy doesn`t seem compatible.

Wouldn`t a rework of Puppy`s GUIs be in order to make this a reality?
And then there`s still the Linux apps. themselves... More rework?
Back to top
View user's profile Send private message 
jpeps

Joined: 31 May 2008
Posts: 3220

PostPosted: Thu 20 Dec 2012, 20:12    Post subject:  

Yes, there's a lot to consider, both for the OS working with the hardware and the software adapting to it. Android programming keeps moving activities off and on the stack as different screen layouts take immediate focus. The programmer includes a number of activities (only one can be active at a time), each with their own layout (the user interface). There's also the issue of screen sizes, where the programmer uses a "fragment" class to arrange widgets based on the available screen space.

Ubuntu has an overlay that rides on top of android, but doesn't use the device's hardware. That might be the closest you'll get to running puppy on an android device.

edit: Found this regarding touchscreen support:

https://wiki.archlinux.org/index.php/Touchscreen
Back to top
View user's profile Send private message 
NeroVance


Joined: 10 Oct 2012
Posts: 168
Location: Canada

PostPosted: Fri 21 Dec 2012, 14:04    Post subject:  

jpeps wrote:
NeroVance wrote:
I did an elective at my local college on Android development, and learned exactly why I don't care for android. Wink

Linux programming all the way Cool


...great, unless you want to program your android device.


You wanna program for a Symbian device Twisted Evil (no offense to Symbian users, even I am curious about the abilities it may still have)

Android as a Platform is horrific when it comes down to developing for it. It acts in ways that make me think it want's to pretend it doesn't use Java, or can use any language, but the thing is bloody java to the core, and having the GUI source in XML and strings and the like is nice if you are doing development that is cross-platform and uses multiple languages, it's just Java.

Well that's my 2 cents.
Back to top
View user's profile Send private message Visit poster's website 
jpeps

Joined: 31 May 2008
Posts: 3220

PostPosted: Fri 21 Dec 2012, 17:23    Post subject:  

NeroVance wrote:


Android as a Platform is horrific when it comes down to developing for it. It acts in ways that make me think it want's to pretend it doesn't use Java, or can use any language, but the thing is bloody java to the core, and having the GUI source in XML and strings and the like is nice if you are doing development that is cross-platform and uses multiple languages, it's just Java.


Understanding java is almost essential. Fortunately, there are a ton of excellent tutorials. Here's one I like using eclipse:

http://eclipsetutorial.sourceforge.net/totalbeginner.html

NeroVance: I don't know about taking one android course at a community college. I've never taken a computer course, but I've done a lot of coding. I find it enjoyable, but there are lots of levels.
Back to top
View user's profile Send private message 
jpeps

Joined: 31 May 2008
Posts: 3220

PostPosted: Sun 20 Jan 2013, 22:52    Post subject:  

Amazing...there's an android AIDE app, which is basically a complete android development environment. You can write apps right on the device itself....and it works.
Back to top
View user's profile Send private message 
jpeps

Joined: 31 May 2008
Posts: 3220

PostPosted: Sun 05 May 2013, 17:33    Post subject:  

NeroVance wrote:


Android as a Platform is horrific when it comes down to developing ....


Having finished an sqlite database app with 5 layout windows that imports, exports, edits and queries anything and everything with various clickable reports (all on my cellphone), I'd have to say that the solution to every imaginable obstacle was readily available via a google search. I'm impressed at just how sophisticated and available Android is for anyone at all interested (also completely enjoyable).
Back to top
View user's profile Send private message 
jpeps

Joined: 31 May 2008
Posts: 3220

PostPosted: Thu 19 Sep 2013, 19:04    Post subject:  

Getting simpler all the time!

http://appinventor.mit.edu/explore/
Back to top
View user's profile Send private message 
jpeps

Joined: 31 May 2008
Posts: 3220

PostPosted: Tue 01 Oct 2013, 00:58    Post subject: Dropbox SyncAPI
Subject description: example: create a link that updates a file to Dropbox
 

This is some code that exports a database file to DropBox using its SyncAPI.
You obtain an appKey & secret from DropBox, and import a jar into your lib directory. This worked to export a Library Database, so I can integrate it into all my devices.There's also some standard permission codes for the Manifest file that is well documented.

TextView and Button are user widgets; the OnClickListener is connected to the buttons, and tells the program what to do when the user clicks on it. Basically, it creates a link with Dropbox, and then performs the file writing function with the doDropBoxTest function. If the file doesn't already exist, it creates it first. Existing files didn't want to be overwritten, so needed to be deleted prior to updating. The mTestOutput.setText code is simply info that shows up on the user screen (the TextView widget).

The FindViewById code in the beginning just links a handle to widgets in the layout.xml file so you can tell them what to do.

note: The link button only shows up once to connect the app with dropbox for a particular device. The app will maintain the link even after exiting, so after that the button remains hidden (see showLinkedView) and automatically updates the file.


Code:

public class MainActivity extends Activity {
   
   private static final String appKey = "MyKEY";
    private static final String appSecret = "MySECRET";
    private static final int REQUEST_LINK_TO_DBX = 0;
    private TextView mTestOutput;
    private Button mLinkButton, buttonExit;
    private DbxAccountManager mDbxAcctMgr;
   
   

   @Override
   protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      
        mTestOutput = (TextView) findViewById(R.id.test_output);
        mLinkButton = (Button) findViewById(R.id.link_button);
        buttonExit = (Button) findViewById(R.id.buttonExit);
        
        buttonExit.setOnClickListener(new OnClickListener() {

         @Override
         public void onClick(View v) {
            
         finish();
         System.exit(0);
         }
        });   
        
        
        mLinkButton.setOnClickListener(new OnClickListener() {
               @Override
               public void onClick(View v) {
                   onClickLinkToDropbox();
               }
        });
             mDbxAcctMgr = DbxAccountManager.getInstance(getApplicationContext(), appKey, appSecret);
 
   }

   @Override
   protected void onResume() {
      super.onResume();
      if (mDbxAcctMgr.hasLinkedAccount()) {
          showLinkedView();
          doDropboxTest();
         
      } else {
         showUnlinkedView();
      }
   }
   
         private void showUnlinkedView() {
                        mLinkButton.setVisibility(View.VISIBLE); mTestOutput.setVisibility(View.GONE);
      
   }
      private void showLinkedView() {
      mLinkButton.setVisibility(View.GONE);
           mTestOutput.setVisibility(View.VISIBLE);
      
   }
      private void onClickLinkToDropbox() {
   mDbxAcctMgr.startLink((Activity)this, REQUEST_LINK_TO_DBX);
                   }

   @Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
     if (requestCode == REQUEST_LINK_TO_DBX) {
       if (resultCode == Activity.RESULT_OK) {
           doDropboxTest();
        } else {
      mTestOutput.setText("Link to Dropbox failed or was cancelled.");
                        }
      } else {
    super.onActivityResult(requestCode, resultCode, data);
                    }
                }

 private void doDropboxTest() {
                  
 mTestOutput.setText("Dropbox Sync API Version "+DbxAccountManager.SDK_VERSION_NAME+"\n");
                  
  String packageName = "com.jpeters.myandroidlibrary2";
 
 File myFilesDir = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/" + packageName + "/files");

 File newFile = new File(myFilesDir, "MyLibrary.db");
                     
   try{       
    final String TEST_FILE_NAME = "MyLibrary.db";

DbxPath testPath = new DbxPath(DbxPath.ROOT, TEST_FILE_NAME);
                        
     // Create DbxFileSystem for synchronized file access.
    DbxFileSystem dbxFs = DbxFileSystem.forAccount(mDbxAcctMgr.getLinkedAccount());
               
 // Print the contents of the root folder.  This will block until we can
 // sync metadata the first time.
                          
List<DbxFileInfo> infos = dbxFs.listFolder(DbxPath.ROOT);
mTestOutput.append("\nContents of app folder:\n");
                      
for (DbxFileInfo info : infos) {
 mTestOutput.append("    " + info.path + ", " + info.modifiedTime + '\n');
                          
// Create a db file if it doesn't already exist.
      if (!dbxFs.exists(testPath)) {
      DbxFile  testFile = dbxFs.create(testPath);
// write existing file to dropbox   
                              testFile.writeFromExistingFile(newFile, false);
      testFile.close();
 }   
    else {   
    // remove existing file to update
   dbxFs.delete(testPath);
   DbxFile  testFile = dbxFs.create(testPath);
                              
                              testFile.writeFromExistingFile(newFile, false);
   testFile.close();
                           }
 mTestOutput.append("\nCreated new file '" + testPath + "'.\n");   
                            
               
} catch (IOException e) {
mTestOutput.setText("Dropbox test failed: " + e);
                    }
   
   
   }
}      
Back to top
View user's profile Send private message 
jpeps

Joined: 31 May 2008
Posts: 3220

PostPosted: Fri 04 Oct 2013, 04:25    Post subject: Exporting to Dropbox from within an APP  

This example exports a file by clicking on a menu item from within the app. First, connect the menu click to a function that checks whether there's a linked account. Generally, it only needs to do this once. It then connects to the export function itself.

bug fix: safer not to run the export function on the same menu click with establishing an initial connection.

Code:

 private void dropboxClick() {
       
 mDbxAcctMgr = DbxAccountManager.getInstance(getApplicationContext(), appKey, appSecret);
        if (!mDbxAcctMgr.hasLinkedAccount()) {

mDbxAcctMgr.startLink((Activity)this, REQUEST_LINK_TO_DBX);
   
         
        } else {
      
    doDropboxExport();
                }
       
}


After you have your connection, you can proceed to copy the file to your linked account. Dropbox creates a folder with the app name you registered. ("Toast" provides dialog messages like the TextEdit widget in the previous example).

Code:

private void doDropboxExport() {
       File newFile = new File(DB_FILEPATH, DATABASE_NAME);
         
      try {
 final String TEST_FILE_NAME = "MyLibrary.db";
DbxPath testPath = new DbxPath(DbxPath.ROOT, TEST_FILE_NAME);
            
              
DbxFileSystem dbxFs = DbxFileSystem.forAccount(mDbxAcctMgr.getLinkedAccount());
   // Create a db file if it doesn't already exist.
          
   if (!dbxFs.exists(testPath)) {
            DbxFile  testFile = dbxFs.create(testPath);
         // write existing file to dropbox   
            testFile.writeFromExistingFile(newFile, false);
            testFile.close();
Toast.makeText(this, "Written to DropBox: " + TEST_FILE_NAME, Toast.LENGTH_SHORT).show();
            }   
     else {   
            // remove existing file to update
            dbxFs.delete(testPath);
            DbxFile  testFile = dbxFs.create(testPath);
               
            testFile.writeFromExistingFile(newFile, false);
            testFile.close();
Toast.makeText(this, "Written to DropBox: " + TEST_FILE_NAME, Toast.LENGTH_SHORT).show();
            }
         

      } catch (Unauthorized e) {
Toast.makeText(this, "Dropbox Failed!" + e, Toast.LENGTH_SHORT).show();
         e.printStackTrace();
} catch (DbxException e) {
         Toast.makeText(this, "Dropbox Failed!" + e, Toast.LENGTH_SHORT).show();
         e.printStackTrace();
      } catch (IOException e) {
         Toast.makeText(this, "Dropbox Failed!" + e, Toast.LENGTH_SHORT).show();
         e.printStackTrace();
      }
      
      
   }
Back to top
View user's profile Send private message 
jpeps

Joined: 31 May 2008
Posts: 3220

PostPosted: Fri 11 Oct 2013, 22:03    Post subject: Android tutorial
Subject description: Moving and storing data
 

Helpful tutorial on moving around data between activities (via UI widgets) and storing.

Contains videos, step by step instructions, and source code that can be imported (into Eclipse).

http://www.mybringback.com/series/android-intermediate/
Back to top
View user's profile Send private message 
jpeps

Joined: 31 May 2008
Posts: 3220

PostPosted: Mon 18 Nov 2013, 15:41    Post subject: Storing and Saving Data
Subject description: example: Interal & external storage
 

Example: Save and restore data internally and externally


Saving widget and variable internally with Shared Preferences:


// Save data (KEY, string)
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
Editor editor = sharedPreferences.edit();

editor.putString("total", String.valueOf(total));
editor.putString("date", dateString );
editor.putString("activity", activity );


editor.commit();





// Get Saved Data (KEY, default value)

SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);

// Load to EditText widget:

sumText.setText(sharedPreferences.getString("total", "0"));
// Restore variables

oldDate = sharedPreferences.getString("date", null);
activity = sharedPreferences.getString("activity", "");



Save data to external file:

// Create directory on SD storage

root = android.os.Environment.getExternalStorageDirectory();

dir = new File(root.getAbsolutePath() + "/clickData");
if(! dir.exists())

dir.mkdir();

// Create file

File file = new File(dir, "myRecord.txt");


// Print data to file

try {
FileOutputStream f = new FileOutputStream(file,true); // boolean "true" means append file
PrintWriter pw = new PrintWriter(f, true);

pw.println(dataString + " " + activity);

pw.flush();
pw.close();
f.close();

// Optional: Toast gives an onscreen info message
Toast toast = Toast.makeText(getApplicationContext(), "File written to "+file, Toast.LENGTH_SHORT);
toast.show();



} catch (FileNotFoundException e) {
Toast toast = Toast.makeText(getApplicationContext(), "File Not Found!" , Toast.LENGTH_SHORT);
toast.show();
e.printStackTrace();
} catch (IOException e) {
Toast toast = Toast.makeText(getApplicationContext(), "IO Exception Error!" , Toast.LENGTH_SHORT);
toast.show();
e.printStackTrace();
}


Read from External File:

// writes file to EditText widget (reportText)


try {
BufferedReader br = new BufferedReader(new FileReader(file));
String line;

while ((line = br.readLine()) != null) {

reportText.append(line + "\n");
}


} catch (FileNotFoundException e1) {
Toast toast = Toast.makeText(getApplicationContext(), "No Report on file", Toast.LENGTH_SHORT);
toast.show();
e1.printStackTrace();
} catch (IOException e) {
Toast toast = Toast.makeText(getApplicationContext(), "IO Exception Error!", Toast.LENGTH_SHORT);
toast.show();
e.printStackTrace();
}
Back to top
View user's profile Send private message 
afifio

Joined: 26 Oct 2013
Posts: 19

PostPosted: Tue 19 Nov 2013, 00:47    Post subject:  

Android is the future, no doubt. But its still far, I'll give it 5 or 10 years more for it to become truly mainstream. During that, we will still have "common pc" <----- common! Laughing

I did try to wet my feet with ADT, but at 400MB API and who knows whats there, it might burn my pc to crisp. Even running eclipse is trivial for me....plus...I sux at java and its damn slow.

jpeps, checkout the Actionbar Sherlock, another thing to boot up your dev is the https://f-droid.org/‎ . I do envy the android community, they make it seems like easy and I got sleepy reading even the intro to android apps, Laughing

The problem with android is - not much apps to develop, its because of its limited screen and the windowing capability (probably more apps will use the ICS windowing after this)

As I said, if you could develop for android - what will you develop ? Almost all is there already and downloadable from the market and yes, AIDE rocks! - no need 400MB download!
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 2 of 3 [31 Posts]   Goto page: Previous 1, 2, 3 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1231s ][ Queries: 12 (0.0035s) ][ GZIP on ]