---
title: "What's “tools:context” in Android layout files?"  
description: "What's “tools:context” in Android layout files?"  
author: "Royce Roy"  
published: 2015-06-11  
updated: 2015-06-11  
canonical: https://www.mindstick.com/forum/23290/what-s-tools-context-in-android-layout-files  
category: "android"  
tags: ["android"]  
reading_time: 1 minute  

---

# What's “tools:context” in Android layout files?

[Starting](https://www.mindstick.com/blog/12024/things-you-need-to-know-when-starting-your-own-business) with a recent new [version](https://www.mindstick.com/articles/12845/things-to-remember-while-migrating-odoo-to-a-better-version) of ADT, I've noticed this new [attribute](https://www.mindstick.com/blog/221/attributes-reflection) on the [layout](https://www.mindstick.com/articles/12853/android-layout-and-its-type) XML files, for example:\

```
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:tools="http://schemas.android.com/tools"    android:orientation="vertical"    android:layout_width="fill_parent"    android:layout_height="fill_parent"    tools:context=".MainActivity" />
```

What is "tools:[context](https://www.mindstick.com/forum/23245/what-is-context-in-android)" used for?\
How does it even know the exact path to the [activity](https://www.mindstick.com/forum/12894/how-to-force-recreation-of-activity-fragment-on-restore) that is written there? Does it look at the [package](https://www.mindstick.com/blog/12619/tips-for-finding-the-right-package-when-you-buy-instagram-followers) of the app, inside the [manifest](https://www.mindstick.com/interview/2614/how-to-define-an-activity-as-launcher-activity-in-application-manifest-file)?\
Is it limited to classes that extend Context or only [activities](https://www.mindstick.com/interview/2589/describe-android-activities-in-brief)? Is it usable for [ListView](https://www.mindstick.com/articles/12744/listview-in-android) items etc.?

## Replies

### Reply by Anonymous User

This is most probably the activity the tools UI editor uses to render your layout (it will find the right theme based on the activity). This is documented here (around the middle of the article; subscribe to that page to keep up to date).


---

Original Source: https://www.mindstick.com/forum/23290/what-s-tools-context-in-android-layout-files

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
