<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Mehmet Ethem SULAN</title>
	
	<link>http://www.ethemsulan.com</link>
	<description>Bir başka WordPress sitesi</description>
	<lastBuildDate>Wed, 04 Apr 2012 20:43:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/MehmetEthemSulan" /><feedburner:info uri="mehmetethemsulan" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Setting up PrimeFaces Eclipse Indigo configuration</title>
		<link>http://feedproxy.google.com/~r/MehmetEthemSulan/~3/DM9F92mvdcQ/setting-up-primefaces-eclipse-indigo-configuration.html</link>
		<comments>http://www.ethemsulan.com/2012/04/setting-up-primefaces-eclipse-indigo-configuration.html#comments</comments>
		<pubDate>Wed, 04 Apr 2012 20:39:45 +0000</pubDate>
		<dc:creator>ethemsulan</dc:creator>
				<category><![CDATA[PrimeFaces]]></category>

		<guid isPermaLink="false">http://www.ethemsulan.com/?p=1174</guid>
		<description><![CDATA[Mac ile PrimeFaces ve Eclipse Indigo ayarlarını yapmaya çalıştım. 1.PrimeFaces.jar dosyasını WEB-INF &#8211;> lib altına atıp sağ tıklayıp Add to build path demeniz lazım. 2. web.xml içinde ne varsa silin ve aşağıdakini yapıştırın. &#60;?xml version=&#34;1.0&#34; encoding=&#34;UTF-8&#34;?&#62; &#60;web-app xmlns:xsi=&#34;http://www.w3.org/2001/XMLSchema-instance&#34; xmlns=&#34;http://java.sun.com/xml/ns/javaee&#34; xmlns:web=&#34;http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&#34; xsi:schemaLocation=&#34;http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd&#34; version=&#34;3.0&#34;&#62; &#60;display-name&#62;Primefaces&#60;/display-name&#62; &#60;servlet&#62; &#60;servlet-name&#62;Faces Servlet&#60;/servlet-name&#62; &#60;servlet-class&#62;javax.faces.webapp.FacesServlet&#60;/servlet-class&#62; &#60;load-on-startup&#62;1&#60;/load-on-startup&#62; &#60;/servlet&#62; &#60;servlet-mapping&#62; &#60;servlet-name&#62;Faces Servlet&#60;/servlet-name&#62; &#60;url-pattern&#62;*.jsf&#60;/url-pattern&#62; &#60;/servlet-mapping&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>Mac ile PrimeFaces ve Eclipse Indigo ayarlarını yapmaya çalıştım.<br />
<a href="http://www.ethemsulan.com/wp-content/uploads/mac.png"><img src="http://www.ethemsulan.com/wp-content/uploads/mac-300x187.png" alt="" title="mac" width="300" height="187" class="alignnone size-medium wp-image-1184" /></a></p>
<p>1.<strong>PrimeFaces.jar</strong> dosyasını <strong>WEB-INF</strong> &#8211;> <strong>lib</strong> altına atıp sağ tıklayıp <strong>Add to build path</strong> demeniz lazım.<br />
2. <strong>web.xml</strong> içinde ne varsa silin ve aşağıdakini yapıştırın.</p>
<pre class="brush: java;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;web-app xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns=&quot;http://java.sun.com/xml/ns/javaee&quot; xmlns:web=&quot;http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&quot; xsi:schemaLocation=&quot;http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd&quot; version=&quot;3.0&quot;&gt;
  &lt;display-name&gt;Primefaces&lt;/display-name&gt;
  &lt;servlet&gt;
    &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
    &lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt;
    &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
    &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
    &lt;url-pattern&gt;*.jsf&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
 &lt;context-param&gt;
  &lt;param-name&gt;javax.faces.STATE_SAVING_METHOD&lt;/param-name&gt;
  &lt;param-value&gt;server&lt;/param-value&gt;
 &lt;/context-param&gt;
 &lt;context-param&gt;
  &lt;param-name&gt;javax.faces.DEFAULT_SUFFIX&lt;/param-name&gt;
  &lt;param-value&gt;.xhtml&lt;/param-value&gt;
 &lt;/context-param&gt;
 &lt;context-param&gt;
  &lt;param-name&gt;com.sun.faces.expressionFactory&lt;/param-name&gt;
  &lt;param-value&gt;com.sun.el.ExpressionFactoryImpl&lt;/param-value&gt;
 &lt;/context-param&gt;
 &lt;context-param&gt;
  &lt;param-name&gt;javax.faces.PROJECT_STAGE&lt;/param-name&gt;
  &lt;param-value&gt;Development&lt;/param-value&gt;
 &lt;/context-param&gt;
 &lt;context-param&gt;
  &lt;param-name&gt;javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL&lt;/param-name&gt;
  &lt;param-value&gt;true&lt;/param-value&gt;
 &lt;/context-param&gt;
&lt;/web-app&gt;
</pre>
<p>3. PrimeFaces kullanabilmek için
<pre class="brush: java;">xmlns:p=&quot;http://primefaces.org/ui&quot;</pre>
<p> satırı aşağıdaki gibi eklemeniz lazım.</p>
<pre class="brush: java;">
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;
	xmlns:ui=&quot;http://java.sun.com/jsf/facelets&quot;
	xmlns:h=&quot;http://java.sun.com/jsf/html&quot;
	xmlns:f=&quot;http://java.sun.com/jsf/core&quot;
	xmlns:p=&quot;http://primefaces.org/ui&quot;&gt;
</pre>
<p>4.Ben index.jsp sayfasını sildim ve projeyi index.xhtml sayfasını sağ tıklayıp <strong>Debug As</strong> &#8211;> <strong>Debug on server</strong> seçeneğini tıklamanız yeterlidir.<br />
Birinci formda &#8220;ajax ile inputu yaz&#8221; buttonuna tıklandığında ajax ile girilen değerleri h:outputLabel e yazıyor.<br />
Ikinci formda ise girilen değerleri hello.xhtml sayfasında gösteriyor.<br />
<a href="http://www.ethemsulan.com/wp-content/uploads/bir1.png"><img src="http://www.ethemsulan.com/wp-content/uploads/bir1-300x259.png" alt="" title="bir" width="300" height="259" class="alignnone size-medium wp-image-1178" /></a><br />
<a href="http://www.ethemsulan.com/wp-content/uploads/iki.png"><img src="http://www.ethemsulan.com/wp-content/uploads/iki-300x288.png" alt="" title="iki" width="300" height="288" class="alignnone size-medium wp-image-1179" /></a><br />
index.xhtml</p>
<pre class="brush: java;">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;
    &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;

&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;
	xmlns:ui=&quot;http://java.sun.com/jsf/facelets&quot;
	xmlns:h=&quot;http://java.sun.com/jsf/html&quot;
	xmlns:f=&quot;http://java.sun.com/jsf/core&quot;
	xmlns:p=&quot;http://primefaces.org/ui&quot;&gt;

&lt;h:head&gt;
	&lt;title&gt;Title&lt;/title&gt;
&lt;/h:head&gt;
&lt;h:body&gt;

&lt;h1&gt;Form 1&lt;/h1&gt;
	&lt;h:form&gt;
		&lt;p:panel&gt;
			&lt;h:panelGrid columns=&quot;2&quot;&gt;
				&lt;h:inputText value=&quot;#{test.name}&quot;&gt;&lt;/h:inputText&gt;
				&lt;h:outputLabel id=&quot;lblName&quot; value=&quot;#{test.name}&quot;&gt;&lt;/h:outputLabel&gt;

				&lt;h:inputText value=&quot;#{test.address}&quot;&gt;&lt;/h:inputText&gt;
				&lt;h:outputLabel id=&quot;lblAddress&quot; value=&quot;#{test.address}&quot;&gt;&lt;/h:outputLabel&gt;

				&lt;p:commandButton value=&quot;Ajax Ile Inputları Yaz&quot; update=&quot;lblName,lblAddress&quot;/&gt;
			&lt;/h:panelGrid&gt;
		&lt;/p:panel&gt;
	&lt;/h:form&gt;
&lt;h1&gt;Form 2&lt;/h1&gt;
	&lt;h:form&gt;
		&lt;p:panel&gt;
			&lt;h:panelGrid columns=&quot;1&quot;&gt;
					&lt;h:inputText value=&quot;#{test.name}&quot;&gt;&lt;/h:inputText&gt;
					&lt;h:inputText value=&quot;#{test.address}&quot;&gt;&lt;/h:inputText&gt;
					&lt;h:commandButton action=&quot;#{test.getPageName()}&quot; value=&quot;Open Hello Page&quot;&gt;&lt;/h:commandButton&gt;
			&lt;/h:panelGrid&gt;
		&lt;/p:panel&gt;
	&lt;/h:form&gt;
&lt;/h:body&gt;
&lt;/html&gt;
</pre>
<p>hello.xhtml</p>
<pre class="brush: java;">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;
    &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;

&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;
	xmlns:ui=&quot;http://java.sun.com/jsf/facelets&quot;
	xmlns:h=&quot;http://java.sun.com/jsf/html&quot;
	xmlns:f=&quot;http://java.sun.com/jsf/core&quot;&gt;

&lt;h:head&gt;
	&lt;title&gt;Hello Page&lt;/title&gt;
&lt;/h:head&gt;

&lt;h:body&gt;
	&lt;h:form&gt;
		&lt;h:outputLabel value=&quot;#{test.name}&quot;&gt;&lt;/h:outputLabel&gt;&lt;br/&gt;
		&lt;h:outputLabel value=&quot;#{test.address}&quot;&gt;&lt;/h:outputLabel&gt;
	&lt;/h:form&gt;

&lt;/h:body&gt;
&lt;/html&gt;
</pre>
<p>Test.java</p>
<pre class="brush: java;">
package com.test;

public class Test {

	private String name;
	private String address;
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}

	public String getPageName(){
		return &quot;hello&quot;;
	}
}
</pre>
<p>faces-config.xml</p>
<pre class="brush: java;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;

&lt;faces-config
    xmlns=&quot;http://java.sun.com/xml/ns/javaee&quot;
    xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
    xsi:schemaLocation=&quot;http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd&quot;
    version=&quot;2.0&quot;&gt;
	&lt;managed-bean&gt;
		&lt;managed-bean-name&gt;test&lt;/managed-bean-name&gt;
		&lt;managed-bean-class&gt;com.test.Test&lt;/managed-bean-class&gt;
		&lt;managed-bean-scope&gt;request&lt;/managed-bean-scope&gt;
	&lt;/managed-bean&gt;
	&lt;navigation-rule&gt;
		&lt;display-name&gt;index.xhtml&lt;/display-name&gt;
		&lt;from-view-id&gt;/index.xhtml&lt;/from-view-id&gt;
		&lt;navigation-case&gt;
			&lt;from-outcome&gt;hello&lt;/from-outcome&gt;
			&lt;to-view-id&gt;/hello.xhtml&lt;/to-view-id&gt;
		&lt;/navigation-case&gt;
	&lt;/navigation-rule&gt;

&lt;/faces-config&gt;
</pre>
<p><a href="http://dl.dropbox.com/u/13292036/java/PrimeFacesHelloWorld.zip">Download PrimeFacesHelloWorld.zip</a></p>
<img src="http://feeds.feedburner.com/~r/MehmetEthemSulan/~4/DM9F92mvdcQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ethemsulan.com/2012/04/setting-up-primefaces-eclipse-indigo-configuration.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.ethemsulan.com/2012/04/setting-up-primefaces-eclipse-indigo-configuration.html</feedburner:origLink></item>
		<item>
		<title>IOS ComboBox UIPickerView</title>
		<link>http://feedproxy.google.com/~r/MehmetEthemSulan/~3/7Hz2OJ6huBM/ios-combobox-uipickerview.html</link>
		<comments>http://www.ethemsulan.com/2012/02/ios-combobox-uipickerview.html#comments</comments>
		<pubDate>Tue, 21 Feb 2012 22:23:21 +0000</pubDate>
		<dc:creator>ethemsulan</dc:creator>
				<category><![CDATA[IOS(iphone,ipad,objective c)]]></category>

		<guid isPermaLink="false">http://www.ethemsulan.com/?p=1156</guid>
		<description><![CDATA[IOS ile ilgili ilk yazımdır. Diğer blog siteme yazsam daha mı iyi olur acaba? Normalde IOS içinde ComboBox yerine UIPickerView kullanılıyor. Bunu kullanmak için aşağıdaki metodları implement ediyoruz. Bu arada yourumların bazıları ingilizce olarak arada sallıyorum:) -(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView { return 1; } //Assign the selected row of value to label of text. -(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row [...]]]></description>
			<content:encoded><![CDATA[<p><strong>IOS</strong> ile ilgili ilk yazımdır. Diğer <a href="http://esulan.blogspot.com/">blog sitem</a>e yazsam daha mı iyi olur acaba?<br />
Normalde IOS içinde <strong>ComboBox</strong> yerine <strong>UIPickerView</strong> kullanılıyor. Bunu kullanmak için aşağıdaki metodları implement ediyoruz. Bu arada yourumların bazıları ingilizce olarak arada sallıyorum:)<br />
<a href="http://www.ethemsulan.com/wp-content/uploads/up1.png"><img src="http://www.ethemsulan.com/wp-content/uploads/up1-200x300.png" alt="" title="up1" width="200" height="300" class="alignnone size-medium wp-image-1157" /></a><br />
<a href="http://www.ethemsulan.com/wp-content/uploads/uip2.png"><img src="http://www.ethemsulan.com/wp-content/uploads/uip2-200x300.png" alt="" title="uip2" width="200" height="300" class="alignnone size-medium wp-image-1158" /></a><br />
<a href="http://www.ethemsulan.com/wp-content/uploads/uip3.png"><img src="http://www.ethemsulan.com/wp-content/uploads/uip3-1024x640.png" alt="" title="uip3" width="600" height="640" class="alignnone size-large wp-image-1162" /></a></p>
<pre class="brush: java;">
-(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
    return 1;
}

//Assign the selected row of value to label of text.
-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component{
    lbl.text=[array objectAtIndex:row];
}

//set rows number to picker
-(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component{
    return [array count];
}
-(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component{
    return [array objectAtIndex:row];
}
</pre>
<p><a href="http://ff.im/RpaL1">Storyboard</a> için şu videoyu izleyebilirisniz. Ilk gördüğümde çok şaşırmıştım:)</p>
<p>Kısaca bu kod girilen değeri UIPickerViewe ekliyor ve UIPickerViewden seçilen değeri de label da gösteriyor.<br />
ViewController.h</p>
<pre class="brush: java;">

#import &lt;UIKit/UIKit.h&gt;

//UIViewController&lt;UIPickerViewDelegate,UIPickerViewDataSource,UITextFieldDelegate&gt;  UITextField ve UIPickerView ait metodları kullanmak için @interface olan dosyamıza eklyioruz.
@interface ViewController : UIViewController&lt;UIPickerViewDelegate,UIPickerViewDataSource,UITextFieldDelegate&gt;{

//IBOutlet tanımlamasını .xib içinde tanımladığımız bileşenlere drag drop şeklinde referans vereceksek kullanırız.
    IBOutlet UILabel *lbl;
    IBOutlet UITextField *textField;
    IBOutlet UIPickerView *comboBoxAlternative;
    NSMutableArray *array;

}

//property(retain,non atomic) i do not understand. I will try to explain later.
@property(retain,nonatomic)IBOutlet UILabel *lbl;
@property(retain,nonatomic)IBOutlet UITextField *textField;
@property(retain,nonatomic)IBOutlet UIPickerView *comboBoxAlternative;

//Buttonun click olayıdır.Java daki click listenerlar gibi.
- (IBAction)inputTextToComboBox:(id)sender;

@end
</pre>
<p>ViewController.m</p>
<pre class="brush: java;">
#import &quot;ViewController.h&quot;

@implementation ViewController

//set and get componenent
@synthesize lbl,textField,comboBoxAlternative;

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
    array=[[NSMutableArray alloc]initWithObjects:@&quot;one&quot;,@&quot;two&quot;,@&quot;three&quot;,@&quot;five&quot;, nil];

    textField.delegate=self;
    //To selected set label text
    lbl.text=[array objectAtIndex:[comboBoxAlternative selectedRowInComponent:0]];
}

- (void)viewDidUnload
{

    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;

}

-(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
    return 1;
}

//Assign the selected row of value to label of text.
-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component{
    lbl.text=[array objectAtIndex:row];
}

//set rows number to picker
-(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component{
    return [array count];
}
-(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component{
    return [array objectAtIndex:row];
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
}

- (void)viewWillDisappear:(BOOL)animated
{
	[super viewWillDisappear:animated];
}

- (void)viewDidDisappear:(BOOL)animated
{
	[super viewDidDisappear:animated];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}

//Girilen degerleri UIPickerViewe ekliyor.
- (IBAction)inputTextToComboBox:(id)sender {
    [array addObject:textField.text];
    [comboBoxAlternative reloadAllComponents];
    [textField setText:nil];
}

-(BOOL)textFieldShouldReturn:(UITextField *)textField{
    [textField resignFirstResponder];
    return YES;
}

@end
</pre>
<p><strong><a href="http://dl.dropbox.com/u/13292036/IOS/ComboBoxSam.zip">Download ComboBoxSam.zip source code</a></strong></p>
<img src="http://feeds.feedburner.com/~r/MehmetEthemSulan/~4/7Hz2OJ6huBM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ethemsulan.com/2012/02/ios-combobox-uipickerview.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.ethemsulan.com/2012/02/ios-combobox-uipickerview.html</feedburner:origLink></item>
		<item>
		<title>How to call An Android Activity class from non-activity class</title>
		<link>http://feedproxy.google.com/~r/MehmetEthemSulan/~3/LZQhVkXpvtg/how-to-call-an-android-activity-class-from-non-activity-class.html</link>
		<comments>http://www.ethemsulan.com/2011/12/how-to-call-an-android-activity-class-from-non-activity-class.html#comments</comments>
		<pubDate>Wed, 07 Dec 2011 21:52:40 +0000</pubDate>
		<dc:creator>ethemsulan</dc:creator>
				<category><![CDATA[Android]]></category>

		<guid isPermaLink="false">http://www.ethemsulan.com/?p=1136</guid>
		<description><![CDATA[nullpointerexception non activity class hatası ile karşılaştığınızda aşağıdaki şekıilde çözebilirsiniz. Android içinde normal bir Java(Non-Activity and Non-View) sınıfından herhangi bir Activity çağırmak istediğimizde aşağıdaki gibi iki şekilde çağırabiliriz. 1. Context göndereceğimiz sınıfın yapıcısında this ile göndermektir. MyMainActivity.java import android.app.Activity; import android.content.Context; import android.os.Bundle; public class MyMainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { [...]]]></description>
			<content:encoded><![CDATA[<p><strong>nullpointerexception non activity class</strong> hatası ile karşılaştığınızda aşağıdaki şekıilde çözebilirsiniz.<br />
<strong>Android</strong> içinde normal bir <strong>Java(Non-Activity and Non-View)</strong> sınıfından herhangi bir <strong>Activity</strong> çağırmak istediğimizde aşağıdaki gibi iki şekilde çağırabiliriz.</p>
<p>1. <strong>Context</strong> göndereceğimiz sınıfın yapıcısında <strong>this</strong> ile göndermektir.</p>
<p>MyMainActivity.java</p>
<pre class="brush: java;">
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;

public class MyMainActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        MyTestClass myTestClass=new MyTestClass(this);
        myTestClass.startSecondActivity();
    }
}
</pre>
<p>MyTestClass.java</p>
<pre class="brush: java;">
import android.content.Context;
import android.content.Intent;

public class MyTestClass {

	Context context;

	public MyTestClass(Context context) {
		super();
		this.context = context;
	}
	public void startSecondActivity()
	{
		Intent intent=new Intent(context, SecondActivity.class);
		context.startActivity(intent);
	}

}
</pre>
<p>SecondActivity.java</p>
<pre class="brush: java;">
import android.app.Activity;
import android.os.Bundle;
import android.widget.Toast;

public class SecondActivity extends Activity{

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		Toast.makeText(getApplicationContext(), &quot;Second activity&quot;, Toast.LENGTH_LONG).show();
	}

}
</pre>
<p>2. yol ise <strong>intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)</strong>; şeklinde <strong>SecondActivity</strong> i yeni bir task ile başlatmaktır. Bu şekilde yeni task ile başlattığımız da hem <strong>MyTestClass myTestClass=new MyTestClass(this);</strong> hem de <strong>MyTestClass myTestClass=new MyTestClass(getApplicationContext());</strong> start edebiliyoruz.</p>
<p>MyMainActivity.java</p>
<pre class="brush: java;">
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;

public class MyMainActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        MyTestClass myTestClass=new MyTestClass(getApplicationContext());
        myTestClass.startSecondActivity();
    }
}
</pre>
<p>MyTestClass.java</p>
<pre class="brush: java;">
import android.content.Context;
import android.content.Intent;

public class MyTestClass {

	Context context;

	public MyTestClass(Context context) {
		super();
		this.context = context;
	}
	public void startSecondActivity()
	{
		Intent intent=new Intent(context, SecondActivity.class);
//Yeni task ile başlattık.
		intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
		context.startActivity(intent);
	}

}
</pre>
<p>SecondActivity.java</p>
<pre class="brush: java;">
import android.app.Activity;
import android.os.Bundle;
import android.widget.Toast;

public class SecondActivity extends Activity{

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		Toast.makeText(getApplicationContext(), &quot;Second activity&quot;, Toast.LENGTH_LONG).show();
	}

}
</pre>
<p>AndroidManifest.xml</p>
<pre class="brush: java;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
    package=&quot;com.call&quot;
    android:versionCode=&quot;1&quot;
    android:versionName=&quot;1.0&quot; &gt;

    &lt;uses-sdk android:minSdkVersion=&quot;4&quot; /&gt;

    &lt;application
        android:icon=&quot;@drawable/ic_launcher&quot;
        android:label=&quot;@string/app_name&quot; &gt;
        &lt;activity
            android:label=&quot;@string/app_name&quot;
            android:name=&quot;.MyMainActivity&quot; &gt;
            &lt;intent-filter &gt;
                &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;

                &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
            &lt;/intent-filter&gt;
        &lt;/activity&gt;
        &lt;activity android:name=&quot;SecondActivity&quot;&gt;&lt;/activity&gt;
    &lt;/application&gt;

&lt;/manifest&gt;
</pre>
<p><a href="http://hotfile.com/dl/137081473/97da61d/CallActivity.zip.html">Download CallActivity.zip source code</a></p>
<img src="http://feeds.feedburner.com/~r/MehmetEthemSulan/~4/LZQhVkXpvtg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ethemsulan.com/2011/12/how-to-call-an-android-activity-class-from-non-activity-class.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.ethemsulan.com/2011/12/how-to-call-an-android-activity-class-from-non-activity-class.html</feedburner:origLink></item>
		<item>
		<title>Using KSOAP2 for android, and parsing SOAP WSDL output data</title>
		<link>http://feedproxy.google.com/~r/MehmetEthemSulan/~3/r21-y6gdtUc/using-ksoap2-for-android-and-parsing-soap-wsdl-output-data.html</link>
		<comments>http://www.ethemsulan.com/2011/11/using-ksoap2-for-android-and-parsing-soap-wsdl-output-data.html#comments</comments>
		<pubDate>Mon, 07 Nov 2011 01:08:48 +0000</pubDate>
		<dc:creator>ethemsulan</dc:creator>
				<category><![CDATA[Android]]></category>

		<guid isPermaLink="false">http://www.ethemsulan.com/?p=1128</guid>
		<description><![CDATA[Android ile KSOAP2 kullanarak SOAP Web Serviceden data çekmeye çalışırken karşılaştığım sorunu çözdükten sonra paylaşmaya çalıştım. En önemli sorun When Parsing the Soap response problem Android Developer grubuna sorulan sorudur. Kod içinde Log.e(&#34;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#34;, &#34;Root elemtn body: &#34;+soapObjectResultRoot.toString()); satırındaki outputa bakarsanız hiçbir formata uymayan bir data var ve o datayı parse etmek indexOf() metodu ile ancak [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Android</strong> ile <a href="http://code.google.com/p/ksoap2-android/">KSOAP2</a> kullanarak <strong>SOAP Web Service</strong>den data çekmeye çalışırken karşılaştığım sorunu çözdükten sonra paylaşmaya çalıştım. En önemli sorun <a href="http://groups.google.com/group/android-developers/browse_thread/thread/9b59620ad4aa3103#">When Parsing the Soap response problem</a> <strong>Android Developer</strong> grubuna sorulan sorudur. Kod içinde
<pre class="brush: java;">Log.e(&quot;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&quot;, &quot;Root elemtn body: &quot;+soapObjectResultRoot.toString());</pre>
<p> satırındaki outputa bakarsanız hiçbir formata uymayan bir data var ve o datayı parse etmek indexOf() metodu ile ancak yapılabiliyordu. DDMS e bakarsanız
<pre class="brush: java;">Root elemtn body: GetGeoIPContextResponse{GetGeoIPContextResult=anyType{ReturnCode=1; IP=78.175.34.228; ReturnCodeDetails=Success; CountryName=Turkey; CountryCode=TUR; }; }
</pre>
<p> şeklinde saçma bir data görürsünüz. Bunun sebebi <strong>bodyIn</strong> ile sadece <strong>Root Element</strong> alınmasıdır. Yani çözüm önce rootu almak sonra istenilen result metodunundaki propertye erişmektir.</p>
<pre class="brush: java;">
        	SoapObject soapObjectResultRoot=(SoapObject) soaSerializationEnvelope.bodyIn;
        	Log.e(&quot;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&quot;, &quot;Root elemtn body: &quot;+soapObjectResultRoot.toString());
        	SoapObject soapObjectGetProperty=(SoapObject) soapObjectResultRoot.getProperty(&quot;GetGeoIPContextResult&quot;);
</pre>
<p>Bu <a href="http://www.webservicex.net/geoipservice.asmx?op=GetGeoIPContext">linkte-GetGeoIPContext</a> hangi metodu ve getProperty() ile hangi değerlere erişeceğimizi <strong>SOAP</strong> içinde yazıyor.<br />
Uyarı örnek yapacağınız web servisi önce çalışıp çalışmadığını kontrol edin. Mesela şu anda <a href="http://www.webservicex.net/ws/WSDetails.aspx?CATID=12&#038;WSID=63">Translation Engine</a>   çalışmıyor ve ben de bunun üzerinden deneme yapıyordum <img src='http://www.ethemsulan.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
1. <strong>ksoap2-android-assembly-2.4-jar-with-dependencies.jar</strong> indirdikten sonra <strong>assets</strong> içine atıp sonra sağ tıklayıp <strong>Build path->Add to build path</strong> tıklamanız yeterlidir. Ya da <strong>lib</strong> isminde bir klasör oluşturup onun altında atıp aynı şekilde sağ tıklayıp <strong>Build path->Add to build path</strong> ekletebilirisniz.<br />
2. Erişeceğiniz <strong>http://www.webservicex.net/geoipservice.asmx?WSDL</strong> deki <strong>WSDL</strong> silip var olan public metodlarını iyice incelemektir. Sonra istediğinizi kullanabilirisniz.<br />
3. <strong>AndroidManifest.xml</strong> içinde
<pre class="brush: java;">&lt;uses-permission android:name=&quot;android.permission.INTERNET&quot;/&gt;</pre>
<p> ekleyin.<br />
<a href="http://www.ethemsulan.com/wp-content/uploads/build.png"><img src="http://www.ethemsulan.com/wp-content/uploads/build-300x163.png" alt="" title="build" width="300" height="163" class="alignnone size-medium wp-image-1129" /></a><br />
<a href="http://www.ethemsulan.com/wp-content/uploads/output1.png"><img src="http://www.ethemsulan.com/wp-content/uploads/output1-180x300.png" alt="" title="output" width="180" height="300" class="alignnone size-medium wp-image-1130" /></a></p>
<p>AndroidSoapActivity.java</p>
<pre class="brush: java;">
package com.androidsoap;

import java.io.IOException;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.SoapFault;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import org.xmlpull.v1.XmlPullParserException;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

public class AndroidSoapActivity extends Activity {

	final static String NAMESPACE = &quot;http://www.webservicex.net/&quot;;
	final static String METHOD_NAME = &quot;GetGeoIPContext&quot;;
	final static String SOAP_ACTION = &quot;http://www.webservicex.net/GetGeoIPContext&quot;;
	final static String URL = &quot;http://www.webservicex.net/geoipservice.asmx?WSDL&quot;;

	TextView textView;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        textView=(TextView) findViewById(R.id.textView1);
        SoapObject reSoapObject = new SoapObject(NAMESPACE, METHOD_NAME);
//Egerki sorgu çekecekseniz o zaman reSoapObject.addProperty(name,value); şeklinde değer eklemelisiniz. O da SOAP içinde belirtiliyor.
        SoapSerializationEnvelope soaSerializationEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

        soaSerializationEnvelope.dotNet = true;
        soaSerializationEnvelope.setOutputSoapObject(reSoapObject);
        HttpTransportSE httpTransportSE = new HttpTransportSE(URL);
        int returnCode = 0;
        String ip = null, returnCodeDetail = null,countryName = null, countryCode = null;
        try {
        	httpTransportSE.call(SOAP_ACTION, soaSerializationEnvelope);
//Root elemente erişiyoruz.
        	SoapObject soapObjectResultRoot=(SoapObject) soaSerializationEnvelope.bodyIn;
        	Log.e(&quot;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&quot;, &quot;Root elemtn body: &quot;+soapObjectResultRoot.toString());
//Root elementin altındaki erişeceğimiz metodun ..Result ile biten değerine erişiyoruz. Mesela METHOD_NAME = &quot;GetGeoIPContext&quot;;
//Aşağıdaki metod ve parametre değerleri bulinkte açıklıyor zaten: http://www.webservicex.net/geoipservice.asmx?op=GetGeoIPContext
        	SoapObject soapObjectGetProperty=(SoapObject) soapObjectResultRoot.getProperty(&quot;GetGeoIPContextResult&quot;);
        	returnCode=Integer.parseInt(soapObjectGetProperty.getProperty(&quot;ReturnCode&quot;).toString());
        	ip=soapObjectGetProperty.getProperty(&quot;IP&quot;).toString();
        	returnCodeDetail=soapObjectGetProperty.getProperty(&quot;ReturnCodeDetails&quot;).toString();
        	countryName=soapObjectGetProperty.getProperty(&quot;CountryName&quot;).toString();
        	countryCode=soapObjectGetProperty.getProperty(&quot;CountryCode&quot;).toString();
        } catch (IOException e) {
        e.printStackTrace();
        } catch (XmlPullParserException e) {
        e.printStackTrace();
        }

        textView.setText(&quot;Return code --&gt; &quot;+returnCode+&quot; \nIP --&gt; &quot;+ip+&quot; \nReturn code details --&gt; &quot;+returnCodeDetail+&quot; \nCountry name --&gt; &quot;+countryName+&quot; \nCountry code --&gt; &quot;+countryCode);

    }
}
</pre>
<p>main.xml</p>
<pre class="brush: java;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
    android:layout_width=&quot;fill_parent&quot;
    android:layout_height=&quot;fill_parent&quot;
    android:orientation=&quot;vertical&quot; &gt;

    &lt;TextView
        android:id=&quot;@+id/textView1&quot;
        android:layout_width=&quot;230dp&quot;
        android:layout_height=&quot;wrap_content&quot;
        android:text=&quot;TextView&quot; /&gt;

&lt;/LinearLayout&gt;
</pre>
<p>AndroidManifest.xml</p>
<pre class="brush: java;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
    package=&quot;com.androidsoap&quot;
    android:versionCode=&quot;1&quot;
    android:versionName=&quot;1.0&quot; &gt;

    &lt;uses-sdk android:minSdkVersion=&quot;4&quot; /&gt;
    &lt;uses-permission android:name=&quot;android.permission.INTERNET&quot;/&gt;

    &lt;application
        android:icon=&quot;@drawable/ic_launcher&quot;
        android:label=&quot;@string/app_name&quot; &gt;
        &lt;activity
            android:label=&quot;@string/app_name&quot;
            android:name=&quot;.AndroidSoapActivity&quot; &gt;
            &lt;intent-filter &gt;
                &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;

                &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
            &lt;/intent-filter&gt;
        &lt;/activity&gt;
    &lt;/application&gt;

&lt;/manifest&gt;
</pre>
<p><a href="http://hotfile.com/dl/137081425/865d391/AndroidSoapSam.zip.html">Download AndroidSoapSam.zip srouce code</a></p>
<img src="http://feeds.feedburner.com/~r/MehmetEthemSulan/~4/r21-y6gdtUc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ethemsulan.com/2011/11/using-ksoap2-for-android-and-parsing-soap-wsdl-output-data.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.ethemsulan.com/2011/11/using-ksoap2-for-android-and-parsing-soap-wsdl-output-data.html</feedburner:origLink></item>
		<item>
		<title>Android Activity startActivityForResult sample</title>
		<link>http://feedproxy.google.com/~r/MehmetEthemSulan/~3/-3J0FKBy-U4/android-activity-startactivityforresult-sample.html</link>
		<comments>http://www.ethemsulan.com/2011/10/android-activity-startactivityforresult-sample.html#comments</comments>
		<pubDate>Fri, 28 Oct 2011 16:05:56 +0000</pubDate>
		<dc:creator>ethemsulan</dc:creator>
				<category><![CDATA[Android]]></category>

		<guid isPermaLink="false">http://www.ethemsulan.com/?p=1123</guid>
		<description><![CDATA[Android içinde startActivityForResult() metodu ile başlatılan sub activitynin normal kapanıp kapanmadığına göre işlem yapabiliyoruz. Mesela devicedaki Back buttonuna basarak beklenmedik şekilde activity sonlandirabilir. Bazı durumlarda buna göre işlem yapmak zorunda kalıyoruz. StartForResultActivity.java package com.start.result; import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.Toast; public class StartForResultActivity [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Android</strong> içinde <strong>startActivityForResult() metod</strong>u ile başlatılan sub activitynin normal kapanıp kapanmadığına göre işlem yapabiliyoruz. Mesela devicedaki <strong>Back</strong> buttonuna basarak beklenmedik şekilde activity sonlandirabilir. Bazı durumlarda buna göre işlem yapmak zorunda kalıyoruz.</p>
<p>StartForResultActivity.java</p>
<pre class="brush: java;">
package com.start.result;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;

public class StartForResultActivity extends Activity {
	Button button1_ok;
	private static final int SHOW_SUBACTIVITY = 1;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        button1_ok=(Button) findViewById(R.id.button1);

        button1_ok.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				Intent intent = new Intent(StartForResultActivity.this, SecondActivity.class);
				startActivityForResult(intent, SHOW_SUBACTIVITY);
			}
		});
    }
	@Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		super.onActivityResult(requestCode, resultCode, data);

		switch (requestCode) {
		case 1:
//Second activity normal olarak sonlanirsa RESULT_OK degeri döner.
			if(resultCode==Activity.RESULT_OK)
			{
				String string=data.getStringExtra(&quot;ethem&quot;);
				Toast.makeText(getApplicationContext(), &quot;Inputed text: &quot;+string, Toast.LENGTH_SHORT).show();
//Second activity beklendmedik sekilde kapanirsa(Mesela cihazdaki back buttonuna tikalnirsa) RESULT_CANCELED degeri doner.
			}else if(resultCode==Activity.RESULT_CANCELED){
				Toast.makeText(getApplicationContext(), &quot;Beklenmedik sekilde second activity sonlandi&quot;, Toast.LENGTH_SHORT).show();
			}

			break;
		}

	}

}
</pre>
<p>SecondActivity.java</p>
<pre class="brush: java;">
package com.start.result;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class SecondActivity extends Activity{

	Button button;
	EditText editText;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.second);
		button=(Button) findViewById(R.id.button1);
		editText=(EditText) findViewById(R.id.editText1);

		button.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
//Finish buttonuna tıklanarak activity sonlanirsa(yani beklediğimiz gibi) o zaman setResult(RESULT_OK, intent); değer dönderiyoruz StartForResultActivity activiysine.
				Intent intent=new Intent();
				intent.putExtra(&quot;ethem&quot;, editText.getText().toString());
				setResult(RESULT_OK, intent);
				finish();

			}
		});

	}

}
</pre>
<p>main.xml</p>
<pre class="brush: java;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
    android:layout_width=&quot;fill_parent&quot;
    android:layout_height=&quot;fill_parent&quot;
    android:orientation=&quot;horizontal&quot;&gt;

    &lt;Button android:text=&quot;Open Second Activity&quot; android:id=&quot;@+id/button1&quot; android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot;&gt;&lt;/Button&gt;
