Skip to main content

Titanium Appcelerator - Android and iPhone Application Development Part-2

If you are new in Titanium Appcelerator then check first part clickhere







create new file in main_windos folder name 'mainscreen.js';

put below code in login.js in button click


 loginButton.addEventListener('click',function(e){  
      if(username.value != '' && password.value != ''){  
           //alert("You are login!");  
           if(username.value == 'dhaval' && password.value == 'dhaval'){  
                loSubwin = Titanium.UI.createWindow({  
         url: 'mainscreen.js',  
         title: 'Home',  
         barColor:'#111'  
       });  
       Titanium.UI.currentTab.open(loSubwin,{animated:true});  
           }  
      }else{  
           alert("Please Enter User name & Password!");  
      }  
 });  


put below code in to 'mainscreen.js'


 var win = Titanium.UI.currentWindow;  
 var myCars = new Array();  
 myCars[0] = "Android";  
 myCars[1] = "iPhone";  
 myCars[2] = "Dhaval Sodha Parmar";  
 var comment = new Array();  
 comment[0] = "Google Product...";  
 comment[1] = "Apple Product...";  
 comment[2] = "DJ-Android";  
 var img = new Array();  
 img[0] = "http://im.tech2.in.com/gallery/2012/oct/android_42_251412547482_640x360.jpg";  
 img[1] = "http://images.macworld.com/images/article/2012/09/iphone5_large-294128.jpg";  
 img[2] = "https://lh4.googleusercontent.com/-Xky7Yh54i8c/AAAAAAAAAAI/AAAAAAAAAAA/nvx1glZaRvk/s48-c-k/photo.jpg";  
 //http://im.tech2.in.com/gallery/2012/oct/android_42_251412547482_640x360.jpg  
 //http://images.macworld.com/images/article/2012/09/iphone5_large-294128.jpg  
 //https://lh4.googleusercontent.com/-Xky7Yh54i8c/AAAAAAAAAAI/AAAAAAAAAAA/nvx1glZaRvk/s48-c-k/photo.jpg  
 function loadTweets() {  
      var rowData = [];  
      for (var i = 0; i < myCars.length; i++) {  
           var tweet = myCars[i];  
           // The tweet message  
           var user = comment[i];  
           // The screen name of the user  
           var avatar = img[i];  
           // The profile image  
           var row = Titanium.UI.createTableViewRow({  
                height : 50  
           });  
           // Create the view that will contain the text and avatar  
           var post_view = Titanium.UI.createView({  
                height : 'auto',  
                layout : 'vertical',  
                top : 5,  
                right : 5,  
                bottom : 5,  
                left : 5  
           });  
           // Create image view to hold profile pic  
           var av_image = Titanium.UI.createImageView({  
                url : avatar, // the image for the image view  
                top : 0,  
                left : 0,  
                height : 48,  
                width : 48  
           });  
           post_view.add(av_image);  
           // Create the label to hold the screen name  
           var user_lbl = Titanium.UI.createLabel({  
                text : user,  
                left : 54,  
                width : 120,  
                top : -48,  
                bottom : 2,  
                height : 16,  
                textAlign : 'left',  
                font : {  
                     fontFamily : 'Trebuchet MS',  
                     fontSize : 14,  
                     fontWeight : 'bold'  
                }  
           });  
           post_view.add(user_lbl);  
           // Create the label to hold the tweet message  
           var tweet_lbl = Titanium.UI.createLabel({  
                text : tweet,  
                left : 54,  
                top : 7,  
                bottom : 2,  
                height : 'auto',  
                width : 236,  
                textAlign : 'left',  
                font : {  
                     fontSize : 14  
                }  
           });  
           post_view.add(tweet_lbl);  
           // Add the post view to the row  
           row.add(post_view);  
           // Give each row a class name  
           row.className = "item" + i;  
           // Add row to the rowData array  
           rowData[i] = row;  
      }  
      // Create the table view and set its data source to "rowData" array  
      var tableView = Titanium.UI.createTableView({  
           data : rowData  
      });  
      //Add the table view to the window  
      win.add(tableView);  
 }  
 loadTweets();  

Run this app in to Android & iOS device check output.



Comments

Popular posts from this blog

Why Domain-Specific AI Agents Beat One Big Agent

Everyone is building agents right now. Real estate firms. Independent insurance brokers. Fortune 500 companies with budgets big enough to hire an army of consultants. Ask around and you'll hear the same story everywhere: "we're building our own agent." And yet almost nobody is asking the obvious question: why does the default approach keep failing? One large, general-purpose agent gets wired up to every tool the business owns. It impresses in the demo. Then it quietly stalls before production. There's a gap between what businesses want and what they're actually getting. They want AI woven into their data, their workflows, their day-to-day operations. What they get instead is one oversized agent trying to be a sales rep, a compliance officer, and a customer support line, all at once. That gap is an architecture problem, not a model problem. Key Takeaways The default "one big agent" pattern breaks down on context bloat, cost, fragility, and portability...

Stop Babysitting your AI Coding Agent Every Single Session

  Watched a video by DSquaredLabs on " No more re-explaining: Give your AI agent a memory graph " — here's what stuck with me and why I think this three-tool system is worth your attention If you work on a large codebase with AI coding tools, you already know the ritual. Open a new chat, paste your file structure, explain your stack, describe how the modules connect — and repeat the whole thing tomorrow. It is not a minor inconvenience. It is a compounding productivity tax that gets worse as your project grows. This article breaks down a three-tool system designed to fix exactly that. If you want the full walkthrough with a live demo on a real monorepo, the video at the bottom covers everything in depth — but the core concepts are worth understanding before you dive in. The Problem With How Most Developers Use AI Today Most AI-assisted coding workflows are missing three things that every good engineering team actually has: A map of the codebase A process for how w...

ANDROID - update status Linked-IN

jars: 1. linkedin-j-android.jar 2. scribe-1.3.1.jar MainActivity: package com.testshare; import java.util.EnumSet; import org.scribe.oauth.OAuthService; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.util.Log; import com.google.code.linkedinapi.client.LinkedInApiClient; import com.google.code.linkedinapi.client.LinkedInApiClientFactory; import com.google.code.linkedinapi.client.enumeration.NetworkUpdateType; import com.google.code.linkedinapi.schema.Network; public class TestshareActivity extends Activity { private int LINKEDIN_OAUTH_RESULT_CODE = 4000; private OAuthService service; private static final String PROTECTED_RESOURCE_URL = "http://api.linkedin.com/v1/people/~"; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(...