Skip to content

Instantly share code, notes, and snippets.

View gmsetiawan's full-sized avatar
💭
Friendly

Gunamullia Setiawan gmsetiawan

💭
Friendly
  • DroidClass
  • Indonesian
View GitHub Profile
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.gmsetiawan.droidclass.MainActivity$PlaceholderFragment" >
package com.gmsetiawan.droidclass;
import java.util.Arrays;
import android.support.v7.app.ActionBarActivity;
import android.support.v4.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
Don't forget to add app_id at string.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
...
<string name="app_id">272943959560173</string>
</resources>
then add meta and activity at manifest
public static class PlaceholderFragment extends Fragment {
public PlaceholderFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_main, container, false);
package com.example.droidclass;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class ActivityTwo extends Activity {
TextView tvReceived;
package com.example.droidclass;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class MainActivity extends Activity {
public class MyActivity extends Activity implements View.OnClickListener {
Button button1, button2, button3;
@Override
public void onCreate(Bundle bundle) {
super.onCreate();
/.../
button1 = (Button) findViewById(R.id.button1);
button2 = (Button) findViewById(R.id.button2);
package com.example.droidclass;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;
final TextView tvRate = (TextView) findViewById(R.id.textView6);
RatingBar rbRate = (RatingBar) findViewById(R.id.ratingBar1);
rbRate.setOnRatingBarChangeListener(new OnRatingBarChangeListener() {
@Override
public void onRatingChanged(RatingBar ratingBar, float rating,
boolean fromUser) {
// TODO Auto-generated method stub
tvRate.setText(String.valueOf(rating));
}
public class FormWidgetActivity extends Activity{
private Handler progressBarHandler = new Handler();
ProgressBar mProgressBar, mProgressBarHorizontal;
int iProgressBarStatus = 0;
TextView tvStatusProgressBar;
@Override