Nghe Si is an iOS/iPhone/iPad app enabling users to follow their favorite Vietnamese celebrities' latest updates including posts, photos, and videos.
Check it out: http://itunes.apple.com/us/app/nghe-si/id473961965?mt=8
Friday, October 28, 2011
Android MainHelloButton App
LinearLayout
Orientation horizontal
LinearLayout
layout_height wrap_content
layout_width fill_parent
orientation vertical
layout_gravity center
id blank
id @+id/myTextView
text @string/message_start
textColor @color/text_color
layout_margin 20dp
layout_height wrap_content
layout_width wrap_parent
layout_gravity center
src\MainHelloButton.java
import android.app.Activity;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;
import android.util.Log;
import android.view.View;
public class MainHelloButton extends Activity{
private int mPressCount;
private static final String TAG = "MainHelloButton";
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final Button myButton = (Button) findViewById(R.id.my_button);
final TextView myTextView = (TextView) findViewById(R.id.my_text_view);
myButton.setOnClickListener(new View.OnClickListener(){
public void onClick(View v){
mPressCount++;
Resources res = getResources();
string msg = res.getString(R.string.message_format, mPressCount);
myTextView.setText(msg);
Log.d(TAG, "Log a button click press = " + mPressCount);
}
});
}
}
Change app icon in AndroidManifest.xml file
Log.d ~ debug
Log.wtf ~ what a terrible failure
Log.f ~ failure
Window -> Show View -> Other -> Android -> LogCat
Orientation horizontal
LinearLayout
layout_height wrap_content
layout_width fill_parent
orientation vertical
layout_gravity center
id blank
id @+id/myTextView
text @string/message_start
textColor @color/text_color
layout_margin 20dp
layout_height wrap_content
layout_width wrap_parent
layout_gravity center
src\MainHelloButton.java
import android.app.Activity;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;
import android.util.Log;
import android.view.View;
public class MainHelloButton extends Activity{
private int mPressCount;
private static final String TAG = "MainHelloButton";
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final Button myButton = (Button) findViewById(R.id.my_button);
final TextView myTextView = (TextView) findViewById(R.id.my_text_view);
myButton.setOnClickListener(new View.OnClickListener(){
public void onClick(View v){
mPressCount++;
Resources res = getResources();
string msg = res.getString(R.string.message_format, mPressCount);
myTextView.setText(msg);
Log.d(TAG, "Log a button click press = " + mPressCount);
}
});
}
}
Change app icon in AndroidManifest.xml file
Log.d ~ debug
Log.wtf ~ what a terrible failure
Log.f ~ failure
Window -> Show View -> Other -> Android -> LogCat
Tuesday, October 25, 2011
Free Javascript and CSS E-books
Just for answering a few questions from SitePoint. Good stuff.
http://www.sitepoint.com/launch/2e46ac
http://www.sitepoint.com/launch/2e46ac
Monday, October 24, 2011
Thursday, October 20, 2011
ios AdMob
// Create a view of the standard size at the bottom of the screen.
GADRequest *request = [GADRequest request];
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){
bannerView_ = [[GADBannerView alloc]
initWithFrame:CGRectMake(20.0,
self.view.frame.size.height -
GAD_SIZE_728x90.height,
GAD_SIZE_728x90.width,
GAD_SIZE_728x90.height)];
}
else{
bannerView_ = [[GADBannerView alloc]
initWithFrame:CGRectMake(0.0,
self.view.frame.size.height -
GAD_SIZE_320x50.height,
GAD_SIZE_320x50.width,
GAD_SIZE_320x50.height)];
}
// Specify the ad's "unit identifier." This is your AdMob Publisher ID.
bannerView_.adUnitID = @"ADMOBID";
// Let the runtime know which UIViewController to restore after taking
// the user wherever the ad goes and add it to the view hierarchy.
bannerView_.rootViewController = self;
[self.view addSubview:bannerView_];
[self.view bringSubviewToFront:bannerView_];
// Initiate a generic request to load it with an ad.
[bannerView_ loadRequest:request];
GADRequest *request = [GADRequest request];
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){
bannerView_ = [[GADBannerView alloc]
initWithFrame:CGRectMake(20.0,
self.view.frame.size.height -
GAD_SIZE_728x90.height,
GAD_SIZE_728x90.width,
GAD_SIZE_728x90.height)];
}
else{
bannerView_ = [[GADBannerView alloc]
initWithFrame:CGRectMake(0.0,
self.view.frame.size.height -
GAD_SIZE_320x50.height,
GAD_SIZE_320x50.width,
GAD_SIZE_320x50.height)];
}
// Specify the ad's "unit identifier." This is your AdMob Publisher ID.
bannerView_.adUnitID = @"ADMOBID";
// Let the runtime know which UIViewController to restore after taking
// the user wherever the ad goes and add it to the view hierarchy.
bannerView_.rootViewController = self;
[self.view addSubview:bannerView_];
[self.view bringSubviewToFront:bannerView_];
// Initiate a generic request to load it with an ad.
[bannerView_ loadRequest:request];
iOS NSURLConnection
responseData = [[NSMutableData data] retain];
NSURLRequest *request = [NSURLRequest requestWithURL:
NSURLRequest *request = [NSURLRequest requestWithURL:
[NSURL URLWithString:@"http://www.url.com"]
cachePolicy:NSURLRequestReloadIgnoringLocalCacheData
timeoutInterval:60.0];
NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
[connection start];
#pragma mark NSURLConnection delegate methods
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
[responseData setLength:0];
}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
[responseData appendData:data];
}
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
}
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
}
Wednesday, October 19, 2011
iOS how to display status bar vertically
[UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationLandscapeRight;
Thursday, October 6, 2011
R.I.P Steve Jobs
"Remembering that you are going to die is the best way I know to avoid the trap of thinking you have something to lose. You are already naked. There is no reason not to follow your hear." -1987
Source: http://jmak.tumblr.com/post/9377189056
Source: http://jmak.tumblr.com/post/9377189056
Subscribe to:
Posts (Atom)