Showing posts with label Android. Show all posts
Showing posts with label Android. Show all posts

Wednesday, 3 July 2013

Some interesting Github repositories for Android

Ocassionaly, I like to watch github repositories to see if there are interesting projects for future use, or just to learn. One day I was watching github’s repositories I found some interesting projects for Android that you can find interesting :)

Thursday, 4 April 2013

Android Holo Colors Generator

Change Tabhost Setting Programattically


tabHost.setOnTabChangedListener(new OnTabChangeListener() {
@Override
public void onTabChanged(String arg0) {

// Log.i("***Selected Tab", "Im currently in tab with index::" +
// tabHost.getCurrentTab());
selTabPos = tabHost.getCurrentTab();
for (int i = 0; i < tabHost.getTabWidget().getTabCount(); i++) {
if (i == selTabPos) {
tabHost.getTabWidget()
.getChildAt(i)
.setBackgroundColor(Color.parseColor("#4a92ce"));
} else {
tabHost.getTabWidget()
.getChildAt(i)
.setBackgroundColor(Color.parseColor("#253040"));
}


}
}
});

for (int i = 0; i < tabHost.getTabWidget().getTabCount(); i++) {
if (i == selTabPos) {
tabHost.getTabWidget().getChildAt(i)
.setBackgroundColor(Color.parseColor("#4a92ce"));
} else {
tabHost.getTabWidget().getChildAt(i)
.setBackgroundColor(Color.parseColor("#253040"));
}

tabHost.getTabWidget().getChildAt(i).getLayoutParams().height = height / 15;
}

Wednesday, 3 April 2013

How to add tab layout without letting the activity to extend TabActivity?

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    TabHost tabHost = (TabHost) findViewById(R.id.mytabhost);
    tabHost.setup();

    TabSpec tab1 = tabHost.newTabSpec("TAB_1");
    tab1.setIndicator("Tab 1");
    tab1.setContent(R.id.tab1);
    tabHost.addTab(tab1);

    //tab 2 etc...
    TabSpec tab2 = tabHost.newTabSpec("TAB_2");
    tab2.setIndicator("Tab 2");
    tab2.setContent(R.id.tab2);
    tabHost.addTab(tab2);
}
-----------------------------------------------------------------------------------------------------------------------
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mytabhost"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >


    <LinearLayout android:id="@+id/LinearLayout01"
        android:orientation="vertical" android:layout_height="fill_parent"
        android:layout_width="fill_parent">

        <TabWidget android:id="@android:id/tabs"
            android:layout_height="wrap_content" android:layout_width="fill_parent"></TabWidget>

        <FrameLayout android:id="@android:id/tabcontent"
            android:layout_height="fill_parent" android:layout_width="fill_parent">
            <LinearLayout android:layout_width="fill_parent"
                android:layout_height="fill_parent" android:id="@+id/tab1">
                <!-- tab 1 content goes here -->
            </LinearLayout>
            <LinearLayout android:layout_width="fill_parent"
                android:layout_height="fill_parent" android:id="@+id/tab2">
                <!-- tab 2 content goes here -->
            </LinearLayout>

        </FrameLayout>

    </LinearLayout>

</TabHost>


Tuesday, 2 April 2013

Circular Menu Part-1

Main Activity


public class TestMenuActivity extends Activity {
CircleView cView;

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

int numberOfElements = 11;
View[] elems = new View[numberOfElements];

EditText tv = new EditText(this);
tv.setText("Some text");
tv.setLayoutParams(new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT));
elems[0] = tv;

for (int i = 1; i < numberOfElements - 1; i++) {
Button newButton = new Button(this);
newButton.setText("Button   " + i);
newButton.setLayoutParams(new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT));
elems[i] = newButton;
}

Spinner sp = new Spinner(this);
sp.setLayoutParams(new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT));
elems[numberOfElements - 1] = sp;

cView = new CircleView(this, 115, elems);
setContentView(cView);
}
}


How To Create Circle View (Dynamically...)