&lt;/LinearLayout&gt;
</pre>
<p>second.xml</p>
<pre class="brush: java;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;LinearLayout
  xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
  android:orientation=&quot;vertical&quot;
  android:layout_width=&quot;match_parent&quot;
  android:layout_height=&quot;match_parent&quot;&gt;
    &lt;EditText android:layout_width=&quot;match_parent&quot; android:id=&quot;@+id/editText1&quot; android:layout_height=&quot;wrap_content&quot;&gt;
        &lt;requestFocus&gt;&lt;/requestFocus&gt;
    &lt;/EditText&gt;
    &lt;Button android:text=&quot;Finish&quot; android:id=&quot;@+id/button1&quot; android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot;&gt;&lt;/Button&gt;

&lt;/LinearLayout&gt;
</pre>
<p><a href="http://hotfile.com/dl/137081357/fdd04e5/StartForResult.zip.html">Download StartForResult.zip</a></p>
<img src="http://feeds.feedburner.com/~r/MehmetEthemSulan/~4/-3J0FKBy-U4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ethemsulan.com/2011/10/android-activity-startactivityforresult-sample.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.ethemsulan.com/2011/10/android-activity-startactivityforresult-sample.html</feedburner:origLink></item>
		<item>
		<title>Value of variables not showing eclipse on java debug mode</title>
		<link>http://feedproxy.google.com/~r/MehmetEthemSulan/~3/4UB1ZBT0jsM/value-of-variables-not-showing-eclipse-on-java-debug.html</link>
		<comments>http://www.ethemsulan.com/2011/10/value-of-variables-not-showing-eclipse-on-java-debug.html#comments</comments>
		<pubDate>Tue, 25 Oct 2011 10:24:05 +0000</pubDate>
		<dc:creator>ethemsulan</dc:creator>
				<category><![CDATA[Genel Bilgiler]]></category>

		<guid isPermaLink="false">http://www.ethemsulan.com/?p=1116</guid>
		<description><![CDATA[When you want to debug your java projects, if you can not see the values of variables, you can solve this problem, by below solution. 1. Got to Window -> Preferences -> Java -> Debug -> Detail Formatters 2. Go to under the &#8220;Show variable details(&#8216;toString()&#8217; value): &#8221; then check &#8220;As the label for variables [...]]]></description>
			<content:encoded><![CDATA[<p>When you want to <strong>debug your java projects</strong>, if you <strong>can not see the values of variables</strong>, you can solve this problem, by below solution.</p>
<p>1. Got to <strong>Window -> Preferences -> Java -> Debug -> Detail Formatters</strong> </p>
<p>2. Go to under the &#8220;<strong>Show variable details(&#8216;toString()&#8217; value):</strong> &#8221; then check &#8220;<strong>As the label for variables with detail formatters</strong>&#8220;.</p>
<p>3. Clik ok button, then finish operation.<br />
<a href="http://www.ethemsulan.com/wp-content/uploads/detail.png"><img src="http://www.ethemsulan.com/wp-content/uploads/detail-266x300.png" alt="" title="detail" width="266" height="300" class="alignnone size-medium wp-image-1117" /></a></p>
<img src="http://feeds.feedburner.com/~r/MehmetEthemSulan/~4/4UB1ZBT0jsM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ethemsulan.com/2011/10/value-of-variables-not-showing-eclipse-on-java-debug.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.ethemsulan.com/2011/10/value-of-variables-not-showing-eclipse-on-java-debug.html</feedburner:origLink></item>
		<item>
		<title>Android ListPreference OnPreferenceChangeListener Sample</title>
		<link>http://feedproxy.google.com/~r/MehmetEthemSulan/~3/K60zv-gZlqs/android-listpreference-onpreferencechangelistener-sample.html</link>
		<comments>http://www.ethemsulan.com/2011/10/android-listpreference-onpreferencechangelistener-sample.html#comments</comments>
		<pubDate>Fri, 21 Oct 2011 21:20:36 +0000</pubDate>
		<dc:creator>ethemsulan</dc:creator>
				<category><![CDATA[Android]]></category>

		<guid isPermaLink="false">http://www.ethemsulan.com/?p=1101</guid>
		<description><![CDATA[Android ile PreferenceScreen içinde ListPreference içinde seçilen değer değiştiğinde gerçekleşen olay için basit bir örnek yazdım. findViewById() metoduna benzer bir erişim metodu var. listPreference=(ListPreference) findPreference(&#34;customPreferences&#34;); PreferenceScreen içinde aşağıdaki resimde görüldüğü gibi bazı özellikler tanımlayabiliyoruz. Android settings bununla yazılmış. Çalıştırınca MyPreferences.java package com.preference.sam; import android.os.Bundle; import android.preference.ListPreference; import android.preference.Preference; import android.preference.PreferenceActivity; import android.preference.Preference.OnPreferenceChangeListener; import android.util.Log; import [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Android</strong> ile <strong>PreferenceScreen</strong> içinde <strong>ListPreference</strong> içinde seçilen değer değiştiğinde gerçekleşen olay için basit bir örnek yazdım. findViewById() metoduna benzer bir erişim metodu var.</p>
<pre class="brush: java;">listPreference=(ListPreference) findPreference(&quot;customPreferences&quot;);</pre>
<p><strong>PreferenceScreen</strong> içinde aşağıdaki resimde görüldüğü gibi bazı özellikler tanımlayabiliyoruz. Android settings bununla yazılmış.<br />
<a href="http://www.ethemsulan.com/wp-content/uploads/create_pref.png"><img src="http://www.ethemsulan.com/wp-content/uploads/create_pref-277x300.png" alt="" title="create_pref" width="277" height="300" class="alignnone size-medium wp-image-1102" /></a><br />
Çalıştırınca<br />
<a href="http://www.ethemsulan.com/wp-content/uploads/pref_outp.png"><img src="http://www.ethemsulan.com/wp-content/uploads/pref_outp-180x300.png" alt="" title="pref_outp" width="180" height="300" class="alignnone size-medium wp-image-1103" /></a><br />
MyPreferences.java</p>
<pre class="brush: java;">
package com.preference.sam;

import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.Preference.OnPreferenceChangeListener;
import android.util.Log;
import android.widget.Toast;

public class MyPreferences extends PreferenceActivity {

	ListPreference listPreference;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
//R.xml.pref ekliyoruz.
		addPreferencesFromResource(R.xml.pref);
//android:key=&quot;customPreferences&quot; xml/pref.xml içindeki isim
		listPreference=(ListPreference) findPreference(&quot;customPreferences&quot;);
		listPreference.setOnPreferenceChangeListener(onPreferenceChangeListener);

	}

	OnPreferenceChangeListener onPreferenceChangeListener=new OnPreferenceChangeListener() {

		@Override
		public boolean onPreferenceChange(Preference preference, Object newValue) {
//Seçilen isme ait numara toast olarak görünüyor ve toast indeksi de log attiriyorum.
//pref.xml içinde android:entries=&quot;@array/names&quot; ile görünecek bir dizi atiyoruz ve
//android:entryValues=&quot;@array/stud_num&quot; kod ile de o diziye ait değerleri yazıyoruz.
//Bu iki dizi values/strings.xml içinde String array olarak tanımlanmıştır.
			Toast.makeText(getApplicationContext(), &quot;Secilen ogrencinin okul numarasi : &quot;+newValue, Toast.LENGTH_LONG).show();
			int index=listPreference.findIndexOfValue((String) newValue);
			Log.e(&quot;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&quot;, &quot;Index of selected value :&quot; + index);
			return false;
		}
	};

}
</pre>
<p>pref.xml</p>
<pre class="brush: java;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;PreferenceScreen xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot; &gt;

    &lt;PreferenceCategory android:title=&quot;Categori 1&quot;&gt;
    	&lt;ListPreference android:title=&quot;List Of Name&quot;
    		android:key=&quot;customPreferences&quot;
    		android:entries=&quot;@array/names&quot;
    		android:entryValues=&quot;@array/stud_num&quot;&gt;
    	&lt;/ListPreference&gt;
    &lt;/PreferenceCategory&gt;

&lt;/PreferenceScreen&gt;
</pre>
<p>strings.xml</p>
<pre class="brush: java;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;resources&gt;

    &lt;string name=&quot;hello&quot;&gt;Hello World, PreferenceSamActivity!&lt;/string&gt;
    &lt;string name=&quot;app_name&quot;&gt;PreferenceSam&lt;/string&gt;
    &lt;string-array name=&quot;names&quot;&gt;
        &lt;item &gt;Ethem&lt;/item&gt;
        &lt;item &gt;Isil&lt;/item&gt;
    &lt;/string-array&gt;
    &lt;string-array name=&quot;stud_num&quot;&gt;
        &lt;item &gt;060401029&lt;/item&gt;
        &lt;item &gt; 1121000300&lt;/item&gt;
    &lt;/string-array&gt;

&lt;/resources&gt;
</pre>
<p>Bunu main activity yaptım.<br />
AndroidManifest.xml</p>
<pre class="brush: java;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
    package=&quot;com.preference.sam&quot;
    android:versionCode=&quot;1&quot;
    android:versionName=&quot;1.0&quot; &gt;

    &lt;application
        android:icon=&quot;@drawable/ic_launcher&quot;
        android:label=&quot;@string/app_name&quot; &gt;
        &lt;activity android:name=&quot;MyPreferences&quot;&gt;
            &lt;intent-filter&gt;
                &lt;action android:name=&quot;android.intent.action.MAIN&quot;/&gt;
                &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot;/&gt;
            &lt;/intent-filter&gt;
        &lt;/activity&gt;

    &lt;/application&gt;

&lt;/manifest&gt;
</pre>
<p><a href="http://hotfile.com/dl/137081229/49614c5/PreferenceSam.zip.html">Download PreferenceSam.zip</a> </p>
<img src="http://feeds.feedburner.com/~r/MehmetEthemSulan/~4/K60zv-gZlqs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ethemsulan.com/2011/10/android-listpreference-onpreferencechangelistener-sample.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.ethemsulan.com/2011/10/android-listpreference-onpreferencechangelistener-sample.html</feedburner:origLink></item>
		<item>
		<title>Android SharedPreferences Sample</title>
		<link>http://feedproxy.google.com/~r/MehmetEthemSulan/~3/yfbakq8NPIg/android-sharedpreferences-sample.html</link>
		<comments>http://www.ethemsulan.com/2011/10/android-sharedpreferences-sample.html#comments</comments>
		<pubDate>Thu, 13 Oct 2011 17:36:24 +0000</pubDate>
		<dc:creator>ethemsulan</dc:creator>
				<category><![CDATA[Android]]></category>

		<guid isPermaLink="false">http://www.ethemsulan.com/?p=1092</guid>
		<description><![CDATA[Android içinde SahredPreferences verileri tutumak için kullanışlı bir yapıdır. Emülatörde /data/data/com.share.preferance/shared_prefs/ethem.xml olarak bakabilirisniz. Bazı uygulamalarda datalarınızı xml olarak tutma ihtiyacı için geliştirilmiş bir yapıtır. Buraya boolean, string, int, long ve float gibi veri tiplerini ekleyebilirsiniz. Aşağıdaki kod ile her activity create edildiğinde önceki verileri siliyorum. shEditor=sharedPreferences.edit(); shEditor.clear(); shEditor.commit(); ethem.xml dosyasını export etmek için aşağıdaki resimde [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Android</strong> içinde <strong>SahredPreferences</strong> verileri tutumak için kullanışlı bir yapıdır. Emülatörde <strong>/data/data/com.share.preferance/shared_prefs/ethem.xml</strong> olarak bakabilirisniz. Bazı uygulamalarda datalarınızı <strong>xml</strong> olarak tutma ihtiyacı için geliştirilmiş bir yapıtır. Buraya boolean, string, int, long ve float gibi veri tiplerini ekleyebilirsiniz. Aşağıdaki kod ile her activity create edildiğinde önceki verileri siliyorum.</p>
<pre class="brush: java;">
        shEditor=sharedPreferences.edit();
        shEditor.clear();
        shEditor.commit();
</pre>
<p><a href="http://www.ethemsulan.com/wp-content/uploads/input.png"><img src="http://www.ethemsulan.com/wp-content/uploads/input-300x221.png" alt="" title="input" width="300" height="221" class="alignnone size-medium wp-image-1093" /></a><br />
ethem.xml dosyasını export etmek için aşağıdaki resimde kırmızı alanı tıklayın.<br />
<a href="http://www.ethemsulan.com/wp-content/uploads/input2.png"><img src="http://www.ethemsulan.com/wp-content/uploads/input2-300x111.png" alt="" title="input2" width="300" height="111" class="alignnone size-medium wp-image-1094" /></a></p>
<p>İçerik te aşağıdaki gibidir.<br />
<a href="http://www.ethemsulan.com/wp-content/uploads/input3.png"><img src="http://www.ethemsulan.com/wp-content/uploads/input3-300x128.png" alt="" title="input3" width="300" height="128" class="alignnone size-medium wp-image-1095" /></a><br />
SharePrefereanceActivity.java</p>
<pre class="brush: java;">
package com.share.preferance;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.AlertDialog.Builder;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class SharePrefereanceActivity extends Activity {
	SharedPreferences sharedPreferences;
	SharedPreferences.Editor shEditor;
	Button button_save, button_show;
	static final private int share_pref_dialog = 1;
	StringBuilder stringBuilder;
	EditText editText_name, editText_age, editText_address;
	static int i=1;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        button_save=(Button) findViewById(R.id.button1_save);
        button_show=(Button) findViewById(R.id.button2_show);
        editText_name=(EditText) findViewById(R.id.editText1_name);
        editText_age=(EditText) findViewById(R.id.editText2_age);
        editText_address=(EditText) findViewById(R.id.editText3_address);

        stringBuilder=new StringBuilder();
//ethem isminde bir xml oluşturuyor ve .edit() mtodu ile ekleme,silme ve güncelleme izni veriyoruz.
        sharedPreferences=getSharedPreferences(&quot;ethem&quot;, Activity.MODE_PRIVATE);
        shEditor=sharedPreferences.edit();
//Bu metod ile daha önceki kayıtları siliyoruz.
        shEditor.clear();
        shEditor.commit();
        button_save.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				int age=0;
				String name=editText_name.getText().toString();
				if(editText_age.getText().toString().length()&gt;0)
				{
				age=Integer.parseInt(editText_age.getText().toString());
				}
				String address=editText_address.getText().toString();
				if(name.length()&gt;0 &amp;&amp; age&gt;0 &amp;&amp; address.length()&gt;0)
				{
				create_share_preferences(name, age, address);
				}else{
					Toast.makeText(getApplicationContext(), &quot;Check your inputs&quot;, Toast.LENGTH_LONG).show();
				}
			}
		});

        button_show.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
//BUtton tıklanınca onCreateDialog() metodu içindeki dialog açılıyor.
				showDialog(share_pref_dialog);

			}
		});

    }
	private String reterieve_share_preferences() {
//.xml içindeki bütün kayıtları stringbuildera atıyoruz.
		 Map&lt;String, ?&gt; all_record = sharedPreferences.getAll();
		 Set set=all_record.entrySet();
		 Iterator it=set.iterator();
		 while (it.hasNext()) {
			 	Map.Entry map =(Map.Entry)it.next();
				stringBuilder.append(map.getKey()+&quot; : &quot;+map.getValue()+&quot;\n&quot;);
				if(i%3==0)
				{
					stringBuilder.append(&quot;************\n&quot;);
				}
				i++;
		}

		return stringBuilder.toString();
	}
	private void create_share_preferences(String name,int age, String address) {
//Girilen kayıtları xml olarak kayıdediyor.
		shEditor.putString(&quot;name&quot;, name);
        shEditor.putInt(&quot;age&quot;, age);
        shEditor.putString(&quot;address&quot;, address);
        shEditor.commit();
        editText_name.setText(&quot;&quot;);
        editText_age.setText(&quot;&quot;);
        editText_address.setText(&quot;&quot;);
	}
	@Override
	protected Dialog onCreateDialog(int id) {

		Builder alBuilder;
		switch(id) {
		case (share_pref_dialog) :
			alBuilder = new AlertDialog.Builder(this);
			alBuilder.setTitle(&quot;Do you want to show all records&quot;).
			setCancelable(false).setPositiveButton(&quot;Yes&quot;,
							new DialogInterface.OnClickListener() {

								@Override
								public void onClick(DialogInterface dialog,
										int which) {
									dialog.cancel();
//ok seçilirse toast ile ekranda gösteriyorum.
									Toast.makeText(getApplicationContext(), reterieve_share_preferences(), Toast.LENGTH_LONG).show();

								}
							}).setNegativeButton(&quot;No&quot;,
							new DialogInterface.OnClickListener() {

								@Override
								public void onClick(DialogInterface dialog,
										int which) {
									finish();

								}
							});
		return alBuilder.create();
		}
		return super.onCreateDialog(id);

	}
}
</pre>
<p>main.xml</p>
<pre class="brush: java;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
    android:orientation=&quot;vertical&quot;
    android:layout_width=&quot;fill_parent&quot;
    android:layout_height=&quot;fill_parent&quot;
    &gt;
    &lt;TableLayout android:layout_width=&quot;fill_parent&quot; android:id=&quot;@+id/tableLayout1&quot; android:layout_height=&quot;wrap_content&quot;&gt;
        &lt;TableRow android:id=&quot;@+id/tableRow1&quot; android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot;&gt;
            &lt;TextView android:layout_height=&quot;wrap_content&quot; android:layout_width=&quot;wrap_content&quot; android:text=&quot;Name :&quot; android:textAppearance=&quot;?android:attr/textAppearanceLarge&quot; android:id=&quot;@+id/textView1&quot;&gt;&lt;/TextView&gt;
            &lt;EditText android:id=&quot;@+id/editText1_name&quot; android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot;&gt;
                &lt;requestFocus&gt;&lt;/requestFocus&gt;
            &lt;/EditText&gt;
        &lt;/TableRow&gt;
        &lt;TableRow android:id=&quot;@+id/tableRow2&quot; android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot;&gt;
            &lt;TextView android:layout_height=&quot;wrap_content&quot; android:layout_width=&quot;wrap_content&quot; android:textAppearance=&quot;?android:attr/textAppearanceLarge&quot; android:id=&quot;@+id/textView2&quot; android:text=&quot;Age :&quot;&gt;&lt;/TextView&gt;
            &lt;EditText android:layout_height=&quot;wrap_content&quot; android:layout_width=&quot;wrap_content&quot; android:inputType=&quot;number&quot; android:id=&quot;@+id/editText2_age&quot;&gt;&lt;/EditText&gt;
        &lt;/TableRow&gt;
        &lt;TableRow android:id=&quot;@+id/tableRow3&quot; android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot;&gt;
            &lt;TextView android:layout_height=&quot;wrap_content&quot; android:layout_width=&quot;wrap_content&quot; android:textAppearance=&quot;?android:attr/textAppearanceLarge&quot; android:id=&quot;@+id/textView3&quot; android:text=&quot;Address :&quot;&gt;&lt;/TextView&gt;
            &lt;EditText android:layout_height=&quot;wrap_content&quot; android:layout_width=&quot;wrap_content&quot; android:inputType=&quot;textPostalAddress&quot; android:id=&quot;@+id/editText3_address&quot;&gt;&lt;/EditText&gt;
        &lt;/TableRow&gt;
        &lt;TableRow android:id=&quot;@+id/tableRow4&quot; android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot;&gt;
            &lt;Button android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:text=&quot;Save Input&quot; android:id=&quot;@+id/button1_save&quot;&gt;&lt;/Button&gt;
            &lt;Button android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:text=&quot;Show Records&quot; android:id=&quot;@+id/button2_show&quot;&gt;&lt;/Button&gt;
        &lt;/TableRow&gt;
    &lt;/TableLayout&gt;
&lt;/LinearLayout&gt;
</pre>
<p>Bu arada com.share.preferance paket ismini yanlış yazmışım:)</p>
<p><a href="http://hotfile.com/dl/137081104/e2d647f/SharePrefereance.zip.html">Download SharePrefereance.zip</a> </p>
<img src="http://feeds.feedburner.com/~r/MehmetEthemSulan/~4/yfbakq8NPIg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ethemsulan.com/2011/10/android-sharedpreferences-sample.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.ethemsulan.com/2011/10/android-sharedpreferences-sample.html</feedburner:origLink></item>
		<item>
		<title>Android Create Customize Adapter and ListView Items</title>
		<link>http://feedproxy.google.com/~r/MehmetEthemSulan/~3/XVbl_kyO-qs/android-create-customize-adapter-and-listview-items.html</link>
		<comments>http://www.ethemsulan.com/2011/09/android-create-customize-adapter-and-listview-items.html#comments</comments>
		<pubDate>Fri, 09 Sep 2011 17:54:12 +0000</pubDate>
		<dc:creator>ethemsulan</dc:creator>
				<category><![CDATA[Android]]></category>

		<guid isPermaLink="false">http://www.ethemsulan.com/?p=1085</guid>
		<description><![CDATA[Android ile Twitter&#8216;a benzer bir basit uygulama yazmaya çalıştım. Normalde uygulamaya login olurken username, profil image ve password sqlite veritabanında tutuluyor ve değerler oradan alınıyor ama örnek sade olsun diye o tarafa girmedim. Bu örneği daha iyi anlamak için Android Custom ListView Items and Adaptera bakabilirsiniz. Uygulama image, user_name ve text alanalrından oluşuyor. En son [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Android</strong> ile <strong>Twitter</strong>&#8216;a benzer bir basit uygulama yazmaya çalıştım. Normalde uygulamaya login olurken username, profil image ve password sqlite veritabanında tutuluyor ve değerler oradan alınıyor ama örnek sade olsun diye o tarafa girmedim. Bu örneği daha iyi anlamak için <a href="http://www.ethemsulan.com/2011/04/android-custom-listview-items-and-adapter.html">Android Custom ListView Items and Adapter</a>a bakabilirsiniz.</p>
<p>Uygulama image, user_name ve text alanalrından oluşuyor. <strong>En son girilen input</strong> en <strong>ListView</strong>&#8216;de en üste ekleniyor.<br />
<a href="http://www.ethemsulan.com/wp-content/uploads/blip.png"><img src="http://www.ethemsulan.com/wp-content/uploads/blip-180x300.png" alt="" title="blip" width="180" height="300" class="alignnone size-medium wp-image-1086" /></a></p>
<p>BlipListActivity.java</p>
<pre class="brush: java;">
package com.blip.list;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;

public class BlipListActivity extends Activity {
    private ListView listView;
    private Button button_send_blip;
    private EditText editText_input_text;
    private BlipVar blipVar_obj;
    private BlipAdapter blipAdapter;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        listView=(ListView) findViewById(R.id.listView1_blip);
        button_send_blip=(Button) findViewById(R.id.button1_send);
        editText_input_text=(EditText) findViewById(R.id.editText1_input);
        Conf.arrayList.clear();

//        BlipVar object=new BlipVar();
//        object.setUser_name(&quot;mehmet&quot;);
//        object.setImage(&quot;http://www.ethemsulan.com/wp-content/themes/mahinhin/images/kelime.png&quot;);
//        object.setText(&quot;Merhaba bu bir textttir&quot;);
//		Conf.arrayList.add(object);
//Kendi adapterimizi yazdik ve listview ile ilişkilendirdik.
        blipAdapter=new BlipAdapter(this, Conf.arrayList);
        listView.setAdapter(blipAdapter);

        button_send_blip.setOnClickListener(send_blip);
    }

    OnClickListener send_blip=new OnClickListener() {

		@Override
		public void onClick(View v) {
			blipVar_obj=new BlipVar();
			blipVar_obj.setUser_name(&quot;isil&quot;);
			blipVar_obj.setImage(&quot;http://www.ethemsulan.com/wp-content/themes/mahinhin/images/kelime.png&quot;);
			blipVar_obj.setText(editText_input_text.getText().toString());
			Conf.arrayList.add(0, blipVar_obj);
//Adaptarimiza data girildiğinde kendisini güncelliyor ve girilen data hemen alta eklenir.
//Yani UI güncelleniyor.
			blipAdapter.notifyDataSetChanged();
			editText_input_text.setText(&quot;&quot;);

		}
	};
}
</pre>
<p>BlipAdapter.java</p>
<pre class="brush: java;">
package com.blip.list;

import java.util.ArrayList;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class BlipAdapter extends ArrayAdapter&lt;BlipVar&gt;{
//BlipVar nesne listesi &quot;names&quot; ekleniliyor.
	private final Activity context;
	private ArrayList&lt;BlipVar&gt; names;

	public BlipAdapter(Activity context,ArrayList&lt;BlipVar&gt; names) {
//Bu username, textview ve image için layouyt oluşrurup nasıl gösterileceğine karar veriyoruz
//R.layout.blip_adapter

		super(context, R.layout.blip_adapter, names);
		this.context = context;

		this.names = names;
	}

	static class ViewHolder {
		public ImageView imageView;
		public TextView textView_user_name,textView_body_text;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {

		final ViewHolder holder;

		View rowView = convertView;
		if (rowView == null) {
			LayoutInflater inflater = context.getLayoutInflater();
			rowView = inflater.inflate(R.layout.blip_adapter, null, true);
			holder = new ViewHolder();
			holder.textView_user_name = (TextView) rowView.findViewById(R.id.textView1_user_name);
			holder.imageView = (ImageView) rowView.findViewById(R.id.imageView1);
			holder.textView_body_text=(TextView) rowView.findViewById(R.id.textView1_blip_text);
			rowView.setTag(holder);
		} else {
			holder = (ViewHolder) rowView.getTag();
		}
//Gelen obje içindeki dataları set ediyor.
		BlipVar blipVar=names.get(position);

		if(blipVar!=null)
		{
			holder.textView_user_name.setText(blipVar.getUser_name());
			holder.imageView.setImageDrawable(Conf.loadImageFromURL(blipVar.getImage()));

			holder.textView_body_text.setText(blipVar.getText());
		}		

		return rowView;
	}

}
</pre>
<p>BlipVar.java</p>
<pre class="brush: java;">
package com.blip.list;

public class BlipVar {
//Adapterimizd ehang, alanalr varsa o alanalr tanimlanir.
	private String user_name,image,text;

	public String getUser_name() {
		return user_name;
	}

	public void setUser_name(String user_name) {
		this.user_name = user_name;
	}

	public String getImage() {
		return image;
	}

	public void setImage(String image) {
		this.image = image;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

}
</pre>
<p>Conf.java</p>
<pre class="brush: java;">

package com.blip.list;

import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.Drawable;
import android.util.Log;

public class Conf {

	public static ArrayList&lt;BlipVar&gt; arrayList=new ArrayList&lt;BlipVar&gt;();

	//Internetten image cekiyor
	 public static Drawable loadImageFromURL(String url)
	    {
	    try
	    {
	    InputStream is = (InputStream) new URL(url).getContent();
	    Drawable d = Drawable.createFromStream(is, &quot;src&quot;);
	    return d;
	    }catch (Exception e) {
	    System.out.println(e);
	    return null;
	    }
	 }

	private static InputStream OpenHttpConnection(String urlString) throws IOException
    {
		//Log.d(TAG, &quot;InputStream&quot;);
		InputStream in = null;
		while(in==null){
			int response = -1;

			URL url = new URL(urlString);
			URLConnection conn = url.openConnection();

			if (!(conn instanceof HttpURLConnection)) throw new IOException(&quot;Not an HTTP connection&quot;);

            HttpURLConnection httpConn = (HttpURLConnection) conn;
            httpConn.setAllowUserInteraction(false);
            httpConn.setInstanceFollowRedirects(true);
            httpConn.setRequestMethod(&quot;GET&quot;);
            httpConn.setReadTimeout(5000);
            httpConn.setConnectTimeout(5000);
            httpConn.connect();
            response = httpConn.getResponseCode();
            if (response == HttpURLConnection.HTTP_OK) {
                in = httpConn.getInputStream();
            }
        }
        return in;
    }

}
</pre>
<p>blip_adapter.xml</p>
<pre class="brush: java;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;LinearLayout
  xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
  android:layout_width=&quot;fill_parent&quot;
  android:layout_height=&quot;fill_parent&quot; android:orientation=&quot;vertical&quot;&gt;
    &lt;LinearLayout android:layout_width=&quot;fill_parent&quot; android:id=&quot;@+id/linearLayout1&quot; android:layout_height=&quot;wrap_content&quot; android:weightSum=&quot;1&quot; android:baselineAligned=&quot;true&quot;&gt;
        &lt;ImageView android:src=&quot;@drawable/icon&quot; android:id=&quot;@+id/imageView1&quot; android:layout_height=&quot;50dip&quot; android:layout_width=&quot;60dip&quot; android:layout_marginLeft=&quot;10dip&quot;&gt;&lt;/ImageView&gt;
        &lt;TextView android:text=&quot;TextView&quot; android:layout_width=&quot;wrap_content&quot; android:id=&quot;@+id/textView1_user_name&quot; android:textAppearance=&quot;?android:attr/textAppearanceLarge&quot; android:layout_height=&quot;fill_parent&quot; android:layout_marginLeft=&quot;50dip&quot;&gt;&lt;/TextView&gt;
    &lt;/LinearLayout&gt;
    &lt;LinearLayout android:layout_width=&quot;fill_parent&quot; android:id=&quot;@+id/linearLayout2&quot; android:layout_height=&quot;wrap_content&quot; android:orientation=&quot;vertical&quot;&gt;
        &lt;TextView android:text=&quot;TextView&quot; android:layout_width=&quot;wrap_content&quot; android:id=&quot;@+id/textView1_blip_text&quot; android:layout_height=&quot;wrap_content&quot; android:textAppearance=&quot;?android:attr/textAppearanceMedium&quot; android:layout_gravity=&quot;center&quot;&gt;&lt;/TextView&gt;
    &lt;/LinearLayout&gt;

&lt;/LinearLayout&gt;
</pre>
<p>main.xml</p>
<pre class="brush: java;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
    android:orientation=&quot;vertical&quot;
    android:layout_width=&quot;fill_parent&quot;
    android:layout_height=&quot;fill_parent&quot;
    &gt;
    &lt;LinearLayout android:layout_width=&quot;fill_parent&quot; android:id=&quot;@+id/linearLayout1&quot; android:layout_height=&quot;wrap_content&quot;&gt;
        &lt;EditText android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:layout_weight=&quot;1&quot; android:id=&quot;@+id/editText1_input&quot; android:inputType=&quot;textMultiLine&quot;&gt;
            &lt;requestFocus&gt;&lt;/requestFocus&gt;
        &lt;/EditText&gt;
    &lt;/LinearLayout&gt;
    &lt;Button android:layout_gravity=&quot;right&quot; android:text=&quot;@string/send_blip&quot; android:id=&quot;@+id/button1_send&quot; android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot;&gt;&lt;/Button&gt;
    &lt;ListView android:id=&quot;@+id/listView1_blip&quot; android:layout_width=&quot;fill_parent&quot; android:layout_height=&quot;fill_parent&quot;&gt;&lt;/ListView&gt;
&lt;/LinearLayout&gt;
</pre>
<p>strings.xml</p>
<pre class="brush: java;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;resources&gt;
    &lt;string name=&quot;hello&quot;&gt;Hello World, BlipListActivity!&lt;/string&gt;
    &lt;string name=&quot;app_name&quot;&gt;BlipList&lt;/string&gt;
    &lt;string name=&quot;send_blip&quot;&gt;Send New Blip&lt;/string&gt;
&lt;/resources&gt;
</pre>
<p>AndroidManifest.xml</p>
<pre class="brush: java;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      package=&quot;com.blip.list&quot;
      android:versionCode=&quot;1&quot;
      android:versionName=&quot;1.0&quot;&gt;
&lt;uses-permission android:name=&quot;android.permission.INTERNET&quot;&gt;&lt;/uses-permission&gt;

    &lt;application android:icon=&quot;@drawable/icon&quot; android:label=&quot;@string/app_name&quot;&gt;
        &lt;activity android:name=&quot;.BlipListActivity&quot;
                  android:label=&quot;@string/app_name&quot;&gt;
            &lt;intent-filter&gt;
                &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
                &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
            &lt;/intent-filter&gt;
        &lt;/activity&gt;

    &lt;/application&gt;
&lt;/manifest&gt;
</pre>
<p><a href="http://hotfile.com/dl/137081039/eb787c2/BlipList.tar.gz.html">Download BlipList.tar.gz</a></p>
<img src="http://feeds.feedburner.com/~r/MehmetEthemSulan/~4/XVbl_kyO-qs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ethemsulan.com/2011/09/android-create-customize-adapter-and-listview-items.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.ethemsulan.com/2011/09/android-create-customize-adapter-and-listview-items.html</feedburner:origLink></item>
		<item>
		<title>Disable Android recreate activity on Orientation Change</title>
		<link>http://feedproxy.google.com/~r/MehmetEthemSulan/~3/x26JdwRza_M/disable-android-recreate-activity-on-orientation-change.html</link>
		<comments>http://www.ethemsulan.com/2011/08/disable-android-recreate-activity-on-orientation-change.html#comments</comments>
		<pubDate>Sat, 06 Aug 2011 12:28:26 +0000</pubDate>
		<dc:creator>ethemsulan</dc:creator>
				<category><![CDATA[Android]]></category>

		<guid isPermaLink="false">http://www.ethemsulan.com/?p=1075</guid>
		<description><![CDATA[Android cihazınızın ekranını çevirirken veya döndürürken activity yeniden create ediliyor. Aşağıdaki uygulamada bar yüklenirken çevirdiğimizde activity recreate edildiğinden yarıda kalıyor ilerleme. Yani dolmuyor. Dolması için tekrar buttona basmamız gerekiyor. OrientationSampActivity.java package com.orientation; import android.app.Activity; import android.app.ProgressDialog; import android.os.Bundle; import android.os.Handler; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.ProgressBar; public class OrientationSampActivity extends Activity { private [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Android cihazınızın</strong> ekranını çevirirken veya döndürürken <strong>activity</strong> yeniden create ediliyor. Aşağıdaki uygulamada bar yüklenirken çevirdiğimizde <strong>activity recreate</strong> edildiğinden yarıda kalıyor ilerleme. Yani dolmuyor. Dolması için tekrar buttona basmamız gerekiyor.<br />
<a href="http://www.ethemsulan.com/wp-content/uploads/bar1.png"><img src="http://www.ethemsulan.com/wp-content/uploads/bar1-180x300.png" alt="" title="bar1" width="180" height="300" class="alignnone size-medium wp-image-1079" /></a><br />
<a href="http://www.ethemsulan.com/wp-content/uploads/bar2.png"><img src="http://www.ethemsulan.com/wp-content/uploads/bar2-180x300.png" alt="" title="bar2" width="180" height="300" class="alignnone size-medium wp-image-1080" /></a><br />
<a href="http://www.ethemsulan.com/wp-content/uploads/bar3.png"><img src="http://www.ethemsulan.com/wp-content/uploads/bar3-180x300.png" alt="" title="bar3" width="180" height="300" class="alignnone size-medium wp-image-1081" /></a><br />
OrientationSampActivity.java</p>
<pre class="brush: java;">
package com.orientation;

import android.app.Activity;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ProgressBar;

public class OrientationSampActivity extends Activity {
    private ProgressBar progressBar1;
    private Button button_bar;
    private Handler handler;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        handler=new Handler();
        progressBar1=(ProgressBar) findViewById(R.id.progressBar1);
        button_bar=(Button) findViewById(R.id.button1_bar);
        progressBar1.setProgress(0);
//Cihazinizi cevirdiginizde(oriantasyon degistiginde) activity yeniden baslatiyor
//ve bar daha once kalinan yerde kaliyor. Yani barin tamamen dolmasş icin buttona tekrar tiklamaniz lazim.
        button_bar.setOnClickListener(new Button.OnClickListener() {
			@Override
			public void onClick(View v) {
				handler.post(runaRunnable);
			}
		});
    }

    Runnable runaRunnable=new Runnable() {

		@Override
		public void run() {
			progressBar1.setProgress(progressBar1.getProgress()+1);

			if(progressBar1.getProgress()&lt;100)
			{
				handler.postDelayed(runaRunnable, 100);
			}else{
				handler.removeCallbacks(runaRunnable);
			}

		}
	};
}
</pre>
<p>main.xml</p>
<pre class="brush: java;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
    android:orientation=&quot;vertical&quot;
    android:layout_width=&quot;fill_parent&quot;
    android:layout_height=&quot;fill_parent&quot;
    &gt;
    &lt;ProgressBar
    android:layout_height=&quot;wrap_content&quot;
    android:id=&quot;@+id/progressBar1&quot;
    style=&quot;?android:attr/progressBarStyleHorizontal&quot;
    android:layout_width=&quot;match_parent&quot;
    android:layout_marginTop=&quot;30px&quot;&gt;
    &lt;/ProgressBar&gt;
    &lt;LinearLayout
    android:layout_width=&quot;match_parent&quot;
    android:id=&quot;@+id/linearLayout1&quot;
    android:orientation=&quot;vertical&quot;
    android:layout_height=&quot;30dip&quot;&gt;
    &lt;/LinearLayout&gt;
    &lt;Button
    android:id=&quot;@+id/button1_bar&quot;
    android:layout_width=&quot;match_parent&quot;
    android:text=&quot;Start Bar&quot;
    android:layout_height=&quot;wrap_content&quot;&gt;
    &lt;/Button&gt;
&lt;/LinearLayout&gt;
</pre>
<p>AndroidManifest.xml</p>
<pre class="brush: java;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      package=&quot;com.orientation&quot;
      android:versionCode=&quot;1&quot;
      android:versionName=&quot;1.0&quot;&gt;

    &lt;application android:icon=&quot;@drawable/icon&quot; android:label=&quot;@string/app_name&quot;&gt;
        &lt;activity android:name=&quot;.OrientationSampActivity&quot;
                  android:label=&quot;@string/app_name&quot;&gt;
            &lt;intent-filter&gt;
                &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
                &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
            &lt;/intent-filter&gt;
        &lt;/activity&gt;

    &lt;/application&gt;
&lt;/manifest&gt;
</pre>
<p>Bu örneği indirip çalıştırınız ve progessbar yarıdayken cihazınızı döndürün:<a href="http://hotfile.com/dl/137080929/0894b1f/OrientationSamp.tar.html"> Download OrientationSamp</a></p>
<p><strong>Sonra aşağıdaki kodu activitye ekleyin ve çalıştırıp tekrar dönderdiğinizde activityniz yeniden create edilmiyor.</strong></p>
<pre class="brush: java;">android:configChanges=&quot;orientation|keyboardHidden&quot;</pre>
<p>AndroidManifest.xml</p>
<pre class="brush: java;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      package=&quot;com.orientation&quot;
      android:versionCode=&quot;1&quot;
      android:versionName=&quot;1.0&quot;&gt;

    &lt;application android:icon=&quot;@drawable/icon&quot; android:label=&quot;@string/app_name&quot;&gt;
        &lt;activity android:name=&quot;.OrientationSampActivity&quot;
                  android:label=&quot;@string/app_name&quot;
                  android:configChanges=&quot;orientation|keyboardHidden&quot;&gt;
            &lt;intent-filter&gt;
                &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
                &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
            &lt;/intent-filter&gt;
        &lt;/activity&gt;

    &lt;/application&gt;
&lt;/manifest&gt;
</pre>
<img src="http://feeds.feedburner.com/~r/MehmetEthemSulan/~4/x26JdwRza_M" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.ethemsulan.com/2011/08/disable-android-recreate-activity-on-orientation-change.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.ethemsulan.com/2011/08/disable-android-recreate-activity-on-orientation-change.html</feedburner:origLink></item>
	</channel>
</rss>

