Tag: android-activity

New Android Project named after Main Activity instead of app name

I am creating new android projects in Eclipse Juno with the latest ADT plugin and im running into a problem with the name of the app. Whenever I run the app, it runs fine, but when I go to the app list, the name of the app isnt there. Instead I have a new app […]

How to Hide keyboard when activity starts

I have an activity with lots of edittext. whenever I load that activity, the keyboard appears and eats half of the screen which makes that activity’s look bad. So is there any way to hide keyboard when I load that activity.

Android Junit test that Button has started activity

I have a menu with some button which each start an activity. I am writing a Junit test for this menu and I cannot seem to find out how to test that the button has loaded the correct activity. So far I have public void testButtons() { TouchUtils.clickView(this, buttonView); assertEquals(com.fgap.ontrack.newsFeed.class, getActivity()); } So far I […]

Getting screen size not from Activity subclass

I have a view subclass that starts from activity subclass like that: this.setContentView(instanceOfMyView); In that my view subclass I want to make some work with screen size, but all people here says that it should be started like: DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); screenWidth = dm.widthPixels; screenHeight = dm.heightPixels; But getWindowManager() is the method […]

getActivity() in fragment is null after orientation change

I have a problem with startActivityForResult, fragments and orientation changes. I call startActivityForResult() from one fragment, then I open second activity with fragment attached. In this second activity when I change orientation and go back to the first activity then onActivityResult (fragment method) is called. But there’s a problem, because a I have something like […]

pausing and resuming child activities in ActivityGroup

I am making a first try att creating a custom ActivityGroup. I am getting everything working except the activity lifecycle methods of the groups child activities. How can i call the onResume/onPause methods in my child activities when they enter/exit focus? I know the tabActivity does this but i cannot find how when looking through […]

Android dispatch touch event to main activity when dialog is showing

I have a DialogFragment, it’s onCreateDialog() looks something like Dialog dialog = new Dialog(getActivity(), R.style.Theme_Translucent_NoTitleBar); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(parentView); dialog.getWindow().setLayout(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.R.color.transparent)); parentView.setOnTouchListener(onTouchListener); return dialog; The onTouchListener looks something like private OnTouchListener onTouchListener = new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { Bundle bundle = getArguments(); int[] coordinates = bundle.getIntArray(COORDINATES); int radius = […]

Android: make interaction to switch between activity like Chrome's Tab Management

Can anyone give me an example, how to create chrome like switching between tabs? I want to make my application to have multiple tab. These tabs can be switched like chrome does. Must I do snapshot on onPause, and then on switching activity display it? Any Android Native API about this feature? As mentioned by […]

AppCompatActivity instead of Activity or FragmentActivity

I’ve been trying out implementing navigation in android through navigation drawers and swipe views with tabs. I’ve followed Google’s developer tutorials (here and here) and for both situations I could never get my code to work unless I changed Activity or FragmentActivity to AppCompatActivity and applied other changes in the action bars code, for instance […]

Determining Max/Min Texture Size Limit in Android OpenGLES

I’ve been assigned to create an open source Java port of this Objective C GPUImage Framework so that it can be used in an Android application. I am to recreate it as closely as I can, with all the variable names, function names, etc all the same. I’m in the beginning stages and I’m trying […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.