Android – Bullets in ListView

Posted by Unknown Senin, 18 Februari 2013 0 komentar
main.xml :
<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="10dp">

<ListView
android:id="@+id/listView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:listSelector="@android:color/transparent"
android:divider="@null"/>
</LinearLayout>
create a bullet.xml in drawable folder:
<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<size
android:height="6dp"
android:width="6dp"/>
<solid android:color="#FF00F0"/>
</shape>
list_item.xml for creating custom listview:
<?xml version="1.0" encoding="utf-8"?> 
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/itemText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/bullet"
android:drawablePadding="8dp"
android:padding="5dp"
android:text="List Item"
android:textSize="20sp"/>
BulletListViewActivity.java
public class BulletedListViewActivity extends Activity {
/** Called when the activity is first created. */
ArrayList<string> listCountry;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
prepareList();
ListView listView = (ListView)findViewById(R.id.listView);
listView.setAdapter(new ArrayAdapter<string>(
this, R.layout.list_item, listCountry));
}
public void prepareList()
{
listCountry = new ArrayList<string>();
listCountry.add("India");
listCountry.add("Brazil");
listCountry.add("Canada");
listCountry.add("China");
listCountry.add("France");
listCountry.add("Germany");
listCountry.add("Iran");
listCountry.add("Italy");
listCountry.add("Japan");
listCountry.add("Korea");
listCountry.add("Mexico");
listCountry.add("Netherlands");
listCountry.add("Portugal");
listCountry.add("Russia");
listCountry.add("Saudi Arabia");
listCountry.add("Spain");
listCountry.add("Turkey");
listCountry.add("United Kingdom");
listCountry.add("United States");
}}

                

Baca Selengkapnya ....

How to write interfaces in java or Android?

Posted by Unknown 0 komentar
what is an Interface?
An interface is a collection of abstract methods. A class implements an interface, thereby inheriting the abstract methods of the interface.
An interface is not a class. Writing an interface is similar to writing a class, but they are two different concepts. A class describes the attributes and behaviors of an object. An interface contains behaviors that a class implements.
Unless the class that implements the interface is abstract, all the methods of the interface need to be defined in the class.

MainActivity.java
public class MainActivity extends Activity implements Interface {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public void testFunctionOne() {
System.out.println("Print from testFunctionOne in the Interface");
}
@Override
public void testFunctionTwo() {
System.out.println("Print from testFunctionTwo in the Interface");
}}
in Interface.java
public interface Interface  {    
void testFunctionOne();
void testFunctionTwo(); }

Baca Selengkapnya ....

Using DialogFragments in Android

Posted by Unknown Minggu, 17 Februari 2013 0 komentar
MainActivity.java :
public class MainActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
FragmentManager fm = getSupportFragmentManager();
dialogfragment testDialog = new dialogfragment();
testDialog.setRetainInstance(true);
testDialog.show(fm, "fragment_name");
}}
Dialogfragment.java :
public class Dialogfragment extends DialogFragment {    
public void TestDialog() {
// Empty constructor required for DialogFragment
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.dialog, container);
return view;
} }
dialog.xml :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/edit_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/lbl_your_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello from Mark's Playground, DialogFragment Demo"/>
</LinearLayout>

  


Baca Selengkapnya ....

Fragmentation In Android

Posted by Unknown 0 komentar

See more basics on Android along with interview questions

Fragments are a portion of an Activity:
Load a fragment Activity to call a fragment :
public class MainActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
} }
activity_main :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<fragment
android:id="@+id/titles"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="1"
class="com.example.googlefragment.TitlesFragment"/>
//calls the fragment
</LinearLayout>
TitlesFragment :
public class TitlesFragment extends android.support.v4.app.ListFragment {
boolean mDualPane;
int mCurCheckPosition = 0;
String titles[] = { "Item one", "Item two", "Item three" };
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// Populate list with our static array of titles.setListAdapter(new ArrayAdapter(getActivity(),
android.R.layout.simple_dropdown_item_1line,titles));

// Check to see if we have a frame in which to embed the details
// fragment directly in the containing UI.
View detailsFrame = getActivity().findViewById(R.id.details);
mDualPane = detailsFrame != null && detailsFrame.getVisibility() == View.VISIBLE;
if (savedInstanceState != null) {
// Restore last state for checked position.
mCurCheckPosition = savedInstanceState.getInt("curChoice", 0);
}
if (mDualPane) {
// In dual-pane mode, the list view highlights the selected item.
getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);
// Make sure our UI is in the correct state.
showDetails(mCurCheckPosition);
}else
{
System.out.println("NOT DUAL");
} }

