Pages

Thursday, January 23, 2014

How to run existing Android Apps from another application or create launcher

This is script to make a launcher or call another android app from others.

PackageManager pm=getPackageManager();
Intent intent=pm.getLaunchIntentForPackage("com.yourcompany.package_name"));
if (intent!=null){
   startActivity(intent);
}

If you run from a fragment, you must add Context before you get a PackageManger, and the script is :

PackageManager pm=mContext.getPackageManager();
Intent intent=pm.getLaunchIntentForPackage("com.yourcompany.package_name"));
if (intent!=null){
   mContext.startActivity(intent);
}

Let's try for your own Android application.


Tuesday, December 31, 2013

Objective-C for Beginner (Part 2)

See article before here.
Lets we begin with an simple application using Objective-C, both use in iOS platform or OSX development with open your XCode, choose OS X Application and then Command Line Tool.




After you choose button Create, you will enter XCode Development Environment like figure below :
On the bottom right corner you can see the result of compilation program.

Objective-C for Beginner (Part 1)

Tools Requirements :
  • Mac OSX (Leophard, Mountain Lion, Lion, Mavericks, etc)
  • XCode (get from http://developer.apple.com)
Skill Requirements :
  • Other Basic Computer Programming (Java, PHP, Pascal, Delphi, etc)
  • Typing with 10 fingers (just kidding

Introducing Objective-C and XCode

For the most part, all computer languages perform the typical tasks that any computer needs to do—store information, compare information, make decisions about that information, and perform some action based on that decision. Objective-C is a language to make these tasks easier to accomplish and understand. The real trick with Objective- C (actually the trick with any C language) is understanding the symbols and keywords used to accomplish those tasks. This chapter introduces you Objective-C and Xcode— from Objective-C’s humble beginnings as an extension to the C language to using Xcode (a tool to build programs using Objective-C) to build programs. By the end of this chapter, you will understand what Objective-C is and know how to write a simple application using Xcode.


A Brief History of Objective-C
Objective-C is really a combination of two languages: the C language and a lesser- known language called Smalltalk. Back in the 1970s, several very bright engineers from Bell Labs created a language they named C that made it easy to port their pet project, the UNIX operating system, from one machine to another. Prior to C, people had to write programs in assembly languages. The problem with assembly languages is that each is specific to its machine, so moving software from one machine to another was nearly impossible. The C language, created by Brian Kernighan and Dennis Ritchie, solved this problem by providing a language that wrote out the assembly language for whatever machine it supported, a kind of Rosetta Stone for early computer languages. Because of its portability, C quickly became the de facto language for many types of computers, early PCs especially.
Fast-forward to the early 1980s, and the C language is on its way to becoming one of the most popular languages of the decade. Right around this time, an engineer from a company called Stepstone was mixing the C language with another up-and-coming language called Smalltalk. The C Language is typically referred to as a procedural language, that is, a language that uses procedures to divide up processing steps. Smalltalk, on the other hand, was something entirely different. It was an object-oriented programming language. Instead of processing things procedurally, it used programming objects to get its work done. This new superset of the C language became known as “C with Objects” or more commonly, Objective-C.
In 1985, Brad Cox sold the Objective-C language and trademark to NeXT Computer, Inc. NeXT was the brainchild of Steve Jobs, who had been fired from his own company, Apple Computer, that very same year. NeXT used the Objective-C language to build the NeXTSTEP operating system and its suite of development tools. In fact, the Objective-C language gave NeXT a competitive advantage with all of its software. Programmers using NeXTSTEP and Objective-C could write more-functional programs faster than those writing in the traditional C language. While the hardware part of NeXT computers never really took off, the operating system and tools did. Quite interestingly, NeXT was purchased by Apple Computer in late 1996 with the intention of replacing its aging operating system, which had been in existence since the first Macintosh was developed in 1984. Four years after the acquisition, what had been NeXTSTEP reemerged as Mac OS X—with Objective-C still at the heart of the system. 

Understanding C Language Basics
Even though Objective-C integrates a great object-oriented language, at the heart of Objective-C is C. Here is the most basic “Hello World” program written in the C language:
int main(void)
{

        if (printf(“Hello World”) == 0)
        {
         return 0;
         


        } else { 
          return 1;
        } 
}
Let’s dissect this a bit. Every program must start somewhere, right? Well, for Objective- C and C, main is the name of the procedure (which is often called a function in C) that is called first.
        int main(void)
It must be called “main”, not “Main,” “MAIN,” or anything else. C and Objective-C are case-sensitive languages meaning that main and Main are entirely different names.
Functions (and main is a function) all share the following syntax when they are declared: 
 return-type functionName ( argument-list ) 


Our first function, main, has the following:
  •  A return type of int: int is just shorthand for “integer.” An integer is a 32-bit value that has a range from –2,147,483,648 to 2,147,483,647. That’s a pretty large range of values! So, the function, main, must return an integer value to the function that called it. 
  • A function name of main: As mentioned previously, main is the starting point of any C or Objective-C program. If we were writing a different function, it could be named pretty much anything, as long as it starts with a letter. 
  • An argument list of void:void is a special type : it represents, in this case, the fact that there are no arguments.

The next line contains the character {. This is the opening brace symbol and is used to represent the beginning of series of steps, which is commonly referred to as a block of code. Every language has something like this, but in other languages, the opening of the block may either be implied or called BEGIN. In any case, the opening brace means that we are defining a block.

The third line: 
     if (printf(“Hello World”) != -1)  
actually has two parts. First, is the if keyword is a special command in the C and Objective-C languages that performs a test on something. To know what the if is testing, the next part is important: 
      printf(“Hello World”) 
This is a standard C function that prints formatted information to the screen. Now, the printf function returns a value after it completes its job. Basically, the result from the printf is whether the function actually worked or not. If printf returns a value greater than 0, the procedure worked; otherwise, it didn’t. The printf function is being passed a single argument, that is, the string “Hello World”. A string is nothing more that a series of characters grouped together. 
Therefore, printf is called and returns a value, and the if statement compares that value with another.  
The second part of the statement is the not-equal sign (!=): != -1) 
In C and Objective-C, an exclamation point is a logical not operator, so != means “not equal.” In this case, the if statement is comparing the return value from the printf procedure with the integer constant of –1. 

The forth, fifth, and sixth lines are as follows:
 {
     return 0;
 } 
This section starts off with another brace symbol, which means that another block is starting. In this case,
the first block that occurs after the if keyword represents the things for the program to do if the result of the if test is true. If the printf function call returns 0, the test for 0 will be true. If we replace the printf function with a return value of 0, if (0 == 0) is a true statement. Last, the closing brace (}) represents the end of this block.
However, if the test is not true, this block is completely ignored. Also notice that the line ends with a semicolon (;). This character is used in C and Objective-C to indicate that the end of a command. Why isn’t there one on the if statement? Well, the if statement is not finished being defined; the return statement represents the end of the true part of the if statement.
To sum it up, in the function main, if the printf statement returns a value of 0, the block after the if is used and this function will return a value of 0. In the C Language, a returned integer value of 0 typically represents a good thing. No news is good news.
Here’s the last part of the program:
  else
      {
            return 1;
       }

The else keyword is optionally used along with any if keyword. The block that appears right after the else keyword represents the things to do if the test in the if statement is not true. If the return value from printf is something other than 0, the else block will be executed.
Okay, that’s enough C language for now. Although the C Language is at the heart of Objective-C and very important, the “objective” part of Objective-C is used much more prevalently.
 


Apa bedanya Android dan iOS

Hai guys ...
Mungkin diantara teman-teman yang baru melangkah untuk menekuni pemrograman mobile via Android dan iOS jadi pertanyaan mendasar ketika pertama kali memutuskan untuk menekuni salah satu dari platform tersebut.
Ada beberapa pertimbangan yang perlu dibuat untuk memutuskan apakah kita mau konsen ke salah satu atau dua-duanya.
Kebetulan saat ini aku mulai beralih ke iOS, dengan berbagai pertimbangan sebagai berikut :
  1. Pertimbangan pasar aplikasi gadget Android vs iOS. Bila kita ingin produk kita langsung menghasilkan dolar, maka platform iOS adalah pilihan terbaik. Karena Google Play memiliki aturan yang lebih ribet dalam sistem pembayarannya (dan Indonesia kayaknya belum di support) daripada Apple Store (iTunes).
  2. Pertimbangan banyaknya jumlah developer yang sudah menjejali Android, ini membuat persaingan menjadi semakin ketat dan peluang kita mendapatkan kue download menjadi terbatas.
  3. Di Google Play hanya berharap kepada Admob (sebagai publisher), sedangkan di Apple Store kita bisa berharap kepada keduanya.
  4. Tools buat pengembangan lebih lengkap iOS Developer program, disertai dengan banyak contoh dan dokumentasi yang langsung bisa di PDF-kan, sedangkan library di Android banyak yang disediakan oleh pihak ke 3, sehingga membuat aplikasi menjadi lebih besar ukurannya. Bagi programmer newbie di Mobile Apps yang belum memiliki laptop/pc Apple Mac OSX, saya sarankan untuk memilih Android dahulu sebagai media belajar dan membuat portofolio.
  5. Pembayaran bisa langsung di transfer ke Rekening Bank yang ada di Indonesia (hampir semua bank)
Nah, guys ...
Selamat memutuskan mana yang menurut agan-agan semua lebih enak dan enjoy. Bagi programmer Java, mungkin lebih cepat menguasai Android, tetapi bagi yang biasa pake C++ (si plus plus), pake XCode/iOS lebih asyik.

Thursday, November 10, 2011

Sorry, Nintendo, Sony: Phone games win more dollars


Five years ago when you talked about portable or mobile gaming, it meant you were talking about Nintendo DS or PlayStation Portable. Today, mobile gaming means Angry Birds andFruit Ninja and other extremely popular and free or very inexpensive smartphone games. IOS and Android have tripled their market share in games since 2009. But it’s not just number of individual game sales on iOS and Android devices that’s growing. The two platforms’ games are affecting the bottom lines of the biggest names in gaming.
On Wednesday, analytics company Flurry Mobile released statistics that show that games on the top two smartphone platforms combined, iOS and Android, are bringing in more U.S. revenue than traditional portable gaming leaders Sony and Nintendo for the first time ever. Games on Apple and Android mobile platforms will bring in $1.9 billion in U.S. sales this year, while Sony and Nintendo’s games will account for $1.4 billion.
It’s a drastic change that’s happened pretty rapidly in the space of just two years, as the chart below shows:
In 2009, portable gaming revenue in the U.S. was worth $2.7 billion. Sony and Nintendo, whose portable devices play games that can cost between $5 and $40, accounted for over 80 percent of mobile game revenue. Android and iOS games are usually free, 99 cents or, occasionally, a few dollars more. They made  pretty big dent in 2010 by grabbing 34 percent of the revenue of $2.5 billion, but the major damage was done this year. By the end of 2011, Flurry says mobile game revenue in the U.S. will equal $3.3 billion, and iOS and Android will account for 58 percent of that, compared to Sony’s 6 percent, and Nintendo’s 36 percent.
Sony and Nintendo’s sources of revenue are not limited to portable games since they still have console gaming. However they should probably be a little nervous: Apple and Google both have entered the living room space, with Apple TV and Google TV. And it’s probably not too long before each device gets a gaming strategy of some kind.
By Erica Ogg

Era Kejatuhan Game Console Sudah Tiba

High Tech News Portal memberitakan bahwa Android dan iOS mendominasi
pasar game untuk gadget cerdas mereka. Dibandingkan dengan game console
yang terkenal seperti Sony PSP, Nintendo DS maupun console yang lain.
Pada tahun 2009, Console Game Sony PSP menguasai 11% market share,
sedangkan Nintendo DS menguasai 70% pasar game, sedangkan iOS dan
Android cuma 19%. Jadi total console game memenangkan market shar 81%
dari pasar game yang ada. Tahun 2010, kue untuk game berbasis iOS dan
Android mulai meningkat menjadi 34% sedangkan Nintendo DS mengalami
penurunan sebesar 57% (menurun 13%) dari pendapatan tahun sebelumnya.
Sedangkan SONY PSP cuma kebagian 9% dari pasar yang ada.

Pada Tahun 2011 kuarter kedua ini, game berbasis iOS dan Android telah
menggeser para produsen game console, sehingga market share mereka
menjadi 58% sedangkan Nintendo DS menurun menjadi 36% sedangkan SONY PSP
cuma 6%.
Ini artinya, menjadi peringatan kepada para produsen game console, bahwa
era mereka sebentar lagi akan habis dikuasai oleh gadget cerdas, mulai
dari Android Base sampai iOS base produksi Apple Inc.
Kemudahan mendapatkan software untuk game di perangkat gadget juga
memacu pertumbuhan game via gadget ini, seperti download melalui Android
market dan Apple Store atau iTunes.
Dengan kondisi seperti ini, masihkan ada produsen game console
mengeluarkan produk mereka lagi? Mungkin ya, tetapi dengan tingkat
inovasi yang harusnya lebih maju dibandingkan game gadget base yang
sudah ada.

Sumber :
High Tech News

Thursday, February 01, 2007

Akhirnya Ikut Orang lagi

Setelah dua tahun menyendiri dan tidak mau terikat dengan siapapun, akhirnya Aku memilih untuk hijrah ke Jakarta dan bergabung dengan sebuah perusahaan.
Apapun pertimbangan yang mungkin kulakukan adalah karena dorongan dari teman-temanku di Malang yang merasa sayang, diriku yang di anggap memiliki kemampuan dan keahlian di bidang pemrograman di sarankan untuk hijrah ke Jakarta untuk meniti karir yang lebih baik, daripada memiliki masa depan usaha yang tidak Pasti di Malang (padahal dunia ini penuh dengan ketidakpastian).

Kawanku sesama programmer dan penggemar dunia pemrograman. Kisah saya ini patutlah menjadi renungan kalian semua, sebelum kalian terjun ke dunia pemrograman.
Saran saya sebagai teman yang baik adalah :
  1. Kenalilah dirimu, baik dari segi kelemahan maupun kelebihan.
  2. Manfaatkan keahlian dan kelebihan yang kamu miliki semaksimal mungkin senyampang masih muda dan segar.
  3. Pilihlah teman yang baik dan dapat dipercaya (amanah).
  4. Jangan segan-segan mengajarkan apa yang kamu ketahui kepada orang lain, karena suatu saat kamu akan menemukan bahwa berbagi ilmu adalah kepuasan tersendiri
  5. Selalulah belajar dan belajar, baik ilmu yang telah di kuasai atau ilmu baru yang menuntut ketekunan untuk mempelajarinya.
  6. Pilihlah pekerjaan dengan skala prioritas.
  7. Jangan serakah.
  8. Selalulah memohon tambahan ilmu dan kepahaman kepada Sang Pemilik Ilmu (Allah SWT)

Dan yang terpenting adalah "Persiapkan kematianmu sebelum ia datang kepadamu, dan sambutlah ia dengan suka cita, karena seorang kekasih hanya bergembira bila bertemu dengan yang di kasihinya".

Thursday, June 01, 2006

Program Pertama Java Saya

Banyak yang mengira belajar pemrograman itu susah! Siapa bilang?
Belajar bahasa pemrograman khususnya java sangatlah mudah. Apalagi java adalah software developer yang di gratiskan oleh Sun Microsystem, jadi siapa saja bisa download dan menggunakannya, baik untuk keperluan komersial maupun kepentingan buat pembelajaran.
Na, Sekarang, mari kita coba membuat program java pertama kita.

Pertama
Pastikan software java sudah terinstall pada komputer Anda, jika Anda belum memiliki softwarenya, silakan download di http://java.sun.com, pilih jenis software yang anda gunakan, untuk keperluan apa, bila untuk latihan cukuplah download J2SE, atau NetBeans IDE (Java include IDE) di sini.
Setelah di download, install software java tersebut.

Kedua
Untuk membuat program java, tentunya diperlukan editor bahasa programnya, bila Anda tidak memiliki NetBeans IDE, Anda bisa menggunakan editor Text notepad, editplus atau sejenisnya
, tentunya yang gratis juga, kalau terpaksa gak ada ya gunakan edit-nya ms-dos, ke cmd dulu.

Ketiga
Setelah editor text Anda buka, ketiklah kode program di bawah ini:

class hello

{
System.out.println("Hallo Semua! ini bahasa java pertama saya.");
}

Setelah itu simpan text tersebut sebagai hello.java lalu exit ke dos-prompt, kemudian melalui dos-prompt compile hello.java tersebut dengan perintah:

c:\javac hello.java

Sebelum kompilasi di atas, pastikan folder c:\j2sdk1.4.2_xx\bin sudah masuk pada PATH Windows. Caranya, ketik :

c:\echo %PATH%

Akan muncul path-path yang ada pada environment windows. Untuk menambahkan path instalasi java, lakukan perintah:

c:\set PATH=%PATH%;c:\j2sdk1.4.2_xx\bin

Kemudian barulah program hello.java kita kompilasi.

c:\javac hello.java

Bila proses kompilasi berhasil, jalankan program hello.java dengan perintah:

c:\java hello

Hallo Semua! ini bahasa java pertama saya.

Selamat Mencoba!

Friday, April 21, 2006

Pertimbangan Menggunakan J2EE/J2SE

Beberapa bulan yang lalu ada seorang teman yang datang dan bertanya, " Apa pertimbangan menggunakan tools java untuk membuat aplikasi?", lalu saya jawab.
Beberapa pertimbangan menggunakan bahasa pemrograman java adalah:
- Free OpenSource, menggunakan java, anda tidak perlu direpotkan dengan pembelian lisensi tahunan dan ongkos produksi lainnya
- Multi Platform, artinya java bisa jalan di mesin manapun, Windows OK, Linux OK, Unix OK, Sun Solaris apalagi.
- Tri party Wide Support, supportnya banyak dan sudah banyak yang menyediakan referensi untuk itu.
- Object Oriented Programming Murni, bila Anda suka OOP, maka Java adalah pilihannya.

Tetapi ada juga pertimbangan tidak menggunakan Java, alasannya adalah :
- Java bukan compiler yang berarti cuman interpreter, jadi hasil programnya tidak bisa langsung eksekusi
- Mempengaruhi performance komputer anda, karena membuat komputer sedikit melambat.
- Bagi yang belum terbiasa dengan OOP, jangan coba-coba belajar Java, bisa mumet and dibikin pusing
- Tools developer tetep aja bayar seperti Oracle JDeveloper, Borland J builder dll.

Monday, November 21, 2005

Selamat Datang para Programmer

Selamat datang,

Blog ini saya niatkan untuk membantu programmer sekalian dalam menyelesaikan masalahnya. Terutama yang sedang belajar Android, Java atau pemrograman web seperti PHP dan ASP, serta programmer yang sedang mendalami database Client/Server seperti SQL Server, PostgreSQL, MySQL atau Oracle.
Saya sekarang juga sedang menggemari salah satu bahasa pemrograman yang menurut saya agak unik yakni Objective-C.

Sekali lagi selamat datang.
konstribusi anda dalam millist dan blog ini akan membantu insan profesional semakin memahami dunianya.
Semoga Allah selalu bersama kita, dan memberi pertolongan dikala dibutuhkan.