public class CircleView extends RelativeLayout {
static final int centerId = 111;
private final int radius;

private RelativeLayout.LayoutParams createNewRelativeLayoutParams() {
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
lp.addRule(RelativeLayout.ABOVE, centerId);
lp.addRule(RIGHT_OF, centerId);
return lp;
}

private View prepareElementForCircle(View elem, int distX, int distY) {
RelativeLayout.LayoutParams lp = createNewRelativeLayoutParams();

elem.measure(0, 0);
int deltaX = elem.getMeasuredWidth() / 2;
int deltaY = elem.getMeasuredHeight() / 2;
lp.setMargins(distX - deltaX, 0, 0, radius - distY - deltaY);
elem.setLayoutParams(lp);
return elem;
}

public CircleView(Context context, int radius, View[] elements) {
super(context);
this.radius = radius;

RelativeLayout.LayoutParams lpView = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.FILL_PARENT,
RelativeLayout.LayoutParams.FILL_PARENT);
this.setLayoutParams(lpView);

View center = new View(context);
center.setId(centerId);
RelativeLayout.LayoutParams lpcenter = new RelativeLayout.LayoutParams(
0, 0);
lpcenter.addRule(CENTER_HORIZONTAL);
lpcenter.addRule(CENTER_VERTICAL);
center.setLayoutParams(lpcenter);
this.addView(center);

this.addView(prepareElementForCircle(elements[0], 0, 0));
if (elements.length % 2 == 0) {
this.addView(prepareElementForCircle(elements[elements.length / 2],
0, 2 * radius));
}
if (elements.length > 2) {
for (int i = 1; i <= (elements.length - 1) / 2; i++) {
int y = i * 4 * radius / elements.length;
int x = (int) Math.sqrt(Math.pow(radius, 2)
- Math.pow((radius - y), 2));
this.addView(prepareElementForCircle(elements[i], x, y));
this.addView(prepareElementForCircle(elements[elements.length
- i], -x, y));
}
}
}

}


Monday, 1 April 2013

Google to Launch an Android-powered Smartwatch






























We are hearing a lot of news of Smart watch, that Apple and Samsung wants to launch Smart Watch now Google also wants to Jump in launch Android-powered Smartwatch. Google owns a patent of Dual-screen smart watch since 2011, and now Android team is working on that watch its possibiity that Googlesmart watch hit the market before Google Glass.



A smartwatch boom seems to be going on. Besides smaller companies debuting new wrist technology, the tech giants are also grabbing for a piece of the pie. Google is the newest company to supposedly be stepping into the watch world. According to The Financial Times, Google’s smartwatch is allegedly being developed by the company’s Android unit rather than its X Lab.
This is telling because it means that, unlike Google Glass, the company may be looking to get a consumer product out to users on a speedier timeline. According to The Financial Times, Google filed a patent application for a “smart watch” in 2011. Apparently, the patent has a dual-screened display and a interactive user interface. Over the past couple of weeks Apple has been rumored to be coming out with a smartwatch and Samsung has confirmed it’s working on one. Of course, none of these mammoth companies are breaking new ground. A lot of smartwatches, fitness bands, or some hybrid of the two have already been unveiled, including the long-awaited Pebble wristwatch and the 007-inspired Martian.

Monday, 11 March 2013

10 Fantastic Ideas for B2B Mobile Apps


1.) Supply Ordering App: Are you a business product supplier? Create a supply ordering app that lets people order new supplies by photographing a bar code on the product they need restocked. Users can securely store their shipping and billing information in the app, edit the quantity, and quickly get more of the supplies they need. Make their lives even easier by tapping into their buying history and providing push notifications for when they are likely running low on a certain supply. You should also include reviews, recommended products, and shipping status notifications for a superior experience.

2.) Event App: Plan on hosting an event this year? Create an event-specific app with exhibit maps, session schedules, speaker bios, and attendee-provided contact information for networking. You can also let people push out messages to Twitter, LinkedIn, and Facebook right from the app.

3.) ROI Calculator: The ROI calculator is a tried and true app for business people who are constantly on the hook for proving ROI. Whatever action you want your prospects to take, an app that lets them quickly calculate the ROI of some aspect of it not only makes them happier, but it also makes your sale easier.

4.) Code Generator: Have an audience that has to do online design during their day job? Create a code generator to make it easier! For example, a marketer who is a novice with HTML might select your HTML code generator to quickly figure out how to code her next email campaign. That's one helpful app that can be used over and over, and spread to a wider audience quickly.

5.) Security Alert App: Are your customers concerned with online security? People in IT security or software can create an app that delivers security alerts when customers experience a security breach. IT departments the world over will love you for it.

6.) Networking App: Use the location-aware capabilities of mobile devices to create an app that lets your prospects and customers find people in their industry with which to network. Couple this with thought leadership content delivered through your app, and you're on your way to becoming the LinkedIn of your industry.

7.) Content Segmenting App: Is your content one of your biggest assets? If you're publishing high volumes of content, create an app that lets your readers select only the topics they want to learn about, and receive updates when you publish something new on that subject.

8.) Software Features App: If you're a software company, make an app that lets people use features of your software on their mobile devices. For example, create an app that alerts your sales team when a new lead needs to be contacted. This way, they can beat your competitors to the punch and make sales even when they're not at their desk!

9.) Calculator App: B2B companies with an audience in a mathematical field can create a calculator app. Provide quick calculations based on frequently used formulas to help them out in their day-to-day job. This will solidify your status as a reliable and helpful resource in your industry and make you a part of their daily lives.