@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putInt("curChoice", mCurCheckPosition);
}
@Override
public void onListItemClick(ListView l, View v,int position,long id) {
showDetails(position);
}
void showDetails(int index) {
mCurCheckPosition = index;
if (mDualPane) {
// We can display everything in-place with fragments,so update
// the list to highlight the selected item and show the data.
getListView().setItemChecked(index, true);
// Check what fragment is currently shown,replace if needed.
DetailsFragment details = (DetailsFragment)
getFragmentManager().findFragmentById(R.id.details);
if (details == null || details.getShownIndex()!=index) {
// Make new fragment to show this selection.
details = DetailsFragment.newInstance(index);
// Execute a transaction, replacing any existing fragment
// with this one inside the frame.
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.details, details);
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
ft.commit();
}
} else {
// Otherwise we need to launch a new activity to display
// the dialog fragment with selected text.
Intent intent = new Intent();
intent.setClass(getActivity(),DetailsActivity.class);
intent.putExtra("index", index);
startActivity(intent);
} }}
DetailsActivity :
public class DetailsActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
setContentView(R.layout.details_lay);
System.out.println("LANNNNNNNNNNN");
return;
}
if (savedInstanceState == null) {
System.out.println("LLLLLLLLLLL");
Fragment details = new DetailsFragment();
details.setArguments(getIntent().getExtras());
getSupportFragmentManager().beginTransaction()
.add(android.R.id.content, details).commit();

} } }
details_lay:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/details"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="1"
class="com.example.googlefragment.DetailsFragment"/>
</LinearLayout>
DetailsFragment :
public class DetailsFragment extends Fragment {
static int i = 0;
public static DetailsFragment newInstance(int index) {
DetailsFragment f = new DetailsFragment();
// Supply index input as an argument.
Bundle args = new Bundle();
args.putInt("index", index);
i = index;
f.setArguments(args);
return f;
}
public int getShownIndex() {
return getArguments().getInt("index", 0);
}
@Override
public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
if (container == null) {
return null;
}
WebView wv = new WebView(getActivity());
wv.loadData("Hello " + i, "text/html", "utf-8");
return wv;
} }
NOTE: Put layout under two separate folder for layout and portrait.


Baca Selengkapnya ....

New Google Now: More of the information you need, at just the right time.

Posted by Unknown Rabu, 13 Februari 2013 0 komentar
When computers do the hard work, you can get on with the things that matter in life. Google Now helps you do just that, giving you the information you need, before you even have to ask. Like updating you with flight times, pulling up your boarding pass when you arrive at the airport, or showing you the weather at your next travel destination. Today, we’re making Google Now even more useful by integrating new partners and making all your information even easier to access.

Going to the movies? Movie cards now include the latest ratings from Rotten Tomatoes, so you can pick the right movie. Purchase your tickets through Fandango, and Google Now will remind you when you need to leave for the theater, and pull up your tickets once you arrive.


In the market for a new home? Google Now can provide you with nearby real estate listings from Zillow. Plus, when you are checking out that remodeled kitchen at the open house, Now will automatically pull up more information about the listing.


Of course, all of this information is most helpful when it’s front and center and ready when you are. The new Google Now widget brings all your important Now cards to your home or lock screen, so you don’t even have to open the app.



When Google Now first launched last summer, we promised it was just the beginning, and it would continue to get better at delivering you more of the information you need, before you even ask. This is the fourth update since launch, and we’re just getting started!


To try out these new cards, get the latest version of the Google Search app for Android, available on Google Play for devices running Android 4.1 and above.

Posted by Baris Gultekin, Product Management Director

Baca Selengkapnya ....

Apex Launcher Pro Apk Android

Posted by Unknown Sabtu, 09 Februari 2013 0 komentar

Powerful, fast, and highly customizable home replacement for Android 4.0+. Apex Launcher helps you create a customized homescreen experience on your Android (4.0+) device. Apex Launcher Pro unlocks the following features:




- Multiple configurable drawer tabs
- Unread count notifications
- Dock swipe gestures
- Two finger gestures
- More transition effects
- ADW, LauncherPro, and Go Launcher theme support
- Batch add option for folders
- Option to merge folder contents
- Widgets in dock (1x1 only)
- Overlapping widgets
- More features on the way!

This app unlocks premium features in Apex Launcher. You must have the latest version of Apex Launcher (free) installed on your device. This app just acts as a license key to unlock the pro features.

Click For Download




Baca Selengkapnya ....

LG Optimus G makes its way to the land down under March 13

Posted by Unknown Rabu, 06 Februari 2013 0 komentar
LG is rolling out its flagship Optimus G to more countries, and that rollout is set to hit Australia on March 13th. The Optimus G has been available here in the states (and a couple other countries) since October, but LG has just recently announced that the device will make its way to other countries in the coming months. Australians hoping to pick up an Optimus G will be stuck with just one carrier, Telstra, and no pricing has been released just yet. Based on what has LG stated before, this device will have LTE on board and should also ship out of the box with Jelly Bean, which is a nice consolation prize considering how late it's arriving.

Read More:
http://www.androidcentral.com/


Baca Selengkapnya ....

Android 4.1.2 Jelly Bean now rolling out to Motorola RAZR i smartphones in the UK

Posted by Unknown 0 komentar




Motorola RAZR i handsets have begun receiving the highly anticipated update to Android 4.1.2 Jelly Bean today. The new firmware brings the usual slew of new features including expandable notifications, Google Now, Project Butter and Face Unlock.

Read More:
http://www.talkandroid.com/150026-android-4-1-2-jelly-bean-now-rolling-out-to-motorola-razr-i-smartphones-in-the-uk/#more-150026



Baca Selengkapnya ....

Average North American user could consume 6GB of mobile data per month by 2017

Posted by Unknown 0 komentar

According to research and predictions by Cisco, the average North American smartphone user could consume 6GB of data per month by 2017. The annual report, which has been released six times now, shows smartphone data usage increasing 13-fold worldwide in the next four years. The average North American user currently consumes 752MB per month as of 2012, and the worldwide average is just 200MB. In just four short years those numbers are expected to hit 6GB and 2GB, respectively. These numbers are even slightly more conservative than previous years and estimates from other entities.

Read More:
http://www.androidcentral.com/

Baca Selengkapnya ....

Suspect: The Run! for Galaxy Y, Micromax a25, Y Duos lite and all qvga phones.

Posted by Unknown Selasa, 05 Februari 2013 0 komentar


They're out ta get you, but will they catch you? Fasten your seatbelt, put the pedal to the metal and flee the cops at all cost! Avoid traffic, evade police blockades, collect bonuses and coins, unlock new cars and upgrades! Drive recklessly at supersonic speeds and become the king of the road in this new, addicting and FREE arcade game by Jujubee!
Get rid of all obstacles in your path, use the nitro boost to smash through other cars and to destroy barricades! Buy magnets, multipliers and other bonuses to collect even more coins, and put all your skills to get as far as possible, with utter disregard for the traffic rules! Compete against your friends on the online leaderboards and lose yourself in this awesome high-octane treat!
Features and highlights:
- Fun and motivating challenges!
- Cool music and real police sounds!
- Many great cars to master!
- High-speed, addicting action!
- Tasty and useful bonuses!
- Online leaderboards!
- Buttons, tilt and swipe controls - you choose!
- Hours of intense arcade action!
- Gorgeous visual effects!
- A bit of sarcastic humor!
- And much more!
Hope you'll enjoy this free and extremely fun ride!

Get the Game NOW - DOWNLOAD THE APK HERE - http://www54.zippyshare.com/v/84663543/file.html


Baca Selengkapnya ....

Temple Run 2 for Galaxy Y, Micromax Canvas, Micromax a25 Smarty, Y DUOS lite.

Posted by Unknown 0 komentar


Hi guys, mTz here.

Temple Run has so far been one of my favorite games on any device. The game is so simple and yet so addictive.  I was personally waiting for an update for this game forever.

And then I heard about Temple Run 2, but was really sad that it was released on iOS only. And no dates for the Google Play Store launch was announced. I got pretty upset. But then suddenly it got released on the Play Store. But it didn't work for My Galaxy Y, it worked on my Nexus 7 but not my Y. Which made me upset before I found this version that actually works on QVGA phones.

So there you go, download the APK from the link below and get your game going.

Post your highscore on our facebook page if you would like to do it - www.facebook.com/sgalaxyy/

Here's the link to the APK- http://adf.ly/IY3nl

ENJOY GUYS! mTz here.

Baca Selengkapnya ....
Trik SEO Terbaru support Online Shop Baju Wanita - Original design by Bamz | Copyright of android populer.